SPARQL queries and IRI usage

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

SPARQL queries and IRI usage

isukura
Hi,

My ontology has objects with different base IRIs. Is there a way to write SPARQL queries so that prefix is not used so much?

For example:

query = "PREFIX onto: <..> SELECT ?p ?o WHERE {onto:Apple ?p ?o. }"

What if Apple doesn't have the onto prefix, but instead some other?
I'm also wondering if there's a nice way to list all base IRIs inside the .owl file?

Thank you!
Reply | Threaded
Open this post in threaded view
|

Re: SPARQL queries and IRI usage

Jiba
Administrator
Hi,

You can define several prefixes if needed, e.g.:

query = "PREFIX onto: <..> PREFIX onto2: <..> SELECT ?o WHERE {onto:Apple onto2:prop ?o. }"

You may also not use prefix at all, but full IRI, e.g.:

query = "SELECT ?p ?o WHERE {<http://test.org/onto.owl#Apple> ?p ?o. }"

Jiba