I have a column of URIs from different domains. Example,
http://comicmeta.org/cbo/category
http://purl.org/dc/terms/hasVersion
http://schema.org/contributor
and so on. I want to extract the last part, i.e, the string after the last slash '/' on each such URI.
Expected results on the above list of URIs:
category
hasVersion
contributor
How do I write a generic SPARQL query to extract this last part from any given URI?
This is what I have tried so far:
SELECT distinct ?s ?x WHERE {
?s ?p ?o .
BIND (STRBEFORE(STRAFTER(STR(?s),"/"), " ") as ?x) .
#To extract the part after the slash '/' and before the end of string indicated by a space ' '.
}
But, this only returns empty strings "".
How can I make this work? Can someone help me with this?