freme-project / e-Link

Apache License 2.0
0 stars 0 forks source link

Created template having an empty ID #14

Closed borriellom closed 9 years ago

borriellom commented 9 years ago

I was able to create a template with templateId="". Now the new created template can be neither retrieved nor deleted.

Request POST http://api-dev.freme-project.eu/current/e-link/templates/ Header: Content-Type = “text/turtle", Accept= “text/turtle"

Input Template

<http://www.freme-project.eu/data/templates/mytemplate>
        a                 freme:Template ;
        freme:endpoint    "http://dbpedia.org/sparql" ;
        freme:query       "PREFIX dbpedia: <http://dbpedia.org/resource/>\nPREFIX dbpedia-owl: <http://dbpedia.org/ontology/>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>\nCONSTRUCT {\n  ?museum <http://xmlns.com/foaf/0.1/based_near> <@@@entity_uri@@@> .\n}\nWHERE {\n  <@@@entity_uri@@@> geo:geometry ?citygeo .\n  ?museum rdf:type <http://schema.org/Museum> .\n  ?museum geo:geometry ?museumgeo .\n  FILTER (<bif:st_intersects>(?museumgeo, ?citygeo, 10))\n} LIMIT 10" ;
        freme:templateId  "" .

Response Response code 200

Output Template

<http://www.freme-project.eu/data/templates/>
        a                 freme:Template ;
        freme:endpoint    "http://dbpedia.org/sparql" ;
        freme:query       "PREFIX dbpedia: <http://dbpedia.org/resource/>\nPREFIX dbpedia-owl: <http://dbpedia.org/ontology/>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>\nCONSTRUCT {\n  ?museum <http://xmlns.com/foaf/0.1/based_near> <@@@entity_uri@@@> .\n}\nWHERE {\n  <@@@entity_uri@@@> geo:geometry ?citygeo .\n  ?museum rdf:type <http://schema.org/Museum> .\n  ?museum geo:geometry ?museumgeo .\n  FILTER (<bif:st_intersects>(?museumgeo, ?citygeo, 10))\n} LIMIT 10" ;
        freme:templateId  "" .
m1ci commented 9 years ago

the ID should not be specified when submitting data for template generation. @cirola2000: can we implement that we just ignore the specified ID? @jnehring: can you please manually remove this template from the template store document? Thanks!

jnehring commented 9 years ago

I removed the template without ID from the template store on freme-dev

m1ci commented 9 years ago

fixed, now when submitting template for creation ID should not be specified. If an ID is specified, it will be ignored.

You can check with the following data and cURL command:

@prefix freme:   <http://www.freme-project.eu/ns#> .

<http://www.freme-project.eu/data/templates/mytemplate>
    a                 freme:Template ;
    freme:endpoint    "http://dbpedia.org/sparql" ;
    freme:query       "PREFIX dbpedia: <http://dbpedia.org/resource/>\nPREFIX dbpedia-owl: <http://dbpedia.org/ontology/>\nPREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\nPREFIX geo: <http://www.w3.org/2003/01/geo/wgs84_pos#>\nCONSTRUCT {\n  ?museum <http://xmlns.com/foaf/0.1/based_near> <@@@entity_uri@@@> .\n}\nWHERE {\n  <@@@entity_uri@@@> geo:geometry ?citygeo .\n  ?museum rdf:type <http://schema.org/Museum> .\n  ?museum geo:geometry ?museumgeo .\n  FILTER (<bif:st_intersects>(?museumgeo, ?citygeo, 10))\n} LIMIT 10" .

curl -v -X POST -d @marta-template.ttl "http://api-dev.freme-project.eu/current/e-link/templates/?informat=turtle" -H "Content-Type:" -H "Accept: application/json"

BTW, the turtle you shared is invalid: 1) the freme prefix is not defined 2) the freme prefix should be @prefix freme: <http://www.freme-project.eu/ns#> .

Please check and close the issue if everything is OK.