org.openrdf.query.MalformedQueryException for SparQL insert -


i've read ways on how insert data using sparql. references use insert while other references use insert data. so, i'm confused on how query. goal insert data property coursename class "course" in ontology. here query:

insert{     <http://www.semanticweb.org/rocky/ontologies/2015/3/curriculumontology#course> curr:coursename "it222".             } 

i've tried query , exception appears says:

sparqlreasonerexception: org.openrdf.query.malformedqueryexception: encountered " "insert" "insert "" @ line 9, column 1. expecting 1 of:     "base" ...     "prefix" ...     "select" ...     "construct" ...     "describe" ...     "ask" ... 

is subject of triple wrong? or should need put on subject of triple? , why exception appears? btw, i'm using protege in modeling ontology.

i've read ways on how insert data using sparql. references use insert while other references use insert data.

there's insert data inserting literal data graph, , there's more complicated delete/insert (which requires @ least 1 delete or insert, don't have both), let insert { … } { … }. these defined in standard freely available online; don't have resort secondary sources. standard defines insert data syntax:

insert data quaddata

and delete/insert syntax:

( with iriref )?
( ( deleteclause insertclause? ) | insertclause )
( using ( named )? iriref )*
where groupgraphpattern

deleteclause ::= delete quadpattern
insertclause ::= insert quadpattern

so yours simple syntax error. need insert data, not delete/insert. thus:

insert data {   <http://www.semanticweb.org/rocky/ontologies/2015/3/curriculumontology#course> curr:coursename "it222". } 

you can check syntax sparql.org's update validator.


Popular posts from this blog