freme-project / freme-ner

Apache License 2.0
6 stars 1 forks source link

Problem with informat=turtle #148

Closed jnehring closed 7 years ago

jnehring commented 8 years ago
curl -X POST -H "Cache-Control: no-cache" -H "Postman-Token: 0cb5bf05-610b-fbf0-ed61-0f91bb7bb595" -d '@prefix xsd:   
<http://www.w3.org/2001/XMLSchema#> .
@prefix itsrdf: 
    <http://www.w3.org/2005/11/its/rdf#> .
@prefix nif:   
        <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core/2.0#> .
@prefix dc:    
            <http://purl.org/dc/elements/1.1/> .
            <http://freme-project.eu/#char=0,20>
        a               nif:String , nif:RFC5147String , nif:Context ;
        nif:beginIndex  "0"^^xsd:nonNegativeInteger ;
        nif:endIndex    "20"^^xsd:nonNegativeInteger ;
        nif:isString    "\nWelcome to Berlin!\n"@en ;
        dc:identifier   "1" .
' "http://api-dev.freme-project.eu/current/e-entity/freme-ner/documents?language=de&dataset=dbpedia&informat=turtle"

produces a bad request without further error message. The log file says

ERROR   2016-09-05 15:49:45,600 [http-nio-7001-exec-6] eu.freme.common.exception.ExceptionHandlerService  - Request: http://rv2622.1blu.de:7001/e-entity/freme-ner/documents raised
eu.freme.common.exception.BadRequestException
        at org.elinker.core.rest.FremeNerEnrichment.execute(FremeNerEnrichment.java:211)
...

This causes a problem with e-Internationalization.

ArneBinder commented 7 years ago

The turtle causes problems because of the wrong nif prefix (...nif-core/2.0#>). Try this body content, it works fine:

@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix itsrdf: <http://www.w3.org/2005/11/its/rdf#> .
@prefix nif: <http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
<http://freme-project.eu/#char=0,20>
        a               nif:String , nif:RFC5147String , nif:Context ;
        nif:beginIndex  "0"^^xsd:nonNegativeInteger ;
        nif:endIndex    "20"^^xsd:nonNegativeInteger ;
        nif:isString    "\nWelcome to Berlin!\n"@en ;
        dc:identifier   "1" .
jnehring commented 7 years ago

Still does not work with the turtle you provided.

ArneBinder commented 7 years ago

@jnehring did you use curl? In this case, you have to set a content-type header. Otherwise curl defaults to application/x-www-form-urlencoded. This causes that the freme-ner controller receives the following body content (instead of the submitted turtle):

language=de&dataset=dbpedia&informat=turtle&%40prefix+xsd%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%23%3E+.%0D%0A%40prefix+itsrdf%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2005%2F11%2Fits%2Frdf%23%3E+.%0D%0A%40prefix+nif%3A+%3Chttp%3A%2F%2Fpersistence.uni-leipzig.org%2Fnlp2rdf%2Fontologies%2Fnif-core%23%3E+.%0D%0A%40prefix+dc%3A+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%3E+.%0D%0A%3Chttp%3A%2F%2Ffreme-project.eu%2F%23char=0%2C20%3E%0D%0A++++++++a+++++++++++++++nif%3AString+%2C+nif%3ARFC5147String+%2C+nif%3AContext+%3B%0D%0A++++++++nif%3AbeginIndex++%220%22%5E%5Exsd%3AnonNegativeInteger+%3B%0D%0A++++++++nif%3AendIndex++++%2220%22%5E%5Exsd%3AnonNegativeInteger+%3B%0D%0A++++++++nif%3AisString++++%22%5CnWelcome+to+Berlin%21%5Cn%22%40en+%3B%0D%0A++++++++dc%3Aidentifier+++%221%22+.

I hope this helps.

jnehring commented 7 years ago

Thank you @ArneBinder . I did not specify the content-type header. Using this CURL it works:

curl -X POST --header "Content-Type: text/turtle" -d "@test.ttl" "http://api-dev.freme-project.eu/current/e-entity/freme-ner/documents?language=de&dataset=dbpedia&informat=turtle"

So this issue is solved