SPARQL, use individual name in queries instead of its IRI

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

SPARQL, use individual name in queries instead of its IRI

obada
This post was updated on .
Hi all,

I am trying to write a SPARQL query that gets me all "Operators" that are linked to an individual.
I managed to do that (see below), but with the ugly IRI (OWLNamedIndividual_c2221eeb_9655_4e8a_bfc1_04fe866f5254).

My individual name is "method". How can I use this name in the query instead of the IRI?

PREFIX pre0: <http://www.semanticweb.org/ontologies/2013/6/Ontology1727765367.owl#>
SELECT  ?x
WHERE
  { ?x  pre0:hasOperator  pre0:OWLNamedIndividual_c221eeb_955_4ea_bc1_04fe86f5254 }
Reply | Threaded
Open this post in threaded view
|

Re: SPARQL, use individual name in queries instead of its IRI

Alan Ruttenberg-2



On Sat, Sep 6, 2014 at 5:05 AM, obada <[hidden email]> wrote:
Hi all,

I am trying to write a SPARQL query that gets me all "Operators" that are
linked to an individual.
I managed to do that (see below), but with the ugly IRI
(OWLNamedIndividual_c2221eeb_9655_4e8a_bfc1_04fe866f5254).

My individual name is "method". How can I use this name in the query instead
of the IRI?

I often do the following:

PREFIX pre0:
<http://www.semanticweb.org/ontologies/2013/6/Ontology1727765367.owl#>
SELECT  ?z
WHERE
  { method: pre0:hasOperator  ?z .
  }

This isolates all the ugly URIs in a section of the PREFIXes, and lets you have the query look presentable.

-Alan
 



--
View this message in context: http://protege-project.136.n4.nabble.com/SPARQL-use-individual-name-in-queries-instead-of-its-IRI-tp4661414.html
Sent from the Protege User mailing list archive at Nabble.com.
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user



_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: SPARQL, use individual name in queries instead of its IRI

obada
isn't there a way to completely get rid of the IRIs?
Reply | Threaded
Open this post in threaded view
|

Re: SPARQL, use individual name in queries instead of its IRI

Lorenz Buehmann
No. Resources are identified by IRIs, that's the truth.
You could on the other hand extend your query and ask for the resource
by providing its rdfs:label for instances.

Something like

SELECT ?s WHERE {
     ?s ?p ?o.
     ?s rdfs:label "theLabelOfTheResource".
}

But of course, this makes queries more complex and relies on given
unique labels.

Lorenz
On 07.09.2014 11:19, obada wrote:

> isn't there a way to completely get rid of the IRIs?
>
>
>
> --
> View this message in context: http://protege-project.136.n4.nabble.com/SPARQL-use-individual-name-in-queries-instead-of-its-IRI-tp4661414p4661416.html
> Sent from the Protege User mailing list archive at Nabble.com.
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user
>
>

_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user