Tutorial on the NIF format - organized for the FREME H2020 project.
Video recording of the GoToMeeting: https://www.wuala.com/fsasaki/Documents/projects/freme/presentations/?key=oHQ8oIZy8d5k
17. ●
●
@prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .
// Input NIF document for translation.
<http://example.org/document/1#char=0,17>
a nif:String , nif:Context , nif:RFC5147String ;
nif:isString "text to translate"@en;
nif:beginIndex "0"^^xsd:nonNegativeInteger;
nif:endIndex "3680"^^xsd:nonNegativeInteger.
// String within the document intended for translation.
<http://example.org/document/1#char=0,4>
a nif:String , nif:RFC5147String ;
nif:anchorOf "text"@en;
itsrdf:translate "yes" ;
nif:referenceContext <http://example.org/document/1#char=0,17>.
// String within the document not intended for translation.
<http://example.org/document/1#char=8,17>
a nif:String , nif:RFC5147String ;
nif:anchorOf "translate"@en;
itsrdf:translate "no" ;
nif:referenceContext <http://example.org/document/1#char=0,17>.
18. ●
@prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .
@prefix vt: <http://www.w3.org/2005/11/its/rdf#> .
// Input NIF document for translation.
<http://example.org/document/en#char=0,55>
a nif:String , nif:Context , nif:RFC5147String ;
nif:isString "My destination is only a 'hop-and-a-skip' from my home."@en;
nif:beginIndex "0"^^xsd:nonNegativeInteger;
nif:endIndex "55"^^xsd:nonNegativeInteger;
itsrdf:translate "yes" .
// NIF document containing the translated content.
<http://example.org/document/de#char=0,57>
a nif:String , nif:Context , nif:RFC5147String ;
nif:anchorOf "Mein Ziel ist nur ein 'Katzen-sprung' von meinem Zuhause."@de;
nif:beginIndex "0"^^xsd:nonNegativeInteger;
nif:endIndex "57"^^xsd:nonNegativeInteger;
// Link between the translated document and the source.
<http://example.org/document/en#char=0,55>
vt:translatedAs <http://example.org/document/de#char=0,57>.
19.
20. ●
●
@prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .
// Input NIF document to be processed.
<http://example.org/document/1#char=0,131>
a nif:String , nif:Context , nif:RFC5147String ;
nif:isString "A computer is a general purpose device that can be programmed to
carry out a set of arithmetic or logical operations automatically."@en;
nif:beginIndex "0"^^xsd:nonNegativeInteger;
nif:endIndex "131"^^xsd:nonNegativeInteger.
// Annotated terminology in NIF.
<http://example.org/document/1#char=2,10>
a nif:String , nif:RFC5147String ;
nif:anchorOf "computer"@en;
itsrdf:termInfoRef <#1431254> ;
itsrdf:term "yes" ;
nif:referenceContext <http://example.org/document/1#char=0,131>.
21.
22. ●
●
@prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .
// The NIF document.
<http://example.org/document/1#char=0,59>
a nif:String , nif:Context , nif:RFC5147String ;
nif:isString "Gringoire, a practical philosopher of the streets of Paris."@en;
nif:beginIndex "0"^^xsd:nonNegativeInteger;
nif:endIndex "59"^^xsd:nonNegativeInteger.
// Annotated entity mention with link to DBpedia resource.
<http://example.org/document/1#char=0,9>
a nif:String , nif:RFC5147String ;
nif:anchorOf "Gringoire"@en;
nif:beginIndex "0"^^xsd:nonNegativeInteger;
nif:endIndex "9"^^xsd:nonNegativeInteger.
itsrdf:taIdentRef <http://dbpedia.org/resource/Pierre_Gringoire> ;
nif:referenceContext <http://example.org/document/1#char=0,59>.
// Visualised NIF: HTML + microdata.
<p><span about="http://dbpedia.org/resource/Pierre_Gringoire" property="schema:name"
>Gringoire</span>, a practical philosopher of the streets of Paris.</p>
23.
24. ●
●
●
// Annotated entity mention with link to a DBpedia resource.
<http://example.org/document/1#char=0,6>
a nif:String , nif:RFC5147String ;
nif:anchorOf "Berlin"@en;
nif:beginIndex "0"^^xsd:nonNegativeInteger;
nif:endIndex "6"^^xsd:nonNegativeInteger;
itsrdf:taIdentRef <http://dbpedia.org/resource/Berlin> .
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
// Entity enriched with geo-coordinates.
<http://example.org/document/1#char=0,6>
a nif:String , nif:RFC5147String ;
nif:anchorOf "Berlin"@en;
nif:beginIndex "0"^^xsd:nonNegativeInteger;
nif:endIndex "6"^^xsd:nonNegativeInteger;
itsrdf:taIdentRef <http://dbpedia.org/resource/Berlin>;
geo:lat "52.516666";
geo:long "13.383333" .
25. ●
●
> POST /e-link/?f=turtle&t=direct HTTP/1.1
> Host: sandbox.freme-project.eu
> Accept: application/rdf+xml
>
> ... data for conversion ...
< HTTP/1.1 200 OK
< Content-Type: application/rdf+xml
<
< ... results converted in rdf/xml ...
26.
27. @prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .
// The NIF context document.
<http://example.org/document/1#char=0,40>
a nif:String, nif:Context, nif:RFC5147String ;
nif:isString "My favourite actress in Natalie Portman."^^xsd:string ;
nif:beginIndex "0"^^xsd:nonNegativeInteger ;
nif:endIndex "40"^^xsd:nonNegativeInteger ;
nif:sourceUrl <http://differentday.blogspot.com/2007_01_01_archive.html> .
// Annotated entity mention with link to a DBpedia resource.
<http://example.org/document/1#char=24,39>
a nif:String, nif:RFC5147String ;
nif:anchorOf "Natalie Portman"@en;
nif:beginIndex "24"^^xsd:nonNegativeInteger;
nif:endIndex "39"^^xsd:nonNegativeInteger;
itsrdf:taIdentRef <http://dbpedia.org/resource/Natalie_Portman> ;
nif:referenceContext <http://example.org/document/1#char=0,40> .
●
●
●
41. ●
> POST /spotlight?f=text&t=direct&confidence=0.3 HTTP/1.1
> Host: spotlight.nlp2rdf.aksw.org
> Accept: */*
>
> This is Germany
< HTTP/1.1 200 OK
< Content-Type: text/turtle
< Location: http://spotlight.nlp2rdf.aksw.org/spotlight/document154
... after some time the client can check the results at the URI in the Location header.
> GET /http://spotlight.nlp2rdf.aksw.org/spotlight/document154 HTTP/1.1
> Host: spotlight.nlp2rdf.aksw.org
> Accept: */*
< HTTP/1.1 200 OK
< Content-Type: text/turtle
<
< ... results in turtle ...
●
●