You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Zhenya Antić <zh...@fastmail.com> on 2020/07/10 15:49:22 UTC

Delete query running on server, not through Python

Hello,

If you could please help with the following. I am running a DELETE query, which works through the Apache Jena Fuseki interface fine:

PREFIX dbo:<http://dbpedia.org/ontology/>
PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX asc:<http://asc.com/ontology/ <http://audiosinc.com/ontology/>>
DELETE DATA
{dbo:wikiPageID:13311 rdf:label asc:Entity:Content}

But when I run it through the Python SPARQLWrapper as follows:

 query = '''PREFIX dbo:<http://dbpedia.org/ontology/>
 PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
 PREFIX asc:<http://asc.com/ontology/ <http://audiosinc.com/ontology/>>
 DELETE DATA 
 { ''' + old_subj + " " + old_rel + " " + old_obj + " }"

I get an error. I tried different variants of the above, but all of them give errors. This particular one gives the following error:

[2020-07-10 11:37:04] Fuseki INFO [81] 400 Encountered "<EOF>" at line 5, column 86.
Was expecting one of:
 "graph" ...
 "}" ...
 ";" ...
 "," ...
 "." ...

Thanks,

__________________________
Zhenya Antić, PhD
Natural Language Processing
https://www.linkedin.com/in/zhenya-antic/

Practical Linguistics Inc
http://www.practicallinguistics.com



Re: Delete query running on server, not through Python

Posted by Zhenya Antić <zh...@fastmail.com>.
Thanks a lot



On Fri, Jul 10, 2020, at 12:08 PM, Andy Seaborne wrote:
> Probably one old_subj / old_rel / old_obj isn't the right format. e.g 
> if old_obj is a string, is it quoted correctly? Does it contain a " and 
> need escaping?
> 
> Printout 'query' to check it got assembled as expected.
> 
> > Encountered "<EOF>" at line 5, column 86.
> 
> The parser expected more characters.
> 
>  Andy
> 
> 
> On 10/07/2020 16:49, Zhenya Antić wrote:
> > Hello,
> > 
> > If you could please help with the following. I am running a DELETE query, which works through the Apache Jena Fuseki interface fine:
> > 
> > PREFIX dbo:<http://dbpedia.org/ontology/>
> > PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> > PREFIX asc:<http://asc.com/ontology/ <http://audiosinc.com/ontology/>>
> > DELETE DATA
> > {dbo:wikiPageID:13311 rdf:label asc:Entity:Content}
> > 
> > But when I run it through the Python SPARQLWrapper as follows:
> > 
> > query = '''PREFIX dbo:<http://dbpedia.org/ontology/>
> > PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> > PREFIX asc:<http://asc.com/ontology/ <http://audiosinc.com/ontology/>>
> 
> That's mangled. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> > DELETE DATA
> > { ''' + old_subj + " " + old_rel + " " + old_obj + " }"
> > 
> > I get an error. I tried different variants of the above, but all of them give errors. This particular one gives the following error:
> > 
> > [2020-07-10 11:37:04] Fuseki INFO [81] 400 Encountered "<EOF>" at line 5, column 86.
> > Was expecting one of:
> > "graph" ...
> > "}" ...
> > ";" ...
> > "," ...
> > "." ...
> > 
> > Thanks,
> > 
> > __________________________
> > Zhenya Antić, PhD
> > Natural Language Processing
> > https://www.linkedin.com/in/zhenya-antic/
> > 
> > Practical Linguistics Inc
> > http://www.practicallinguistics.com
> > 
> > 
> > 
> 

Re: Delete query running on server, not through Python

Posted by Andy Seaborne <an...@apache.org>.
Probably one old_subj / old_rel / old_obj isn't the right format.  e.g 
if old_obj is a string, is it quoted correctly? Does it contain a " and 
need escaping?

Printout 'query' to check it got assembled as expected.

 > Encountered "<EOF>" at line 5, column 86.

The parser expected more characters.

     Andy


On 10/07/2020 16:49, Zhenya Antić wrote:
> Hello,
> 
> If you could please help with the following. I am running a DELETE query, which works through the Apache Jena Fuseki interface fine:
> 
> PREFIX dbo:<http://dbpedia.org/ontology/>
> PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
> PREFIX asc:<http://asc.com/ontology/ <http://audiosinc.com/ontology/>>
> DELETE DATA
> {dbo:wikiPageID:13311 rdf:label asc:Entity:Content}
> 
> But when I run it through the Python SPARQLWrapper as follows:
> 
>   query = '''PREFIX dbo:<http://dbpedia.org/ontology/>
>   PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
>   PREFIX asc:<http://asc.com/ontology/ <http://audiosinc.com/ontology/>>

That's mangled.      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

>   DELETE DATA
>   { ''' + old_subj + " " + old_rel + " " + old_obj + " }"
> 
> I get an error. I tried different variants of the above, but all of them give errors. This particular one gives the following error:
> 
> [2020-07-10 11:37:04] Fuseki INFO [81] 400 Encountered "<EOF>" at line 5, column 86.
> Was expecting one of:
>   "graph" ...
>   "}" ...
>   ";" ...
>   "," ...
>   "." ...
> 
> Thanks,
> 
> __________________________
> Zhenya Antić, PhD
> Natural Language Processing
> https://www.linkedin.com/in/zhenya-antic/
> 
> Practical Linguistics Inc
> http://www.practicallinguistics.com
> 
> 
>