0

I am trying to insert an individual into in ARC 2, without any success for now... I used INSERT INTO ...CONSTRUCT

 $query = 'PREFIX owl: <http://www.w3.org/2002/07/owl#>
 PREFIX untitled-ontology-120:
 <http://www.semanticweb.org/usuario/ontologies/2017/2/untitled-ontology-120>
 INSERT INTO <http://localhost:80/proyecto1/data/mp2.rdf> CONSTRUCT
 {?c rdf:label untitled-ontology-120:Pamplona.}
     WHERE{?c rdf:type owl:NamedIndividual.
}';

Tee errors I receive is

 " executed INSERT, returned:  int(0) Query errorsArray ( [0] => Could not properly handle "PREFIX owl:

When I tried to do it without CONSTRUCT

$query = 'PREFIX owl: <http://www.w3.org/2002/07/owl#>
 PREFIX untitled-ontology-120:
 <http://www.semanticweb.org/usuario/ontologies/2017/2/untitled-ontology-120>
 INSERT INTO <http://localhost:80/proyecto1/data/mp2.rdf> 
 {untitled-ontology-120:Pamplona rdf:type owl:NamedIndividual.
 }';

And I received the response:

executed INSERT, returned: 
array(3) { ["query_type"]=> string(6) "insert" ["result"]=> array(2) 
{ ["t_count"]=> int(1) ["load_time"]=> float(0.0396) } 
["query_time"]=> float(0.047343969345093) }

This response seems to me as if smth has been done, but... there is no anything added to the RDF file with the ontology

Could anybody help me? AKSW!!!! S.O.S.

UninformedUser
  • 8,397
  • 1
  • 14
  • 23
elka
  • 25
  • 3
  • Not sure what you're trying to do, but at least you should use the [documentation](https://www.w3.org/TR/sparql11-update/#insertData) and not building some query that doesn't conform to any syntax. form where do you have `INSERT INTO ... CONSTRUCT ... WHERE ...`? This is SPARQL and not SQL, thus, there is no `INSERT INTO` – UninformedUser May 19 '17 at 10:14
  • The problem is that ARC2 do not support SPARQL 1.1 Update, but SPARQL +. And on the page of ARC2 they give some example which is like this – elka May 19 '17 at 10:19
  • INSERT INTO { <#foo> "baz" . } That is why I tried this construction... – elka May 19 '17 at 10:20
  • Ok, so maybe the parser doesn't consider PREFIX declarations in the beginning and you have to use full URIs? Does this work then? – UninformedUser May 19 '17 at 10:36
  • I tried ' $query = ' INSERT INTO { . }'; ...... echo $query; ..... /* execute the query */ $res = $store->query($query); echo var_dump($store->getErrors()). "ERRORES
    "; echo "executed INSERT, returned: ". "
    "; echo var_dump($res); '
    – elka May 19 '17 at 10:52
  • and the output I received was 'INSERT INTO { . }array(0) { } ERRORES ' 'executed INSERT, returned: ' 'array(3) { ["query_type"]=> string(6) "insert" ["result"]=> array(2) { ["t_count"]=> int(1) ["load_time"]=> float(0.1856) } ["query_time"]=> float(0.19382500648499) }' It does not see the query text, as it seems....maybe is the question of ' " <> etc... symbols – elka May 19 '17 at 10:57
  • I mean echo $query; is INSERT INTO { . } with an empty string inside the {} – elka May 19 '17 at 10:58
  • Why do you always omit the protocol `http` in the URIs? – UninformedUser May 19 '17 at 13:41
  • I don´t know. I use prefix... to simplify the sintaxis. I will try now with http´s!!! – elka May 22 '17 at 07:34
  • The same resullt. The rdf file do not change – elka May 22 '17 at 08:35
  • I guess there are some other library for PHP which do work better that ARC? – elka May 22 '17 at 08:36

0 Answers0