Container objects are the outer wrapper for all LIF objects.
A Lappsgrid Container consists of:
For example:
String token = "http://vocab.lappsgrid.org/Token"
Container container = new Container();
container.setText("Goodbye cruel world, I am leaving you today.");
container.setLanguage("en");
View view = container.newView();
view.addAnnotation("tok1", token, 0, 7);
...
List views = container.findViewsThatContain(token);
assertEquals(view, views.get(0));
Since LIF objects are serialized to JSON-LD they also define a context
. By
default all LIF objects refer to the remote context document
http://vocab.lappsgrid.org/context-1.0.0.jsonld.
However, a local (in-line) context can be used with allows the context to be
manipulated at runtime.
Container container = new Container(ContextType.LOCAL);
Map context = (Map) container.getContext();
context.put("@vocab", "http://example.com/custom/vocabulary");
Modifiers | Name | Description |
---|---|---|
enum |
Container.ContextType |
Modifiers | Name | Description |
---|---|---|
static Map |
LOCAL_CONTEXT |
|
static String |
REMOTE_CONTEXT |
Type | Name and description |
---|---|
void |
addView(View view) |
void |
define(String name, String iri) |
View |
findViewById(String id) |
List<View> |
findViewsThatContain(String type) |
List<View> |
findViewsThatContainBy(String type, String producer) |
String |
getLanguage() |
Object |
getMetadata(String name) |
String |
getText() |
View |
getView(int index) |
View |
newView(String id) |
View |
newView() |
void |
setLanguage(String lang) |
void |
setMetadata(String name, Object value) |
void |
setText(String text) |
The text that is to be annotated.
Any meta-data attached to this container.
URL to the schema the document conforms to.
Default (empty) constructor uses the remote context.
org.lappsgrid:serialization:2.7.0