-- Name Mapping Rules for RDF Views -- Cleanup re. physical graphs SPARQL CLEAR GRAPH ; SPARQL CLEAR GRAPH ; SPARQL CLEAR GRAPH ; SPARQL CLEAR GRAPH ; SPARQL CLEAR GRAPH ; SPARQL CLEAR GRAPH ; SPARQL CLEAR GRAPH ; SPARQL CLEAR GRAPH ; SPARQL CLEAR GRAPH ; -- Control Test 1: RDF View confirmation Test SPARQL SELECT count(*) AS ?count sample(?s) AS ?sample ?o FROM FROM FROM # FROM FROM FROM FROM FROM FROM FROM WHERE {?s a ?o} GROUP BY ?o ; -- Control Test 2 SPARQL SELECT DISTINCT ?this foaf:name ?name WHERE { { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } # UNION # { GRAPH # { # ?this ?name . # } # } } ; -- Cleanup old Rules SPARQL CLEAR GRAPH ; SPARQL DROP SPIN LIBRARY ; TTLP (' @prefix owl: . @prefix sp: . @prefix spl: . @prefix spin: . @prefix rdf: . @prefix rdfs: . @prefix xsd: . @prefix foaf: . @prefix rel: . @prefix wdrs: . @prefix schema: . @prefix ecrm: . @prefix Oracle: . foaf:Agent a rdfs:Class ; rdfs:label "Agents (Person, Organization, or Bot)"^^xsd:string ; spin:rule [ a sp:Construct, spin:Rule ; rdfs:label "Label Aesthetics Rule" ; rdfs:comment """Dynamically generated relations that inform Faceted Browser about Labels for URIS aesthetics""" ; sp:text """ CONSTRUCT { ?this foaf:name ?name . } WHERE { { SELECT DISTINCT ?this ?name WHERE { { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } UNION { GRAPH { ?this ?name . } } # UNION # { GRAPH # { # ?this ?name . # } # } } } } """ ]. ','', 'urn:data:virtualization:demo:labels:spin:rules:1', 4096 ) ; -- Generate EXEC ('SPARQL ' || SPARQL_SPIN_GRAPH_TO_DEFSPIN('urn:data:virtualization:demo:labels:spin:rules:1')); -- Test Query 1 -- Graph scoping is used to negate fact that by default virtual graphs aren't in scope of /sparql queries SPARQL DEFINE input:macro-lib SELECT DISTINCT ?s ?name WHERE { GRAPH ?g {?s a foaf:Agent } GRAPH ?g2 { ?s foaf:name ?name . } } ; -- Test Query 2 SPARQL DEFINE input:macro-lib SELECT DISTINCT ?s ?name WHERE { GRAPH ?g {?s a foaf:Agent; foaf:name ?name . } } ; -- Test Query 3 -- This query include both inferred and existing triples that satisfy condition SPARQL DEFINE input:macro-lib SELECT DISTINCT SAMPLE(?s) count(1) as ?count ?o WHERE { graph ?g { ?s a foaf:Agent; a ?o } } GROUP BY ?o -- Test Query 3 (workaround) DEFINE input:macro-lib SELECT DISTINCT IRI(max(str(?s))) count(1) as ?count ?o WHERE { graph ?g { ?s a foaf:Agent; a ?o } } GROUP BY ?o