Dear all, I need some help in changing my static SPARQL query to build Incrementally using ARQ. below is my query
1 PREFIX dc: <http://purl.org/dc/terms/> 2 PREFIX db: <http://data.linkedmdb.org/resource/> 3 PREFIX foaf: <http://xmlns.com/foaf/0.1/> 4 PREFIX movie: <http://data.linkedmdb.org/resource/movie/> 5 PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> 6 PREFIX oddlinker: <http://data.linkedmdb.org/resource/oddlinker/> 7 PREFIX d2r: <http://sites.wiwiss.fu-berlin.de/suhl/bizer/d2r-server/config.rdf#> 8 PREFIX xsd: <http://www.w3.org/2001/XMLSchema#> 9 PREFIX owl: <http://www.w3.org/2002/07/owl#> 10 PREFIX map: <file:///C:/d2r-server-0.4/mapping.n3#> 11 PREFIX dbpedia: <http://dbpedia.org/property/> 12 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 13 PREFIX skos: <http://www.w3.org/2004/02/skos/core#> 14 PREFIX fn: <java:facet.> 15 16 SELECT ?fpredicate (count(distinct ?instance) AS ?ficount) (count(distinct ?object) AS ?focount) (fn:weights3(count(distinct ?instance), count(distinct ?object), 85620) AS ?coverage) ?otype 17 WHERE 18 { ?instance rdf:type movie:film . 19 ?instance ?fpredicate ?object 20 FILTER regex(str(?fpredicate), "http://data.linkedmdb.org/resource/", "i") 21 } 22 GROUP BY ?fpredicate (fn:ifuri(?object) AS ?otype) 1 (project (?fpredicate ?ficount ?focount ?coverage ?otype) 2 (extend ((?ficount ?.0) (?focount ?.1) (?coverage (<java:facet.weights3> ?.0 ?.1 85620))) 3 (group (?fpredicate (?otype (<java:facet.ifuri> ?object))) ((?.0 (count distinct ?instance)) (?.1 (count distinct ?object))) 4 (filter (regex (str ?fpredicate) "http://data.linkedmdb.org/resource/" "i") 5 (bgp 6 (triple ?instance <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://data.linkedmdb.org/resource/movie/film>) 7 (triple ?instance ?fpredicate ?object) 8 ))))) </code></pre> I want to build the above query incrementally because, I dynamically add Triples (as constraints) inside bgp. I really appreciate if any of experts here can at least give me rough code. I have seen all the documentation went through the ARQ code of AlgebraGenerator but it did not help me. I am still confused in adding functions to projections grouping by functions. Kindly pardon me it was trivial. I appreciate your help. Regards aj
