Open Annotation - linkedannotation/blah2015 GitHub Wiki
Karin has been working on implementing a translation tool for PubAnnotation JSON -> Open Annotation. It is being implemented in Java using the Sesame API.
The implementation is currently available in bitbucket: https://bitbucket.org/readbiomed/pub2openann/
Issues:
- Not correctly using prefixes for namespaces [technical issue]
- Integration with NanoPublications pending [modelling issue]
- should be straightforward: introduce a nanopublication that has the assertion graph as its assertion.
- Code brittle
- makes assumptions about structure of PubAnnotation document URIs
- makes assumptions about namespaces for relations (conversion of Entity and Relation labels should be configured)
- selection of "primary" assertion for insertion of a relation is hard-code to select 'object' target
- Currently, 'event' annotations target only the trigger word of the annotation as their span, but their body contains all relevant statements associated with the event.
Here is a sample input/output for entities and relations, reflecting the current status.
The text spans are represented with a http://www.w3.org/ns/oa#TextPositionSelector and the bodies of the annotations are represented with a named graph containing all of the statements associated with the annotation -- an assertion in NanoPublication terminology.
Input (with "text" removed for ease of reading):
{
"text": "IRF-4 expression in CML may be induced by IFN-α therapy",
"denotations": [
{"id": "T1", "span": {"begin": 0, "end": 5}, "obj": "Protein"},
{"id": "T2", "span": {"begin": 42, "end": 47}, "obj": "Protein"},
{"id": "E1", "span": {"begin": 6, "end": 16}, "obj": "Expression"},
{"id": "E2", "span": {"begin": 31, "end": 38}, "obj": "Regulation"}
],
"relations": [
{"id": "R1", "subj": "T1", "pred": "themeOf", "obj": "E1"},
{"id": "R2", "subj": "E1", "pred": "themeOf", "obj": "E2"},
{"id": "R3", "subj": "T2", "pred": "causeOf", "obj": "E2"}
]
}
Output:
[ {
"@id" : "http://pubannotation.org/Doc-Ann-1",
"@type" : [ "http://www.w3.org/ns/oa#annotation" ],
"http://www.w3.org/ns/oa#hasBody" : [ {
"@id" : "http://pubannotation.org/Doc-T1-assertion"
} ],
"http://www.w3.org/ns/oa#hasTarget" : [ {
"@id" : "http://pubannotation.org/Doc-SR1"
} ],
"http://www.w3.org/ns/oa#motivatedBy" : [ {
"@id" : "http://www.w3.org/ns/oa#tagging"
} ],
"http://www.w3.org/ns/oa#serializedBy" : [ {
"@id" : "http://pubannotation.org"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-Ann-2",
"@type" : [ "http://www.w3.org/ns/oa#annotation" ],
"http://www.w3.org/ns/oa#hasBody" : [ {
"@id" : "http://pubannotation.org/Doc-T2-assertion"
} ],
"http://www.w3.org/ns/oa#hasTarget" : [ {
"@id" : "http://pubannotation.org/Doc-SR2"
} ],
"http://www.w3.org/ns/oa#motivatedBy" : [ {
"@id" : "http://www.w3.org/ns/oa#tagging"
} ],
"http://www.w3.org/ns/oa#serializedBy" : [ {
"@id" : "http://pubannotation.org"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-Ann-3",
"@type" : [ "http://www.w3.org/ns/oa#annotation" ],
"http://www.w3.org/ns/oa#hasBody" : [ {
"@id" : "http://pubannotation.org/Doc-E1-assertion"
} ],
"http://www.w3.org/ns/oa#hasTarget" : [ {
"@id" : "http://pubannotation.org/Doc-SR3"
} ],
"http://www.w3.org/ns/oa#motivatedBy" : [ {
"@id" : "http://www.w3.org/ns/oa#tagging"
} ],
"http://www.w3.org/ns/oa#serializedBy" : [ {
"@id" : "http://pubannotation.org"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-Ann-4",
"@type" : [ "http://www.w3.org/ns/oa#annotation" ],
"http://www.w3.org/ns/oa#hasBody" : [ {
"@id" : "http://pubannotation.org/Doc-E2-assertion"
} ],
"http://www.w3.org/ns/oa#hasTarget" : [ {
"@id" : "http://pubannotation.org/Doc-SR4"
} ],
"http://www.w3.org/ns/oa#motivatedBy" : [ {
"@id" : "http://www.w3.org/ns/oa#tagging"
} ],
"http://www.w3.org/ns/oa#serializedBy" : [ {
"@id" : "http://pubannotation.org"
} ]
}, {
"@graph" : [ {
"@id" : "http://pubannotation.org/Doc-E1",
"http://www.w3.org/2000/01/rdf-schema#subClassOf" : [ {
"@id" : "http://bionlp.dbcls.jp/ontology/geniatask.owl#Expression"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-T1",
"http://bionlp.dbcls.jp/ontology/geniatask.owl#themeOf" : [ {
"@id" : "http://pubannotation.org/Doc-E1"
} ]
} ],
"@id" : "http://pubannotation.org/Doc-E1-assertion"
}, {
"@graph" : [ {
"@id" : "http://pubannotation.org/Doc-E1",
"http://bionlp.dbcls.jp/ontology/geniatask.owl#themeOf" : [ {
"@id" : "http://pubannotation.org/Doc-E2"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-E2",
"http://www.w3.org/2000/01/rdf-schema#subClassOf" : [ {
"@id" : "http://bionlp.dbcls.jp/ontology/geniatask.owl#Regulation"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-T2",
"http://bionlp.dbcls.jp/ontology/geniatask.owl#causeOf" : [ {
"@id" : "http://pubannotation.org/Doc-E2"
} ]
} ],
"@id" : "http://pubannotation.org/Doc-E2-assertion"
}, {
"@id" : "http://pubannotation.org/Doc-S0-5",
"@type" : [ "http://www.w3.org/ns/oa#TextPositionSelector" ],
"http://www.w3.org/ns/oa#end" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#int",
"@value" : "5"
} ],
"http://www.w3.org/ns/oa#start" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#int",
"@value" : "0"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-S31-38",
"@type" : [ "http://www.w3.org/ns/oa#TextPositionSelector" ],
"http://www.w3.org/ns/oa#end" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#int",
"@value" : "38"
} ],
"http://www.w3.org/ns/oa#start" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#int",
"@value" : "31"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-S42-47",
"@type" : [ "http://www.w3.org/ns/oa#TextPositionSelector" ],
"http://www.w3.org/ns/oa#end" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#int",
"@value" : "47"
} ],
"http://www.w3.org/ns/oa#start" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#int",
"@value" : "42"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-S6-16",
"@type" : [ "http://www.w3.org/ns/oa#TextPositionSelector" ],
"http://www.w3.org/ns/oa#end" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#int",
"@value" : "16"
} ],
"http://www.w3.org/ns/oa#start" : [ {
"@type" : "http://www.w3.org/2001/XMLSchema#int",
"@value" : "6"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-SR1",
"@type" : [ "http://www.w3.org/ns/oa#SpecificResource" ],
"http://www.w3.org/ns/oa#hasSelector" : [ {
"@id" : "http://pubannotation.org/Doc-S0-5"
} ],
"http://www.w3.org/ns/oa#hasSource" : [ {
"@id" : "http://doc.txt"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-SR2",
"@type" : [ "http://www.w3.org/ns/oa#SpecificResource" ],
"http://www.w3.org/ns/oa#hasSelector" : [ {
"@id" : "http://pubannotation.org/Doc-S42-47"
} ],
"http://www.w3.org/ns/oa#hasSource" : [ {
"@id" : "http://doc.txt"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-SR3",
"@type" : [ "http://www.w3.org/ns/oa#SpecificResource" ],
"http://www.w3.org/ns/oa#hasSelector" : [ {
"@id" : "http://pubannotation.org/Doc-S6-16"
} ],
"http://www.w3.org/ns/oa#hasSource" : [ {
"@id" : "http://doc.txt"
} ]
}, {
"@id" : "http://pubannotation.org/Doc-SR4",
"@type" : [ "http://www.w3.org/ns/oa#SpecificResource" ],
"http://www.w3.org/ns/oa#hasSelector" : [ {
"@id" : "http://pubannotation.org/Doc-S31-38"
} ],
"http://www.w3.org/ns/oa#hasSource" : [ {
"@id" : "http://doc.txt"
} ]
}, {
"@graph" : [ {
"@id" : "http://pubannotation.org/Doc-T1",
"http://www.w3.org/2000/01/rdf-schema#subClassOf" : [ {
"@id" : "http://bionlp.dbcls.jp/ontology/geniatask.owl#Protein"
} ]
} ],
"@id" : "http://pubannotation.org/Doc-T1-assertion"
}, {
"@graph" : [ {
"@id" : "http://pubannotation.org/Doc-T2",
"http://www.w3.org/2000/01/rdf-schema#subClassOf" : [ {
"@id" : "http://bionlp.dbcls.jp/ontology/geniatask.owl#Protein"
} ]
} ],
"@id" : "http://pubannotation.org/Doc-T2-assertion"
} ]