Thanks, Rob! What I really need to do is to query by a given rdf:ID string, since I am building an RDF/XML traversing tool. My challenge is how to quickly get all triples whose subject has a given RdfID.
As you know rdf:ID is an RDF/XML artifact and there is no such a triple in the model whose predicate is "ID". How would up come up with a SPARQL query to take a string of the rdf:ID input and return all triples whose subject has the given RdfID? Any help is greatly appreciated!!! - Charles On Sat, Aug 31, 2013 at 12:16 PM, Rob Vesse <[email protected]> wrote: > There's no need to do a FILTER(?s IN sub query) and as you have found out > this is actually illegal SPARQL > > You can however put the sub query in directly and get the desired effect. > SPARQL evaluation is bottom up so the inner query gets evaluated first > > Rob > > > ________________________________________ > From: Charles Li [[email protected]] > Sent: 31 August 2013 09:36 > To: [email protected] > Subject: How to filter SPARQL query with a list > > Hi, all Jena/SPARQL experts! > > I am composing a SPARQL query trying to list all triples whose subjects are > in a list of RdfId's, and this list of RdfId's are from another select > query: > > select ?s ?p ?o > WHERE > { > ?s ?p ?o > FILTER(?s in ( > select distinct ?s WHERE > { > ?s ?p ?o > FILTER(contains(str(?o), > "_{000E9C27-150C-480B-9CC7-E23FFC62C90A}")) > } > ) && > !(contains(str(?o), "_{000E9C27-150C-480B-9CC7-E23FFC62C90A}")) > ) > } > order by ?s > > > However, the SPARQL query is not well-format, and it seems that it > doesn't allow another "select" in place for the list of values. > > Can someone help me and advice how I can put in a list of RdfId's from > another query (lines 6 - 10)? > > > Thanks a lot! > > - Charles >
