prefix : prefix rdfs: prefix bdr: prefix apf: # find all resources with duplicate blank nodes select ?r ?diff where { { ?r a :Person . graph ?r { select (count(?id) as ?c) (count(distinct ?id) as ?cd) where { ?r :personName ?b . ?b rdfs:label ?nm . ?b a ?type . bind (lang(?nm) as ?lang) ?id apf:concat (?type "+" ?nm "@" ?lang) . } } } . bind (?c - ?cd as ?diff) filter (?diff != 0) } limit 10 # given a resource, ?R, report the difference of blank nodes and distinct blank nodes select ?diff where { { select (count(?id) as ?c) (count(distinct ?id) as ?cd) where { ?R :personName ?b . ?b rdfs:label ?nm . ?b a ?type . bind (lang(?nm) as ?lang) ?id apf:concat(?type "+" ?nm "@" ?lang) } } . bind (?c - ?cd as ?diff) }