You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by 朱曼 <zh...@gmail.com> on 2011/07/09 01:06:27 UTC
Problem of querying dbpedia endpoint
Dear list,
hi~~
I encounter "HttpException: java.net.SocketException: Connection reset:
java.net.SocketException: Connection reset" exception when I run the
following code, could you help me?
try {
Model dbpedia_model = ModelFactory.createDefaultModel();
String queryStr = "SELECT distinct ?c WHERE { ?c a owl:Class }";
Query query = QueryFactory.create(queryStr);
query.addGraphURI("http://dbpedia.org/");
QueryExecution qexec = QueryExecutionFactory.sparqlService("
http://dbpedia.org/sparql", query);
ResultSet rs = qexec.execSelect();
ResultSetFormatter.out(System.out, rs, query);
qexec.close();
} catch (Exception e) {
e.printStackTrace();
}
all the best
June
Re: Fuseki model output
Posted by Andy Seaborne <an...@epimorphics.com>.
On 12/07/11 10:04, Camel Christophe wrote:
> Ok.
> Is it possible to create (or use) a specific mimetype for this :
>
> application/rdf+xml -> RDF/XML writer
> application/rdf-abbrev+xml -> RDF/XML-ABBREV writer
>
> I am aware that is out of the norm, but this would make it configurable.
>
> Chris
It's possible to change the code to do this.
Or always use RDF/XML-ABBREV.
See ResponseModel and the call to FusekiLib.chooseWriter.
It should also be possible to configure for different Trutle setups but
it's not at the moment.
Andy
>
> -----Message d'origine-----
> De : Andy Seaborne [mailto:andy.seaborne@epimorphics.com]
> Envoyé : mardi 12 juillet 2011 10:00
> À : jena-users@incubator.apache.org
> Objet : Re: Fuseki model output
>
>
>
> On 12/07/11 08:50, Camel Christophe wrote:
>> Hello again,
>>
>> Sorry to bother you with that, but I'd like to know if Fuseki can return
>> a DESCRIBE response serialized with "RDF/XML-ABBREV" writer ?
>> I suspect not.
>
> Not normally. It can be changed if there is enough requests.
>
> RDF/XML-ABBREV is reasonably expensive to produce.
>
> Andy
>
>>
>> Thanks.
>>
>> Chris
>
>
> Cliquez sur l'url suivante
> https://www.mailcontrol.com/sr/a0E9S6qpIE!TndxI!oX7Uoa1VnJPWXo6owgB7ywIzsBQsehOxFks5A4wn9!b7GnTPMXYuhe2l0DQE4zD1Sgchg==
> si ce message est indésirable (pourriel).
RE: Fuseki model output
Posted by Camel Christophe <cc...@cls.fr>.
Ok.
Is it possible to create (or use) a specific mimetype for this :
application/rdf+xml -> RDF/XML writer
application/rdf-abbrev+xml -> RDF/XML-ABBREV writer
I am aware that is out of the norm, but this would make it configurable.
Chris
-----Message d'origine-----
De : Andy Seaborne [mailto:andy.seaborne@epimorphics.com]
Envoyé : mardi 12 juillet 2011 10:00
À : jena-users@incubator.apache.org
Objet : Re: Fuseki model output
On 12/07/11 08:50, Camel Christophe wrote:
> Hello again,
>
> Sorry to bother you with that, but I'd like to know if Fuseki can return
> a DESCRIBE response serialized with "RDF/XML-ABBREV" writer ?
> I suspect not.
Not normally. It can be changed if there is enough requests.
RDF/XML-ABBREV is reasonably expensive to produce.
Andy
>
> Thanks.
>
> Chris
Cliquez sur l'url suivante
https://www.mailcontrol.com/sr/a0E9S6qpIE!TndxI!oX7Uoa1VnJPWXo6owgB7ywIzsBQsehOxFks5A4wn9!b7GnTPMXYuhe2l0DQE4zD1Sgchg==
si ce message est indésirable (pourriel).
Re: Fuseki model output
Posted by Andy Seaborne <an...@epimorphics.com>.
On 12/07/11 08:50, Camel Christophe wrote:
> Hello again,
>
> Sorry to bother you with that, but I'd like to know if Fuseki can return
> a DESCRIBE response serialized with "RDF/XML-ABBREV" writer ?
> I suspect not.
Not normally. It can be changed if there is enough requests.
RDF/XML-ABBREV is reasonably expensive to produce.
Andy
>
> Thanks.
>
> Chris
Fuseki model output
Posted by Camel Christophe <cc...@cls.fr>.
Hello again,
Sorry to bother you with that, but I'd like to know if Fuseki can return
a DESCRIBE response serialized with "RDF/XML-ABBREV" writer ?
I suspect not.
Thanks.
Chris
Re: How delete works on Fuseki
Posted by Andy Seaborne <an...@epimorphics.com>.
On 11/07/11 10:52, Olivier Rossel wrote:
> BTW, would it be complicated to display the number of triples
> affected by the query, in the log message?
Not impossible but not easy. The update processors calculates the
triples to be deleted but it does not know if they are deleted or didn't
exist.
The code is around:
UpdateEngineWorker.execDelete
It would have to be logged - SPARQL Update does not a result except
success/failure and one request may be many operations.
Andy
Re: How delete works on Fuseki
Posted by Olivier Rossel <ol...@gmail.com>.
BTW, would it be complicated to display the number of triples
affected by the query, in the log message?
On Mon, Jul 11, 2011 at 11:43 AM, Olivier Rossel
<ol...@gmail.com> wrote:
> At http://www.w3.org/Submission/SPARQL-Update/#sec_examples , example (b) says:
>
> DELETE DATA FROM <http://example/bookStore>
> { <http://example/book3> dc:title "Fundamentals of Compiler Desing" }
>
> It should work too. Does it?
>
> On Mon, Jul 11, 2011 at 11:34 AM, Rob Vesse <ra...@ecs.soton.ac.uk> wrote:
>> Hi Camel
>>
>> Yes the DELETE is formulated incorrectly, you have specified things to be deleted but not said explicitly where to delete them from. So though it is matching your triples in a specific graph it tries to delete them from the default graph which is not where they are located so they aren't actually deleted.
>>
>> Try the following instead:
>>
>> WITH <http://test>
>> DELETE
>> {
>> ?s ?p ?v
>> }
>> WHERE
>> {
>> ?s ?p ?v .
>> <http://a/resource/> ?p ?v .
>> }
>>
>> The WITH should set the graph to be used both for the DELETE and the WHERE clause. If that doesn't work (or you need to match from one graph but delete in another) you can state the GRAPH explicitly in both clauses:
>>
>> DELETE
>> {
>> GRAPH <http://text> {
>> ?s ?p ?v
>> }
>> }
>> WHERE
>> {
>> GRAPH <http://test> {
>> ?s ?p ?v .
>> http://a/resource/> ?p ?v .
>> }
>> }
>>
>> Hope that helps,
>>
>> Rob Vesse
>>
>>
>>> -----Original Message-----
>>> From: Camel Christophe [mailto:ccamel@cls.fr]
>>> Sent: 11 July 2011 10:21
>>> To: jena-users@incubator.apache.org
>>> Subject: How delete works on Fuseki
>>>
>>> Hello everybody !
>>>
>>> I want to make the removal of a resource in the Fuseki triple store.
>>>
>>> For example, the resource has been inserted like this (into a named
>>> graph) :
>>>
>>> INSERT DATA INTO <http://test> {
>>> <http://a/resource/> <http://a/property> "a first value" .
>>> <http://a/resource/> <http://a/property> "a second value" .
>>> }
>>>
>>> I can easily see its triples like this :
>>>
>>> select * where {
>>> graph <http://test> {
>>> ?s ?p ?v .
>>> <http://a/resource/> ?p ?v .
>>> }
>>> }
>>>
>>> Ok, now I want to delete those triples from the store (i.e. I want to
>>> delete the resource). I do the following:
>>>
>>> DELETE
>>> { ?s ?p ?v }
>>> WHERE
>>> {
>>> graph <http://test> {
>>> ?s ?p ?v .
>>> <http://a/resource/> ?p ?v .
>>> }
>>> }
>>>
>>>
>>> Fuseki answers "Update succeeded". Good, but the triples haven't been
>>> deleted. The previous select request still returns the following
>>> content :
>>>
>>> <http://a/resource/> <http://a/property> "a first value"
>>> <http://a/resource/> <http://a/property> "a second value"
>>>
>>>
>>> What's going wrong ? I suspect a bad formulation of the delete query,
>>> yet it seems to me correct.
>>>
>>> Thanks !
>>
>>
>
Re: How delete works on Fuseki
Posted by Olivier Rossel <ol...@gmail.com>.
At http://www.w3.org/Submission/SPARQL-Update/#sec_examples , example (b) says:
DELETE DATA FROM <http://example/bookStore>
{ <http://example/book3> dc:title "Fundamentals of Compiler Desing" }
It should work too. Does it?
On Mon, Jul 11, 2011 at 11:34 AM, Rob Vesse <ra...@ecs.soton.ac.uk> wrote:
> Hi Camel
>
> Yes the DELETE is formulated incorrectly, you have specified things to be deleted but not said explicitly where to delete them from. So though it is matching your triples in a specific graph it tries to delete them from the default graph which is not where they are located so they aren't actually deleted.
>
> Try the following instead:
>
> WITH <http://test>
> DELETE
> {
> ?s ?p ?v
> }
> WHERE
> {
> ?s ?p ?v .
> <http://a/resource/> ?p ?v .
> }
>
> The WITH should set the graph to be used both for the DELETE and the WHERE clause. If that doesn't work (or you need to match from one graph but delete in another) you can state the GRAPH explicitly in both clauses:
>
> DELETE
> {
> GRAPH <http://text> {
> ?s ?p ?v
> }
> }
> WHERE
> {
> GRAPH <http://test> {
> ?s ?p ?v .
> http://a/resource/> ?p ?v .
> }
> }
>
> Hope that helps,
>
> Rob Vesse
>
>
>> -----Original Message-----
>> From: Camel Christophe [mailto:ccamel@cls.fr]
>> Sent: 11 July 2011 10:21
>> To: jena-users@incubator.apache.org
>> Subject: How delete works on Fuseki
>>
>> Hello everybody !
>>
>> I want to make the removal of a resource in the Fuseki triple store.
>>
>> For example, the resource has been inserted like this (into a named
>> graph) :
>>
>> INSERT DATA INTO <http://test> {
>> <http://a/resource/> <http://a/property> "a first value" .
>> <http://a/resource/> <http://a/property> "a second value" .
>> }
>>
>> I can easily see its triples like this :
>>
>> select * where {
>> graph <http://test> {
>> ?s ?p ?v .
>> <http://a/resource/> ?p ?v .
>> }
>> }
>>
>> Ok, now I want to delete those triples from the store (i.e. I want to
>> delete the resource). I do the following:
>>
>> DELETE
>> { ?s ?p ?v }
>> WHERE
>> {
>> graph <http://test> {
>> ?s ?p ?v .
>> <http://a/resource/> ?p ?v .
>> }
>> }
>>
>>
>> Fuseki answers "Update succeeded". Good, but the triples haven't been
>> deleted. The previous select request still returns the following
>> content :
>>
>> <http://a/resource/> <http://a/property> "a first value"
>> <http://a/resource/> <http://a/property> "a second value"
>>
>>
>> What's going wrong ? I suspect a bad formulation of the delete query,
>> yet it seems to me correct.
>>
>> Thanks !
>
>
Re: How delete works on Fuseki
Posted by Andy Seaborne <an...@epimorphics.com>.
DELETE WHERE {
GRAPH <http://test> {
?x <http://a/property> "a first value" , "a second value" .
?x ?p ?v .
} }
Andy
On 12/07/11 08:50, Camel Christophe wrote:
> Mmm, well, in fact it works well but not as I would like. I think the delete request is still not well expressed.
>
> Look. If I insert two resources, with the same shared properties, like this :
>
> INSERT DATA INTO<http://test> {
> <http://a/resourceA/> <http://a/property> "a first value" .
> <http://a/resourceA/> <http://a/property> "a second value" .
> }
>
>
> INSERT DATA INTO<http://test> {
> <http://a/resourceB/> <http://a/property> "a first value" .
> <http://a/resourceB/> <http://a/property> "a second value" .
> }
>
> Then the following delete sparql request :
>
> WITH<http://test>
> DELETE
> {
> ?s ?p ?v
> }
> WHERE
> {
> ?s ?p ?v .
> <http://a/resourceA/> ?p ?v .
> }
>
> deletes these two resources. On reflection, it seems normal.
>
> So what is the easiest way to express the deletion of a resource in sparql?
>
> For now, I delete the triples explicitly after having obtained through a 'DESCRIBE' query.
>
> -----Message d'origine-----
> De : Camel Christophe [mailto:ccamel@cls.fr]
> Envoyé : lundi 11 juillet 2011 17:21
> À : jena-users@incubator.apache.org
> Objet : RE: How delete works on Fuseki
>
> Great !!!
> The "WITH" request works very well !
>
> Thanks very much.
>
> -----Message d'origine-----
> De : Rob Vesse [mailto:rav08r@ecs.soton.ac.uk]
> Envoyé : lundi 11 juillet 2011 11:35
> À : jena-users@incubator.apache.org
> Objet : RE: How delete works on Fuseki
>
> Hi Camel
>
> Yes the DELETE is formulated incorrectly, you have specified things to be deleted but not said explicitly where to delete them from. So though it is matching your triples in a specific graph it tries to delete them from the default graph which is not where they are located so they aren't actually deleted.
>
> Try the following instead:
>
> WITH<http://test>
> DELETE
> {
> ?s ?p ?v
> }
> WHERE
> {
> ?s ?p ?v .
> <http://a/resource/> ?p ?v .
> }
>
> The WITH should set the graph to be used both for the DELETE and the WHERE clause. If that doesn't work (or you need to match from one graph but delete in another) you can state the GRAPH explicitly in both clauses:
>
> DELETE
> {
> GRAPH<http://text> {
> ?s ?p ?v
> }
> }
> WHERE
> {
> GRAPH<http://test> {
> ?s ?p ?v .
> http://a/resource/> ?p ?v .
> }
> }
>
> Hope that helps,
>
> Rob Vesse
>
>
>
> Cliquez sur l'url suivante
> https://www.mailcontrol.com/sr/I8H+ScyOqqfTndxI!oX7UguoYhQx!y1acMyL2!cHGMYjUwYO36QqOZRq1IpHlMfVMJZsw5Wz4VZeTFI5G433hQ==
> si ce message est indésirable (pourriel).
RE: How delete works on Fuseki
Posted by Camel Christophe <cc...@cls.fr>.
Mmm, well, in fact it works well but not as I would like. I think the delete request is still not well expressed.
Look. If I insert two resources, with the same shared properties, like this :
INSERT DATA INTO <http://test> {
<http://a/resourceA/> <http://a/property> "a first value" .
<http://a/resourceA/> <http://a/property> "a second value" .
}
INSERT DATA INTO <http://test> {
<http://a/resourceB/> <http://a/property> "a first value" .
<http://a/resourceB/> <http://a/property> "a second value" .
}
Then the following delete sparql request :
WITH <http://test>
DELETE
{
?s ?p ?v
}
WHERE
{
?s ?p ?v .
<http://a/resourceA/> ?p ?v .
}
deletes these two resources. On reflection, it seems normal.
So what is the easiest way to express the deletion of a resource in sparql?
For now, I delete the triples explicitly after having obtained through a 'DESCRIBE' query.
-----Message d'origine-----
De : Camel Christophe [mailto:ccamel@cls.fr]
Envoyé : lundi 11 juillet 2011 17:21
À : jena-users@incubator.apache.org
Objet : RE: How delete works on Fuseki
Great !!!
The "WITH" request works very well !
Thanks very much.
-----Message d'origine-----
De : Rob Vesse [mailto:rav08r@ecs.soton.ac.uk]
Envoyé : lundi 11 juillet 2011 11:35
À : jena-users@incubator.apache.org
Objet : RE: How delete works on Fuseki
Hi Camel
Yes the DELETE is formulated incorrectly, you have specified things to be deleted but not said explicitly where to delete them from. So though it is matching your triples in a specific graph it tries to delete them from the default graph which is not where they are located so they aren't actually deleted.
Try the following instead:
WITH <http://test>
DELETE
{
?s ?p ?v
}
WHERE
{
?s ?p ?v .
<http://a/resource/> ?p ?v .
}
The WITH should set the graph to be used both for the DELETE and the WHERE clause. If that doesn't work (or you need to match from one graph but delete in another) you can state the GRAPH explicitly in both clauses:
DELETE
{
GRAPH <http://text> {
?s ?p ?v
}
}
WHERE
{
GRAPH <http://test> {
?s ?p ?v .
http://a/resource/> ?p ?v .
}
}
Hope that helps,
Rob Vesse
Cliquez sur l'url suivante
https://www.mailcontrol.com/sr/I8H+ScyOqqfTndxI!oX7UguoYhQx!y1acMyL2!cHGMYjUwYO36QqOZRq1IpHlMfVMJZsw5Wz4VZeTFI5G433hQ==
si ce message est indésirable (pourriel).
RE: How delete works on Fuseki
Posted by Camel Christophe <cc...@cls.fr>.
Great !!!
The "WITH" request works very well !
Thanks very much.
-----Message d'origine-----
De : Rob Vesse [mailto:rav08r@ecs.soton.ac.uk]
Envoyé : lundi 11 juillet 2011 11:35
À : jena-users@incubator.apache.org
Objet : RE: How delete works on Fuseki
Hi Camel
Yes the DELETE is formulated incorrectly, you have specified things to be deleted but not said explicitly where to delete them from. So though it is matching your triples in a specific graph it tries to delete them from the default graph which is not where they are located so they aren't actually deleted.
Try the following instead:
WITH <http://test>
DELETE
{
?s ?p ?v
}
WHERE
{
?s ?p ?v .
<http://a/resource/> ?p ?v .
}
The WITH should set the graph to be used both for the DELETE and the WHERE clause. If that doesn't work (or you need to match from one graph but delete in another) you can state the GRAPH explicitly in both clauses:
DELETE
{
GRAPH <http://text> {
?s ?p ?v
}
}
WHERE
{
GRAPH <http://test> {
?s ?p ?v .
http://a/resource/> ?p ?v .
}
}
Hope that helps,
Rob Vesse
RE: How delete works on Fuseki
Posted by Camel Christophe <cc...@cls.fr>.
Thanks Andy. Nice to know. I'm not quite up to date of the standard. :)
For now, for large imports, I use the fuseki "upload" endpoint, which is far faster.
Christophe
-----Message d'origine-----
De : Andy Seaborne [mailto:andy.seaborne@epimorphics.com]
Envoyé : lundi 11 juillet 2011 21:59
À : jena-users@incubator.apache.org
Objet : Re: How delete works on Fuseki
Also:
INSERT DATA INTO<http://test>
is old-style syntax (not SPARQL 1.1)
It should be:
INSERT DATA { GRAPH <http://test> { ... } }
Try at:
http://www.sparql.org/update-validator.html
Andy
Re: How delete works on Fuseki
Posted by Andy Seaborne <an...@epimorphics.com>.
Also:
INSERT DATA INTO<http://test>
is old-style syntax (not SPARQL 1.1)
It should be:
INSERT DATA { GRAPH <http://test> { ... } }
Try at:
http://www.sparql.org/update-validator.html
Andy
On 11/07/11 10:34, Rob Vesse wrote:
> Hi Camel
>
> Yes the DELETE is formulated incorrectly, you have specified things to be deleted but not said explicitly where to delete them from. So though it is matching your triples in a specific graph it tries to delete them from the default graph which is not where they are located so they aren't actually deleted.
>
> Try the following instead:
>
> WITH<http://test>
> DELETE
> {
> ?s ?p ?v
> }
> WHERE
> {
> ?s ?p ?v .
> <http://a/resource/> ?p ?v .
> }
>
> The WITH should set the graph to be used both for the DELETE and the WHERE clause. If that doesn't work (or you need to match from one graph but delete in another) you can state the GRAPH explicitly in both clauses:
>
> DELETE
> {
> GRAPH<http://text> {
> ?s ?p ?v
> }
> }
> WHERE
> {
> GRAPH<http://test> {
> ?s ?p ?v .
> http://a/resource/> ?p ?v .
> }
> }
>
> Hope that helps,
>
> Rob Vesse
>
>
>> -----Original Message-----
>> From: Camel Christophe [mailto:ccamel@cls.fr]
>> Sent: 11 July 2011 10:21
>> To: jena-users@incubator.apache.org
>> Subject: How delete works on Fuseki
>>
>> Hello everybody !
>>
>> I want to make the removal of a resource in the Fuseki triple store.
>>
>> For example, the resource has been inserted like this (into a named
>> graph) :
>>
>> INSERT DATA INTO<http://test> {
>> <http://a/resource/> <http://a/property> "a first value" .
>> <http://a/resource/> <http://a/property> "a second value" .
>> }
>>
>> I can easily see its triples like this :
>>
>> select * where {
>> graph<http://test> {
>> ?s ?p ?v .
>> <http://a/resource/> ?p ?v .
>> }
>> }
>>
>> Ok, now I want to delete those triples from the store (i.e. I want to
>> delete the resource). I do the following:
>>
>> DELETE
>> { ?s ?p ?v }
>> WHERE
>> {
>> graph<http://test> {
>> ?s ?p ?v .
>> <http://a/resource/> ?p ?v .
>> }
>> }
>>
>>
>> Fuseki answers "Update succeeded". Good, but the triples haven't been
>> deleted. The previous select request still returns the following
>> content :
>>
>> <http://a/resource/> <http://a/property> "a first value"
>> <http://a/resource/> <http://a/property> "a second value"
>>
>>
>> What's going wrong ? I suspect a bad formulation of the delete query,
>> yet it seems to me correct.
>>
>> Thanks !
>
RE: How delete works on Fuseki
Posted by Rob Vesse <ra...@ecs.soton.ac.uk>.
Hi Camel
Yes the DELETE is formulated incorrectly, you have specified things to be deleted but not said explicitly where to delete them from. So though it is matching your triples in a specific graph it tries to delete them from the default graph which is not where they are located so they aren't actually deleted.
Try the following instead:
WITH <http://test>
DELETE
{
?s ?p ?v
}
WHERE
{
?s ?p ?v .
<http://a/resource/> ?p ?v .
}
The WITH should set the graph to be used both for the DELETE and the WHERE clause. If that doesn't work (or you need to match from one graph but delete in another) you can state the GRAPH explicitly in both clauses:
DELETE
{
GRAPH <http://text> {
?s ?p ?v
}
}
WHERE
{
GRAPH <http://test> {
?s ?p ?v .
http://a/resource/> ?p ?v .
}
}
Hope that helps,
Rob Vesse
> -----Original Message-----
> From: Camel Christophe [mailto:ccamel@cls.fr]
> Sent: 11 July 2011 10:21
> To: jena-users@incubator.apache.org
> Subject: How delete works on Fuseki
>
> Hello everybody !
>
> I want to make the removal of a resource in the Fuseki triple store.
>
> For example, the resource has been inserted like this (into a named
> graph) :
>
> INSERT DATA INTO <http://test> {
> <http://a/resource/> <http://a/property> "a first value" .
> <http://a/resource/> <http://a/property> "a second value" .
> }
>
> I can easily see its triples like this :
>
> select * where {
> graph <http://test> {
> ?s ?p ?v .
> <http://a/resource/> ?p ?v .
> }
> }
>
> Ok, now I want to delete those triples from the store (i.e. I want to
> delete the resource). I do the following:
>
> DELETE
> { ?s ?p ?v }
> WHERE
> {
> graph <http://test> {
> ?s ?p ?v .
> <http://a/resource/> ?p ?v .
> }
> }
>
>
> Fuseki answers "Update succeeded". Good, but the triples haven't been
> deleted. The previous select request still returns the following
> content :
>
> <http://a/resource/> <http://a/property> "a first value"
> <http://a/resource/> <http://a/property> "a second value"
>
>
> What's going wrong ? I suspect a bad formulation of the delete query,
> yet it seems to me correct.
>
> Thanks !
How delete works on Fuseki
Posted by Camel Christophe <cc...@cls.fr>.
Hello everybody !
I want to make the removal of a resource in the Fuseki triple store.
For example, the resource has been inserted like this (into a named graph) :
INSERT DATA INTO <http://test> {
<http://a/resource/> <http://a/property> "a first value" .
<http://a/resource/> <http://a/property> "a second value" .
}
I can easily see its triples like this :
select * where {
graph <http://test> {
?s ?p ?v .
<http://a/resource/> ?p ?v .
}
}
Ok, now I want to delete those triples from the store (i.e. I want to delete the resource). I do the following:
DELETE
{ ?s ?p ?v }
WHERE
{
graph <http://test> {
?s ?p ?v .
<http://a/resource/> ?p ?v .
}
}
Fuseki answers "Update succeeded". Good, but the triples haven't been deleted. The previous select request still returns the following content :
<http://a/resource/> <http://a/property> "a first value"
<http://a/resource/> <http://a/property> "a second value"
What's going wrong ? I suspect a bad formulation of the delete query, yet it seems to me correct.
Thanks !
Re: Problem of querying dbpedia endpoint
Posted by 朱曼 <mz...@seu.edu.cn>.
Thanks to Andy and AI,
I added timeout parameter to queryexecution, and it works now~
I ran the query on the webpage http://dbpedia.org/sparql without prefix, it
worked, so I thought maybe it can be omitted, thanks for reminding me~~
All the best
June
2011/7/10 Andy Seaborne <an...@epimorphics.com>
>
>
> On 09/07/11 00:06, 朱曼 wrote:
>
>> Dear list,
>>
>> hi~~
>>
>> I encounter "HttpException: java.net.SocketException: Connection reset:
>> java.net.SocketException: Connection reset" exception when I run the
>> following code, could you help me?
>>
>
> Usually a timeout at DBpedia.
>
>
>
>> try {
>> Model dbpedia_model = ModelFactory.**createDefaultModel();
>> String queryStr = "SELECT distinct ?c WHERE { ?c a owl:Class
>> }";
>> Query query = QueryFactory.create(queryStr);
>>
>
> This is not the code you are running - that would lead to a parse error at
> this point. owl: is not defined.
>
>
> query.addGraphURI("http://**dbpedia.org/<http://dbpedia.org/>
>> ");
>>
>
> This is the same as adding FROM to the query. You do not use it for
> DBpedia. Remove this.
>
>
> QueryExecution qexec = QueryExecutionFactory.**
>> sparqlService("
>> http://dbpedia.org/sparql", query);
>> ResultSet rs = qexec.execSelect();
>> ResultSetFormatter.out(System.**out, rs, query);
>> qexec.close();
>> } catch (Exception e) {
>> e.printStackTrace();
>> }
>>
>> all the best
>>
>> June
>>
>>
> Works for me:
>
>
> try {
> Model dbpedia_model = ModelFactory.**createDefaultModel();
> String queryStr = "select distinct ?Concept where {[] a ?Concept} LIMIT
> 10";
>
> Query query = QueryFactory.create(queryStr);
> QueryExecution qexec = QueryExecutionFactory.**sparqlService("
> http://dbpedia.**org/sparql <http://dbpedia.org/sparql>", query);
> // Set the DBpedia specific timeout.
> ((QueryEngineHTTP)qexec).**addParam("timeout", "10000") ;
>
> ResultSet rs = qexec.execSelect();
> ResultSetFormatter.out(System.**out, rs, query);
> qexec.close();
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> Andy
>
>
Re: Problem of querying dbpedia endpoint
Posted by Andy Seaborne <an...@epimorphics.com>.
On 09/07/11 00:06, 朱曼 wrote:
> Dear list,
>
> hi~~
>
> I encounter "HttpException: java.net.SocketException: Connection reset:
> java.net.SocketException: Connection reset" exception when I run the
> following code, could you help me?
Usually a timeout at DBpedia.
>
> try {
> Model dbpedia_model = ModelFactory.createDefaultModel();
> String queryStr = "SELECT distinct ?c WHERE { ?c a owl:Class }";
> Query query = QueryFactory.create(queryStr);
This is not the code you are running - that would lead to a parse error
at this point. owl: is not defined.
> query.addGraphURI("http://dbpedia.org/");
This is the same as adding FROM to the query. You do not use it for
DBpedia. Remove this.
> QueryExecution qexec = QueryExecutionFactory.sparqlService("
> http://dbpedia.org/sparql", query);
> ResultSet rs = qexec.execSelect();
> ResultSetFormatter.out(System.out, rs, query);
> qexec.close();
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> all the best
>
> June
>
Works for me:
try {
Model dbpedia_model = ModelFactory.createDefaultModel();
String queryStr = "select distinct ?Concept where {[] a ?Concept}
LIMIT 10";
Query query = QueryFactory.create(queryStr);
QueryExecution qexec =
QueryExecutionFactory.sparqlService("http://dbpedia.org/sparql", query);
// Set the DBpedia specific timeout.
((QueryEngineHTTP)qexec).addParam("timeout", "10000") ;
ResultSet rs = qexec.execSelect();
ResultSetFormatter.out(System.out, rs, query);
qexec.close();
} catch (Exception e) {
e.printStackTrace();
}
Andy
Re: Problem of querying dbpedia endpoint
Posted by Al Baker <aj...@gmail.com>.
Your SPARQL query needs to declare the prefix for OWL:
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT distinct ?c ?p WHERE { ?c a owl:Class } LIMIT 10
Also for this query you don't need the "addGraphURI" or the Model since you
are using QueryExecutionFactory.sparqlService
See here for some commentary on it:
http://linkedjava.blogspot.com/2011/06/two-ways-to-query-linked-data-with-arq.html
Here is a gist with this query working:
https://gist.github.com/1073737
Al
On Fri, Jul 8, 2011 at 7:06 PM, 朱曼 <zh...@gmail.com> wrote:
> Dear list,
>
> hi~~
>
> I encounter "HttpException: java.net.SocketException: Connection reset:
> java.net.SocketException: Connection reset" exception when I run the
> following code, could you help me?
>
> try {
> Model dbpedia_model = ModelFactory.createDefaultModel();
> String queryStr = "SELECT distinct ?c WHERE { ?c a owl:Class }";
> Query query = QueryFactory.create(queryStr);
> query.addGraphURI("http://dbpedia.org/");
> QueryExecution qexec = QueryExecutionFactory.sparqlService("
> http://dbpedia.org/sparql", query);
> ResultSet rs = qexec.execSelect();
> ResultSetFormatter.out(System.out, rs, query);
> qexec.close();
> } catch (Exception e) {
> e.printStackTrace();
> }
>
> all the best
>
> June
>