freme-project / e-Link

Apache License 2.0
0 stars 0 forks source link

Template 7 does not work #39

Closed jnehring closed 8 years ago

jnehring commented 9 years ago

This API call

curl -X POST --header "Content-Type: text/n3" --header "Accept: text/n3" -d " @prefix dc:     .
 @prefix prov:   .
 @prefix nif:    .
 @prefix itsrdf:  .
 @prefix rutp:   .
 @prefix rlog:   .
 @prefix oslc:   .
 @prefix dsp:    .
 @prefix dcterms:  .
 @prefix rutg:   .
 @prefix schema:  .
 @prefix olia:   .
 @prefix rdfs:   .
 @prefix p:      .
 @prefix rut:    .
 @prefix xsd:    .
 @prefix owl:    .
 @prefix rutr:   .
 @prefix rdf:    .
 @prefix spin:   .
 @prefix rutt:   .
 @prefix ruts:   .

 a                     nif:Context , nif:Sentence , nif:RFC5147String ;
 nif:beginIndex        \"0\" ;
 nif:endIndex          \"15\" ;
 nif:isString          \"This is Berlin.\" ;
 nif:referenceContext   .

 a                     nif:Word , nif:RFC5147String ;
 nif:anchorOf          \"Berlin\" ;
 nif:beginIndex        \"8\" ;
 nif:endIndex          \"14\" ;
 nif:referenceContext   ;
 itsrdf:taIdentRef      .
" "http://api-dev.freme-project.eu/current/e-link/documents/?informat=turtle&outformat=turtle&templateid=7"

Produces this response

{
  "timestamp": 1442390413498,
  "message": "It seems your SPARQL template is not correctly defined.",
  "error": "Bad Request",
  "status": 400,
  "exception": "eu.freme.eservices.elink.exceptions.BadRequestException",
  "path": "/e-link/documents/"
}
m1ci commented 8 years ago

Thanks for reporting.

Here is the template which we discuss:

PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX ogc: <http://www.opengis.net/ont/geosparql#>
PREFIX geom: <http://geovocab.org/geometry#>
PREFIX lgdo: <http://linkedgeodata.org/ontology/>
PREFIX bif: <http://www.openlinksw.com/schemas/bif#>

CONSTRUCT {
  ?s <http://xmlns.com/foaf/0.1/based_near> <@@@entity_uri@@@> .
} WHERE {
  ?s
  a lgdo:Bakery ;
  geom:geometry [ ogc:asWKT ?sg ] .
  ?a
  owl:sameAs <@@@entity_uri@@@>
  geom:geometry [ ogc:asWKT ?ag ] .
  FILTER(bif:st_intersects(?sg, ?ag, 10))
} LIMIT 10 

There are two issues with this template: 1) the Linked Geo Data (LGD) does not contain links (sameAS) to DBpedia - not necessary to have them, but difficult to expect that a FREME user will provide entities with links to LGD. 2) however, even if it contains LGD links, there is bug when using the function bif:st_intersects See [1] and the bug reported here https://github.com/openlink/virtuoso-opensource/issues/394

Regarding 1) - I'll contact the LGD maintainers and ask them if they can include the sameAs linkset in the official LGD endpoint. Regarding 2) - Also, I'll try to contact the LGD maintainers and check the bug. Maybe an update to the latest Virtuoso version will help.

[1] http://linkedgeodata.org/sparql?default-graph-uri=http%3A%2F%2Flinkedgeodata.org&query=PREFIX+owl%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23%3E%0D%0APREFIX+ogc%3A+%3Chttp%3A%2F%2Fwww.opengis.net%2Font%2Fgeosparql%23%3E%0D%0APREFIX+geom%3A+%3Chttp%3A%2F%2Fgeovocab.org%2Fgeometry%23%3E%0D%0APREFIX+lgdo%3A+%3Chttp%3A%2F%2Flinkedgeodata.org%2Fontology%2F%3E%0D%0A%0D%0ACONSTRUCT+%7B%0D%0A++%3Fs+%3Chttp%3A%2F%2Fxmlns.com%2Ffoaf%2F0.1%2Fbased_near%3E+%3Chttp%3A%2F%2Flinkedgeodata.org%2Ftriplify%2Fnode1000596734%3E+.%0D%0A%7D+WHERE+%7B%0D%0A++%3Fs%0D%0A++a+lgdo%3AHotel+%3B%0D%0A++geom%3Ageometry+%5B+ogc%3AasWKT+%3Fsg+%5D+.%0D%0A++%3Chttp%3A%2F%2Flinkedgeodata.org%2Ftriplify%2Fnode1000596734%3E%0D%0A++geom%3Ageometry+%5B+ogc%3AasWKT+%3Fag+%5D+.%0D%0A++FILTER%28bif%3Ast_intersects%28%3Fsg%2C+%3Fag%2C+5%29%29%0D%0A%7D+LIMIT+10+&format=text%2Fturtle&timeout=0&debug=on

jnehring commented 8 years ago

Thanks for looking into this. Any response from LGD maintainers?

m1ci commented 8 years ago

they wrote that they will try reloading the data with Virtuoso 7.2.1 and hopefully it will solve the issues.

m1ci commented 8 years ago

just received message from the LGD maintainers: 1) they are creating new dump with latest data for LGD 2) they will load the dump in latest version of Virtuoso where the bug causing problems should be solved 3) As the full dump is very large, it may take a few days until this is finished.

jnehring commented 8 years ago

Ok so how do we proceed? I propose to

1) Hope that the problem is fixed until the release 2) When it is not fixed until next thursday then we will delete the template and try to add it again in one month

@m1ci does this sound good to you?

m1ci commented 8 years ago

I agree.

m1ci commented 8 years ago

fixed. Try it at http://api-dev.freme-project.eu/doc/tutorials/getting-started-with-e-link.html#step-1-enrich with template ID 7

jnehring commented 8 years ago

works. thank you