SPARQL results

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

SPARQL results

isukura
Hi,

I have a question concerning results of SPARQL queries.

My code: pastebin.com/71Bwn3mc

When I run this query, I get three results: [6, 12], [6, a.Pizza], [a.has_topping, a.cheese1]

I know that this number 6 is some representation of a "is_a" property which probably has different namespace, and I'm guessing 12 is for "owl:Thing".
If I remember correctly, before the new update instead of these integers were None values.

My question is : how could I avoid these results or at least make them readable?

Thanks in advance!

P.S. The library is amazing.
Reply | Threaded
Open this post in threaded view
|

Re: SPARQL results

Jiba
Administrator
Hi,

You can use default_world._unabbreviate() to translate these integer identifiers into the corresponding IRI, e.g.

>>> print(default_world._unabbreviate(6))
http://www.w3.org/1999/02/22-rdf-syntax-ns#type


By the way, you may be interested by the new SPARQL engine (independent from RDFlib), introduced in version 0.30:

>>> print(list(default_world.sparql(query)))
[[6, 12], [6, a.Pizza], [a.has_topping, a.cheese1]]

Jiba