You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rdfli...@googlegroups.com
Hi,
I am trying to run a sparql query through rdlfib. I just want my query to return the class/subclass name without the URI. Is there any built-in function in rdflib that does that? I just want to scrap away the URI part. I know I can always use a regex but was wondering if there is anything in the library that helps me do that without having to do regex?
Let me know if you didn't get what I am saying. I can post the code if you need me to.
Thanks,
Uthej
Gunnar Aastrand Grimnes
unread,
Apr 26, 2015, 3:40:40 AM4/26/15
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
(if you want to get fancy you can expose that function as a custom
sparql function in rdflib, you wont have to post-process your query
results)
Note that if you consume data you do not have complete control over,
there is no-one forcing anyone to have sensible local-names for their
URIs, they are not really for human consumption, and some will just a
random identifier (Freebase data, i'm looking at you...)
A safer solution is to do an extra triple pattern for the rdfs:label
of whatever you're querying for.
You do not have permission to delete messages in this group
Copy link
Report message
Sign in to report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to rdfli...@googlegroups.com, vsj...@gmail.com
Thanks Gunnar, Appreciate the help. But here is the thing. I can't seem to understand the approach you are suggesting with the rdfs:Label tag. Here is the query that I am trying to run against the owl file:
Now weirdly enough this query in Protege returns just the label names without the URI. But somehow rdflib doesn't do that. The only difference I see is that in protege query engine I have to define the prefix but since I am parsing the xml from a local path in my code and my xml already has alfred ns defined, I don't have to do it here. Any which way how do you suggest I change this query to get only the labels?