- From: Andy Seaborne <andy.seaborne@epimorphics.com>
- Date: Fri, 12 Aug 2011 17:55:59 +0100
- To: semantic-web@w3.org
On 12/08/11 17:36, Jitao Yang wrote: > Dear all, > > suppose we have DATA: > > @prefix foaf: <http://xmlns.com/foaf/0.1/> . > > _:a foaf:name "Johnny Lee Outlaw" . > _:a foaf:mbox <mailto:jlow@example.com <mailto:jlow@example.com>> . > _:b foaf:name "Peter Goodguy" . > _:b foaf:mbox <mailto:peter@example.org <mailto:peter@example.org>> . > _:c foaf:mbox <mailto:carol@example.org <mailto:carol@example.org>> . > > > can we write a SPARQL query like: > > PREFIX foaf: <http://xmlns.com/foaf/0.1/> > SELECT *?property* > > WHERE{ > ?x foaf:*?property* "Peter Goodguy". > } > > if we can not, can we write an equivalent SPARQL query? Namely, can we > decompose schema and Class(or Property) in SPARQL query? > > Thanks, > Jitao SPARQL 1.1: PREFIX foaf: <http://xmlns.com/foaf/0.1/> SELECT ( substr( str(?p), strlen(str(foaf:))+1 ) AS ?property) WHERE{ ?x ?p "Peter Goodguy". } In SPARQL 1.0, you can't return anything not already in the graph : in SPARQL 1.1 you can do some manipulation of RDF terms. Because SUBSTR is fn:substring, indexes are 1-based. Andy
Received on Friday, 12 August 2011 16:56:29 UTC