malformed sparql delete query

1.1k Views Asked by At

I would like to update a data property assertion using sparql, but I get the malformed query exception at the delete statement when I try to run this in Protege. I'm very new to sparql and I can't figure out what's wrong with this query :

PREFIX m: <http://www.semanticweb.org/exemple#>
    DELETE  { ?o owl:minQualifiedCardinality ?min. }
    INSERT { ?o owl:minQualifiedCardinality “2000”^^xsd:decimal. }
    WHERE { 
        m:Revenu rdfs:subClassOf ?o.
        ?o owl:minQualifiedCardinality ?min.
    }
2

There are 2 best solutions below

5
On

Have a look at sparql.org's update validator. When I paste your query there, and after adding the missing prefixes, I get:

Lexical error at line 10, column 45. Encountered: "\u201c" (8220), after : ""

If you look closely, you'll notice that you're using "smart quotes" (i.e., “ and ”) rather than "straight quotes" (i.e., "). If you're not using one, you may want a plain text editor for composing your queries.

1
On

rdfs:, owl: and xsd: aren't defined prefixes.

Fixing that and the quotes, the update parses at sparql.org's update validator.

Note: the validator prints out the line number of the first error.