You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Laurent Rucquoy <la...@telemis.com> on 2017/05/15 11:48:20 UTC
SPARQL to check if a specific URI exists
Hello,
I want to write a SPARQL query to attest the existence of a specific URI in
a TDB.
Is the following query the right way to do this (considering notably the
execution performances with big volumes) ?
ASK WHERE {
<my-specific-URI> ?p ?o .
}
Thank you in advance for your help,
Laurent
Re: SPARQL to check if a specific URI exists
Posted by Martynas Jusevičius <ma...@graphity.org>.
If you want to handle both triples (default graph) and quads (named
graphs), you should use a UNION:
ASK WHERE {
{ <my-specific-URI> ?p ?o } UNION { GRAPH ?g { <my-specific-URI> ?p ?o } }
}
On Mon, May 15, 2017 at 1:48 PM, Laurent Rucquoy
<la...@telemis.com> wrote:
> Hello,
>
> I want to write a SPARQL query to attest the existence of a specific URI in
> a TDB.
>
> Is the following query the right way to do this (considering notably the
> execution performances with big volumes) ?
>
> ASK WHERE {
> <my-specific-URI> ?p ?o .
> }
>
> Thank you in advance for your help,
>
> Laurent
Re: SPARQL to check if a specific URI exists
Posted by Laurent Rucquoy <la...@telemis.com>.
Thank you for these clarifications.
Laurent
On 16 May 2017 at 07:58, Lorenz B. <bu...@informatik.uni-leipzig.de>
wrote:
> It depends on the definition of "existence" in an RDF graph. What if the
> URI resp. resource only occurs in the object position of a triple? Then
> you'd need something like this:
>
> ASK WHERE {
> {<my-specific-URI> ?p ?o . }
> UNION
> {?s ?p <my-specific-URI> . }
> }
> > Hello,
> >
> > I want to write a SPARQL query to attest the existence of a specific URI
> in
> > a TDB.
> >
> > Is the following query the right way to do this (considering notably the
> > execution performances with big volumes) ?
> >
> > ASK WHERE {
> > <my-specific-URI> ?p ?o .
> > }
> >
> > Thank you in advance for your help,
> >
> > Laurent
> >
> --
> Lorenz Bühmann
> AKSW group, University of Leipzig
> Group: http://aksw.org - semantic web research center
>
>
Re: SPARQL to check if a specific URI exists
Posted by "Lorenz B." <bu...@informatik.uni-leipzig.de>.
It depends on the definition of "existence" in an RDF graph. What if the
URI resp. resource only occurs in the object position of a triple? Then
you'd need something like this:
ASK WHERE {
{<my-specific-URI> ?p ?o . }
UNION
{?s ?p <my-specific-URI> . }
}
> Hello,
>
> I want to write a SPARQL query to attest the existence of a specific URI in
> a TDB.
>
> Is the following query the right way to do this (considering notably the
> execution performances with big volumes) ?
>
> ASK WHERE {
> <my-specific-URI> ?p ?o .
> }
>
> Thank you in advance for your help,
>
> Laurent
>
--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center