I'm using SPARQL and I wonder if I can put an sparql inside in clause? To be more specific, I need to get entities(s1,s2) who have specific condition for this sparql query[s1's aggregate value over a field is more than say 5]
select
?s1 ?x ?s2.
WHERE {
{?s1 rdf:type dbpedia-owl:Scientist.}
{?s2 rdf:type dbpedia-owl:Scientist.}
{?s2 dbpedia-owl:field ?x.}
{?s1 dbpedia-owl:field ?x.}
}
so I need to add an extra IN clause like this
SELECT
?s1 ?x ?s2.
WHERE {
{?s1 rdf:type dbpedia-owl:Scientist.}
{?s2 rdf:type dbpedia-owl:Scientist.}
{?s2 dbpedia-owl:field ?x.}
{?s1 dbpedia-owl:field ?x.}
{?s1 IN
{
SELECT ?s1 WHERE {
SELECT ?s1 (COUNT(?p) AS ?prizes) {
?s1 dbpprop:prizes ?p.
} group by (?s1)
}FILTER (?prizes > 2)
}
}
}
But I got error on the sparql query parser..... does anybody know how to fix it?