No, as the SPARQL documentation says [1], it simply converts the URI to a String literal which still consists of the URI. You have to use some additional operation(s) [2] based on that String.
The most obvious if you have always the same namespace is to use STRAFTER, e.g. STRAFTER(STR(?subject), uni:) [1] https://www.w3.org/TR/sparql11-query/#func-str [2] https://www.w3.org/TR/sparql11-query/#func-strings > This is my code > > PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> > PREFIX owl: <http://www.w3.org/2002/07/owl#> > PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> > PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> > PREFIX uni: < > http://www.semanticweb.org/admin/ontologies/2017/4/untitled-ontology-19#> > > SELECT DISTINCT (str(?property) as ?label1) (str( > ?subject) as ?label2) (str( ?prop) as ?label3) (str( ?object) as ?label4) > WHERE > { > uni:Product ?property ?subject . > OPTIONAL {?subject ?prop ?object } > { ?property rdf:type owl:ObjectProperty } > {?prop rdf:type owl:ObjectProperty } > > } > My data doesn't have rdfs:label values. Is this the right way to extract > from the URIs? > > > > > On Fri, Jun 2, 2017 at 1:49 PM, Lorenz B. < > [email protected]> wrote: > >> 1. I can't see any image >> 2. what are words in an RDF context? Note, there are RDF graphs, >> triples, resource, literals - but no "word" >> >> As I said, if your data contains rdfs:label values, use them. If not, >> use SPARQL string operations to "extract" something that you want from >> the URIs >>> The image I have attached is the result of my php code. Is there >>> anything that can be done in the query to just display the words >>> without the IRIs? >>> >>> On Fri, Jun 2, 2017 at 1:27 PM, Lorenz B. >>> <[email protected] >>> <mailto:[email protected]>> wrote: >>> >>> Not clear what you want, provide an example please. I don't want >>> to run >>> your PHP code...and I don't have your Fuseki server + your data. >>> >>> Note, RDF resources are identified by URIs, if you want something >>> different, it's your task to do it in the SPARQL query. >>> >>> Either, >>> >>> a) select something like the rdfs:label if exist (this is by the way >>> best pratice to provide a human-readable form) or >>> b) SPARQL String hacks on the URIs, see examples on Stackoverflow >>> >>> Lornez >>> >>> > Hey >>> > >>> > I'm using xampp and fuseki server to run my sparql query on a >>> webpage >>> > and give results. I have attached my php file here. >>> > >>> > I am getting the correct results but I want the output to be >>> like the >>> > way it comes on fuseki server. I want just the words without the >>> IRIs. >>> > >>> > Is there any possible way to do that? >>> >>> -- >>> Lorenz Bühmann >>> AKSW group, University of Leipzig >>> Group: http://aksw.org - semantic web research center >>> >>> >> -- >> Lorenz Bühmann >> AKSW group, University of Leipzig >> Group: http://aksw.org - semantic web research center >> >> -- Lorenz Bühmann AKSW group, University of Leipzig Group: http://aksw.org - semantic web research center
