-- Non DBpedia specific -- paths between TimBL and kidehen SELECT ?link ?g ?step ?path WHERE { { SELECT ?s ?o ?g WHERE { graph ?g {?s foaf:knows ?o } } } OPTION (TRANSITIVE, t_distinct, t_in(?s), t_out(?o), t_no_cycles, T_shortest_only, t_step (?s) as ?link, t_step ('path_id') as ?path, t_step ('step_no') as ?step, t_direction 3) . FILTER (?s= && ?o = ) } LIMIT 20 -- x degrees of TimBL SELECT ?o ?dist ((SELECT COUNT (*) WHERE {?o foaf:knows ?xx})) WHERE { { SELECT ?s ?o WHERE { ?s foaf:knows ?o } } OPTION (TRANSITIVE, t_distinct, t_in(?s), t_out(?o), t_min (1), t_max (4), t_step ('step_no') as ?dist) . FILTER (?s= ) } ORDER BY ?dist DESC 3 LIMIT 500 -- join across two named graphs for subject with IRI: , either side of -- an owl:sameAs relation -- transitivty level 1 -- start with ?x -- end with ?alias SELECT ?g ?x count (*) as ?count WHERE { {SELECT ?x ?alias ?g WHERE { {GRAPH ?g {?x owl:sameAs ?alias }} UNION {GRAPH ?g {?alias owl:sameAs ?x}} } } OPTION (TRANSITIVE, t_in (?x), t_out (?alias), t_distinct, t_min (1)) . FILTER (?x = ) . } -- all subjects with IRI: , that are sub-classes of -- anything (hence ?y) without restrictions on tree levels SELECT ?y FROM WHERE { { SELECT * WHERE { ?x rdfs:subClassOf ?y . } } OPTION (TRANSITIVE, t_distinct, t_in (?x), t_out (?y) ) . FILTER (?x = ) } --- SELECT * WHERE { { dbpedia-owl:Actor rdfs:subClassOf ?superClass OPTION (transitive, t_min(0)) } { ?property rdfs:domain ?superClass } } --- all sub categories of protestant church SPARQL DEFINE input:inference "skos-trans" PREFIX p: PREFIX dbpedia: PREFIX category: PREFIX rdfs: PREFIX skos: PREFIX geo: SELECT DISTINCT ?m ?n ?p ?d WHERE { ?m rdfs:label ?n. ?m skos:subject ?c. ?c skos:broaderTransitive category:Churches_in_Paris OPTION (TRANSITIVE) . ?m p:abstract ?d. ?m geo:point ?p FILTER ( lang(?n) = "fr" ) FILTER ( lang(?d) = "fr" ) } --- max 3 sub-categories of protestant church DEFINE input:inference "skos-trans" PREFIX p: PREFIX dbpedia: PREFIX category: PREFIX rdfs: PREFIX skos: PREFIX geo: SELECT DISTINCT ?c AS ?skos_broader ?trans AS ?skos_narrower ?dist AS ?skos_level ?m ?n ?p AS ?geo_point WHERE { { SELECT ?c ?m ?n ?p ?trans ?dist WHERE { ?m rdfs:label ?n. ?m skos:subject ?c. ?c skos:broaderTransitive category:Protestant_churches . ?c skos:broaderTransitive ?trans OPTION ( TRANSITIVE, t_distinct, t_in (?c), t_out (?trans), t_max (3), t_step ( 'step_no' ) as ?dist ) . ?m p:abstract ?d. ?m geo:point ?p FILTER ( lang(?n) = "en" ) FILTER ( lang(?d) = "en" ) } } FILTER ( ?trans = ) } ORDER BY ASC (?dist)