freme-project / Broker

FREME Broker
Apache License 2.0
2 stars 0 forks source link

Error while chaining e-Terminology and e-Entity #81

Closed borriellom closed 9 years ago

borriellom commented 9 years ago

When I submit to the e-Entity (DBpedia engine) service a NIF file returned by the e-Terminology service, a NullPointerException occurs.

termAnnotatedNIFFile.ttl

@prefix :      <https://term.tilde.com/terms/> .
@prefix cc:    <http://creativecommons.org/ns#> .
@prefix void:  <http://rdfs.org/ns/void#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .
@prefix its:   <http://www.w3.org/2005/11/its> .
@prefix skos:  <http://www.w3.org/2004/02/skos/core#> .
@prefix nif:   <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tbx:   <http://tbx2rdf.lider-project.eu/tbx#> .
@prefix decomp: <http://www.w3.org/ns/lemon/decomp#> .
@prefix dct:   <http://purl.org/dc/terms/> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#> .
@prefix ldr:   <http://purl.oclc.org/NET/ldr/ns#> .
@prefix dcat:  <http://www.w3.org/ns/dcat#> .
@prefix odrl:  <http://www.w3.org/ns/odrl/2/> .
@prefix prov:  <http://www.w3.org/ns/prov#> .

:E-Day-it  a                   ontolex:LexicalEntry ;
        ontolex:canonicalForm  <https://term.tilde.com/terms/E-Day-it#CanonicalForm> ;
        ontolex:language       <http://www.lexvo.org/page/iso639-3/ita> ;
        ontolex:sense          <https://term.tilde.com/terms/E-Day-it#Sense> .

:E-day-en  a                   ontolex:LexicalEntry ;
        ontolex:canonicalForm  <https://term.tilde.com/terms/E-day-en#CanonicalForm> ;
        ontolex:language       <http://www.lexvo.org/page/iso639-3/eng> ;
        ontolex:sense          <https://term.tilde.com/terms/E-day-en#Sense> .

<https://term.tilde.com/terms/%3F-day-en>
        a                      ontolex:LexicalEntry ;
        ontolex:canonicalForm  <https://term.tilde.com/terms/%3F-day-en#CanonicalForm> ;
        ontolex:language       <http://www.lexvo.org/page/iso639-3/eng> ;
        ontolex:sense          <https://term.tilde.com/terms/%3F-day-en#Sense> .

<http://freme-project.eu/>
        a               nif:Context , nif:RFC5147String , nif:String ;
        nif:beginIndex  "0"^^xsd:nonNegativeInteger ;
        nif:endIndex    "20"^^xsd:nonNegativeInteger ;
        nif:isString    "What a beautiful day"@en .

<https://term.tilde.com/terms/%3F-day-it#Sense>
        ontolex:reference  :2724437 .

<https://term.tilde.com/terms/E-day-it#Sense>
        ontolex:reference  :2724437 .

<http://tbx2rdf.lider-project.eu/data/iate/it>
        a                 ontolex:Lexicon ;
        ontolex:entry     <https://term.tilde.com/terms/%3F-day-it> , :E-Day-it , :E-day-it ;
        ontolex:language  <http://www.lexvo.org/page/iso639-3/ita> .

<https://term.tilde.com/terms/%3F-day-en#Sense>
        ontolex:reference  :2724437 .

<http://freme-project.eu/#char=17,20>
        a                     nif:Context , nif:RFC5147String , nif:String ;
        nif:anchorOf          "day"@en ;
        nif:beginIndex        "17"^^xsd:nonNegativeInteger ;
        nif:endIndex          "20"^^xsd:nonNegativeInteger ;
        nif:referenceContext  <http://freme-project.eu/> ;
        itsrdf:term           "yes" ;
        itsrdf:termInfoRef    :2724437 .

<https://term.tilde.com/terms/E-Day-it#Sense>
        ontolex:reference  :2724437 .

:E-day-it  a                   ontolex:LexicalEntry ;
        ontolex:canonicalForm  <https://term.tilde.com/terms/E-day-it#CanonicalForm> ;
        ontolex:language       <http://www.lexvo.org/page/iso639-3/ita> ;
        ontolex:sense          <https://term.tilde.com/terms/E-day-it#Sense> .

<https://term.tilde.com/terms/E-day-en#CanonicalForm>
        ontolex:writtenRep  "E-day"@en .

<https://term.tilde.com/terms/E-day-en#Sense>
        ontolex:reference  :2724437 .

<https://term.tilde.com/terms/%3F-day-it>
        a                      ontolex:LexicalEntry ;
        ontolex:canonicalForm  <https://term.tilde.com/terms/%3F-day-it#CanonicalForm> ;
        ontolex:language       <http://www.lexvo.org/page/iso639-3/ita> ;
        ontolex:sense          <https://term.tilde.com/terms/%3F-day-it#Sense> .

<https://term.tilde.com/terms/E-day-it#CanonicalForm>
        ontolex:writtenRep  "E-day"@it .

<http://tbx2rdf.lider-project.eu/data/iate/en>
        a                 ontolex:Lexicon ;
        ontolex:entry     <https://term.tilde.com/terms/%3F-day-en> , :E-day-en ;
        ontolex:language  <http://www.lexvo.org/page/iso639-3/eng> .

:       a                 tbx:MartifHeader , dcat:Dataset ;
        <http://purl.org/dc/elements/1.1/source>
                "" ;
        dct:type          "TBX" ;
        tbx:encodingDesc  "<p type=\"XCSURI\">http://www.ttt.org/oscarstandards/tbx/TBXXCS.xcs</p>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns##XMLLiteral> ;
        tbx:sourceDesc    "<sourceDesc><p/></sourceDesc>"^^<http://www.w3.org/1999/02/22-rdf-syntax-ns##XMLLiteral> .

:2724437  a     skos:Concept .

<https://term.tilde.com/terms/%3F-day-en#CanonicalForm>
        ontolex:writtenRep  "?-day"@en .

<https://term.tilde.com/terms/E-Day-it#CanonicalForm>
        ontolex:writtenRep  "E-Day"@it .

<https://term.tilde.com/terms/%3F-day-it#CanonicalForm>
        ontolex:writtenRep  "?-day"@it .

Request to e-Entity service

curl -v -X POST -d @termAnnotatedNIFFile.ttl "http://api-dev.freme-project.eu/current/e-entity/dbpedia-spotlight/documents/
?confidence=0.5" -H "Content-type: text/turtle"

Response from e-Entity

{
  "timestamp": 1440410395816,
  "error": "Internal Server Error",
  "status": 500,
  "exception": "java.lang.NullPointerException",
  "path": "/e-entity/dbpedia-spotlight/documents/"
}
m1ci commented 9 years ago

It fails since the NIF you submit seems to be incorrect in the following part:

<http://freme-project.eu/#char=17,20>
    a                     nif:Context , nif:RFC5147String , nif:String ;
    nif:anchorOf          "day"@en ;
    nif:beginIndex        "17"^^xsd:nonNegativeInteger ;
    nif:endIndex          "20"^^xsd:nonNegativeInteger ;
    nif:referenceContext  <http://freme-project.eu/> ;
    itsrdf:term           "yes" ;
    itsrdf:termInfoRef    :2724437 .

the string "day" is marked as nif:Context, however it does not contain nif:isString information. Actually, e-Entity is processing the text of nif:isString. This causes the issue.

This needs to be fixed in e-Terminology, but I will also fix this NullPointerException in DBpedia spotlight. Thanks for reporting this!

m1ci commented 9 years ago

I reported this issue to e-Entity https://github.com/freme-project/e-Entity/issues/35

borriellom commented 9 years ago

Thanks for the analysis Milan. I assign it to Andis.

m1ci commented 9 years ago

fixed from the e-Entity side, check curl -v -X POST -d @termAnnotatedNIFFile.ttl "http://api-dev.freme-project.eu/current/e-entity/dbpedia-spotlight/documents?confidence=0.2&language=en&informat=turtle" -H "Content-Type:"

borriellom commented 9 years ago

Is it correct that the NIF file returned by the e-Entity service doesn't contain term annotations anymore ? I expected an incremental enrichment of the file.

m1ci commented 9 years ago

good question, yes you are right, this was fixed, now it works as an incremental enrichment.

andish commented 9 years ago

@m1ci do term object really need nif:IsString? term objects are created and extracted from string and now becames as term anotations.

This is original String [from example above]:

<http://freme-project.eu/>
        a               nif:Context , nif:RFC5147String , nif:String ;
        nif:beginIndex  "0"^^xsd:nonNegativeInteger ;
        nif:endIndex    "20"^^xsd:nonNegativeInteger ;
        nif:isString    "What a beautiful day"@en .

and e-terminology is not creating any new string, but is adding anchors or term objects to output.

<http://freme-project.eu/#char=17,20>
        a                     nif:Context , nif:RFC5147String , nif:String ;
        nif:anchorOf          "day"@en ;
        nif:beginIndex        "17"^^xsd:nonNegativeInteger ;
        nif:endIndex          "20"^^xsd:nonNegativeInteger ;
        nif:referenceContext  <http://freme-project.eu/> ;
        itsrdf:term           "yes" ;
        itsrdf:termInfoRef    :2724437 .

Maybe we must not mark the term object as nif:Context, because there is reference nif:referenceContext http://freme-project.eu/ ;

andish commented 9 years ago

@m1ci is category nif:isString needed for term annotations in nif?

m1ci commented 9 years ago

@m1ci is category nif:isString needed for term annotations in nif?

no, nif:String is only required for nif:Context. Terms and other substrings should contain nif:anchor as it is in https://github.com/freme-project/Broker/issues/81#issuecomment-134505665

jnehring commented 9 years ago

The topic of this issue has changed. I created #118 to deal with the bug report here