freme-project / freme-project.github.io

Apache License 2.0
2 stars 0 forks source link

POST /e-link/documents #20

Closed jnehring closed 9 years ago

jnehring commented 9 years ago

You can find a list of available templates in the FREME wiki.

This is an example of a NIF document containing annotated entities that can be processed by e-link:

@prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .

// NIF document for processing - named entity extraction.
<http://example.org/document/1#char=0,21>
    a nif:String , nif:Context , nif:RFC5147String ;
    nif:isString "We talk about Xiamen."^^xsd:string;
    nif:beginIndex "0"^^xsd:nonNegativeInteger;
    nif:endIndex "21"^^xsd:nonNegativeInteger;
    nif:sourceUrl <http://differentday.blogspot.com/2007_01_01_archive.html> .

// Detected entity mention linked with its DBpedia representation and ontology class.
<http://example.org/document/1#char=14,20>
    a nif:String , nif:RFC5147String , nif:Word, nif:Phrase ;
    nif:referenceContext <http://example.org/document/1#char=0,21> ;
    nif:anchorOf "Xiamen"""^^xsd:string ;
    nif:beginIndex "14"^^xsd:nonNegativeInteger ;
    nif:endIndex "20"^^xsd:nonNegativeInteger ;
    itsrdf:taIdentRef  <http://dbpedia.org/resource/Xiamen> .
    itsrdf:taClassRef  <http://dbpedia.org/ontology/City> ;
josauder commented 9 years ago

The last statement of the second template ends in a ";" instead of "." , is that intended?

jnehring commented 9 years ago

The NIF i posted here does not work. Please add this NIF to the documentation

@prefix dc:    <http://purl.org/dc/elements/1.1/> .
@prefix prov:  <http://www.w3.org/ns/prov#> .
@prefix nif:   <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .
@prefix rutp:  <http://rdfunit.aksw.org/data/patterns#> .
@prefix rlog:  <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#> .
@prefix oslc:  <http://open-services.net/ns/core#> .
@prefix dsp:   <http://dublincore.org/dc-dsp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix rutg:  <http://rdfunit.aksw.org/data/generators#> .
@prefix schema: <http://schema.org/> .
@prefix olia:  <http://purl.org/olia/olia.owl#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix p:     <http://127.0.0.1:9995/spotlight#> .
@prefix rut:   <http://rdfunit.aksw.org/ns/core#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix rutr:  <http://rdfunit.aksw.org/data/results#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix spin:  <http://spinrdf.org/spin#> .
@prefix rutt:  <http://rdfunit.aksw.org/data/tests#> .
@prefix ruts:  <http://rdfunit.aksw.org/data/testsuite#> .

<http://127.0.0.1:9995/spotlight#char=5,7>
        a                     nif:Word , nif:RFC5147String ;
        nif:anchorOf          "is" ;
        nif:beginIndex        "5" ;
        nif:endIndex          "7" ;
        nif:nextWord          <http://127.0.0.1:9995/spotlight#char=8,15> ;
        nif:previousWord      <http://127.0.0.1:9995/spotlight#char=0,4> ;
        nif:referenceContext  <http://127.0.0.1:9995/spotlight#char=0,16> ;
        nif:sentence          <http://127.0.0.1:9995/spotlight#char=0,16> .

nif:lastWord  a  owl:ObjectProperty .
nif:previousWord  a  owl:ObjectProperty .

<http://127.0.0.1:9995/spotlight#char=0,4>
        a                     nif:Word , nif:RFC5147String ;
        nif:anchorOf          "This" ;
        nif:beginIndex        "0" ;
        nif:endIndex          "4" ;
        nif:nextWord          <http://127.0.0.1:9995/spotlight#char=5,7> ;
        nif:referenceContext  <http://127.0.0.1:9995/spotlight#char=0,16> ;
        nif:sentence          <http://127.0.0.1:9995/spotlight#char=0,16> ;
        itsrdf:taIdentRef     <http://dbpedia.org/resource/Sathya_Sai_Baba> .

nif:word  a     owl:ObjectProperty .
nif:isString  a  owl:DatatypeProperty .
nif:beginIndex  a  owl:DatatypeProperty .
nif:nextWord  a  owl:ObjectProperty .
nif:sentence  a  owl:ObjectProperty .
nif:anchorOf  a  owl:DatatypeProperty .

<http://127.0.0.1:9995/spotlight#char=0,16>
        a                     nif:Context , nif:Sentence , nif:RFC5147String ;
        nif:anchorOf          "This is Germany." ;
        nif:beginIndex        "0" ;
        nif:endIndex          "16" ;
        nif:firstWord         <http://127.0.0.1:9995/spotlight#char=0,4> ;
        nif:isString          "This is Germany." ;
        nif:lastWord          <http://127.0.0.1:9995/spotlight#char=15,16> ;
        nif:referenceContext  <http://127.0.0.1:9995/spotlight#char=0,16> ;
        nif:word              <http://127.0.0.1:9995/spotlight#char=5,7> , <http://127.0.0.1:9995/spotlight#char=8,15> .

nif:firstWord  a  owl:ObjectProperty .
nif:Context  a  owl:Class .
rlog:message  a  owl:DatatypeProperty .
nif:Sentence  a  owl:Class .
nif:referenceContext  a  owl:ObjectProperty .

<http://127.0.0.1:9995/spotlight#char=15,16>
        a                     nif:Word , nif:RFC5147String ;
        nif:anchorOf          "." ;
        nif:beginIndex        "15" ;
        nif:endIndex          "16" ;
        nif:previousWord      <http://127.0.0.1:9995/spotlight#char=8,15> ;
        nif:referenceContext  <http://127.0.0.1:9995/spotlight#char=0,16> ;
        nif:sentence          <http://127.0.0.1:9995/spotlight#char=0,16> .

nif:endIndex  a  owl:DatatypeProperty .

<http://127.0.0.1:9995/spotlight#char=8,15>
        a                     nif:Word , nif:RFC5147String ;
        nif:anchorOf          "Germany" ;
        nif:beginIndex        "8" ;
        nif:endIndex          "15" ;
        nif:nextWord          <http://127.0.0.1:9995/spotlight#char=15,16> ;
        nif:previousWord      <http://127.0.0.1:9995/spotlight#char=5,7> ;
        nif:referenceContext  <http://127.0.0.1:9995/spotlight#char=0,16> ;
        nif:sentence          <http://127.0.0.1:9995/spotlight#char=0,16> ;
        itsrdf:taIdentRef     <http://dbpedia.org/resource/Germany> .

nif:RFC5147String  a  owl:Class .
nif:Word  a     owl:Class .
jnehring commented 9 years ago

Oh there is a problem with the nif again. please update to this nif:

@prefix dc:    <http://purl.org/dc/elements/1.1/> .
@prefix prov:  <http://www.w3.org/ns/prov#> .
@prefix nif:   <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .
@prefix rutp:  <http://rdfunit.aksw.org/data/patterns#> .
@prefix rlog:  <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/rlog#> .
@prefix oslc:  <http://open-services.net/ns/core#> .
@prefix dsp:   <http://dublincore.org/dc-dsp#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix rutg:  <http://rdfunit.aksw.org/data/generators#> .
@prefix schema: <http://schema.org/> .
@prefix olia:  <http://purl.org/olia/olia.owl#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix p:     <http://127.0.0.1:9995/spotlight#> .
@prefix rut:   <http://rdfunit.aksw.org/ns/core#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix owl:   <http://www.w3.org/2002/07/owl#> .
@prefix rutr:  <http://rdfunit.aksw.org/data/results#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix spin:  <http://spinrdf.org/spin#> .
@prefix rutt:  <http://rdfunit.aksw.org/data/tests#> .
@prefix ruts:  <http://rdfunit.aksw.org/data/testsuite#> .

<http://127.0.0.1:9995/spotlight#char=0,15>
        a                     nif:Context , nif:Sentence , nif:RFC5147String ;
        nif:beginIndex        "0" ;
        nif:endIndex          "15" ;
        nif:isString          "This is Berlin." ;
        nif:referenceContext  <http://127.0.0.1:9995/spotlight#char=0,15> .

<http://127.0.0.1:9995/spotlight#char=8,14>
        a                     nif:Word , nif:RFC5147String ;
        nif:anchorOf          "Berlin" ;
        nif:beginIndex        "8" ;
        nif:endIndex          "14" ;
        nif:referenceContext  <http://127.0.0.1:9995/spotlight#char=0,15> ;
        itsrdf:taIdentRef     <http://dbpedia.org/resource/Berlin> .

also remove "this does not work from api tester" from the description

josauder commented 9 years ago

Fixed with latest commit, mixed up the issue numbers. ec8d49fc7839aac02a2b6261335678a912a7bf01

josauder commented 9 years ago

NIF either doesn't work or is not default NIF-type. Response

{
  "timestamp": 1437667471316,
  "message": "Unknown problem. Please contact us.",
  "error": "Internal Server Error",
  "status": 500,
  "exception": "eu.freme.broker.exception.InternalServerErrorException",
  "path": "/e-link/documents/"
}
jnehring commented 9 years ago

Please test and change the NIF example.