Fuseki SPARQL INSERT produces the “Error 400: SPAR

2019-01-20 15:44发布

问题:

I try to insert an individual into my ontology, but get the error:

Error 400: SPARQL Query: No 'query=' parameter

Fuseki - version 2.4.1 (Build date: 2016-11-04T18:59:20+0000)

This is my SPARQL INSERT query #1:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 
PREFIX oo:  <http://www.test.com/test-ontology.owl#> 

INSERT { 
  oo:cap_123 rdf:type oo:MyTours .  
  oo:cap_123 oo:active true . 
  oo:cap_123 oo:title 'Text text text' . 
} 
WHERE { 
  FILTER NOT EXISTS { oo:cap_123 rdf:type oo:MyTours . 
  } 
} 

And this is my INSERT query #2:

INSERT DATA {
  oo:cap_123 rdf:type oo:MyTours .
  oo:cap_123 oo:active true .
  oo:cap_123 oo:title 'Text text text' .
}

If I insert the individual using Protégé, then it works and saves the result as follows:

<owl:NamedIndividual rdf:about="http://www.test.com/test-ontology.owl#cap_123">
    <rdf:type rdf:resource="http://www.test.com/test-ontology.owl#MyTours"/>
    <active rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</active>
    <title>Text text text</title>
</owl:NamedIndividual>

Both queries fail. What is wrong with them?

回答1:

What is your SPARQL endpoint address? It should end with /update (instead of /query):


Available services are listed on http://example.com/dataset.html?tab=info&ds=/<dataset_name>:

  • Configuration file is %FUSEKI_HOME%/run/configuration/<dataset_name>.ttl
  • Access might be restricted in %FUSEKI_HOME%/run/shiro.ini