PREFIX rdf: PREFIX rdfs: PREFIX owl: PREFIX bibo: PREFIX dct: PREFIX foaf: PREFIX rpubl: CONSTRUCT { ?s ?p ?o . ?current ?curr_p ?curr_o . ?relitem ?relprop ?relobj . ?reldoc rpubl:paragraf ?relitem . ?relchapter rpubl:paragraf ?relitem . ?reldoc rpubl:kapitel ?relchapter . ?reldoc a ?reldoctype; dct:identifier ?reldoc_label . ?revdoc a ?revdoctype; dct:identifier ?revdoc_id . ?revitem a ?revtype; dct:publisher ?revpublisher; ?rev ?current; ?revprop ?revtext . ?revrevitem a ?revrevtype; ?revrev ?revitem; ?revrevprop ?revrevtext . ?revdoc rpubl:paragraf ?revitem . ?revchapter rpubl:paragraf ?revitem . ?revdoc rpubl:kapitel ?revchapter . ?inrefitem a rpubl:Forfattningsreferens; rpubl:angerGrundforfattning ?current; ?refprop ?reftext . ?revdoc ?refRev ?inrefitem . ?revdoc rpubl:kapitel ?revchapter . ?revchapter rpubl:paragraf ?revpara . ?revdoc rpubl:paragraf ?revpara . ?revpara ?paraRefRev ?inrefitem . } WHERE { # NOTE: if support for sameAs of documents is needed, this will work # (provided that all occurrences of ?current in the construct above this # and the query below this are replaced with ?actual). #OPTIONAL { ?actual owl:sameAs ?current } #FILTER(BOUND(?actual) || ?actual = ?current) { ?g foaf:primaryTopic ?current . GRAPH ?g { ?s ?p ?o } } UNION { ?current ?curr_p ?curr_o . } UNION { ?current ?rel ?relitem . ?relitem ?relprop ?relobj . FILTER(?relprop in (rdf:type, dct:publisher) || isLiteral(?relobj)) # IMPROVE: generalize... # NOTE: this part is a bit slow: OPTIONAL { { ?reldoc rpubl:paragraf ?relitem . } UNION { ?relchapter rpubl:paragraf ?relitem . ?reldoc rpubl:kapitel ?relchapter . # TODO: currect construct for this #} UNION { # ?relitem a rpubl:Forfattningsreferens; # rpubl:angerGrundforfattning ?reldoc . } ?reldoc a ?reldoctype; dct:identifier ?reldoc_label . } } UNION { # Skip if ?current is of a ?type known to have lots of revs ?current a ?type . FILTER NOT EXISTS { ?type rdfs:subClassOf* ?basetype . FILTER(?basetype in (foaf:Organization, bibo:Collection)) } ?revitem ?rev ?current . { ?revitem ?revprop ?revtext . FILTER(isLiteral(?revtext)) OPTIONAL { ?revitem a ?revtype . } OPTIONAL { ?revitem dct:publisher ?revpublisher . } } UNION { ?revrevitem ?revrev ?revitem; ?revrevprop ?revrevtext . FILTER (?revrev = rpubl:referatAvDomstolsavgorande && isLiteral(?revrevtext) ) OPTIONAL { ?revrevitem a ?revrevtype . } } # IMPROVE: generalize to follow any revitems upward to "containers" and # describe those. # NOTE: this part is a bit slow: OPTIONAL { { ?revdoc rpubl:paragraf ?revitem . } UNION { ?revchapter rpubl:paragraf ?revitem . ?revdoc rpubl:kapitel ?revchapter . } ?revdoc a ?revdoctype; dct:identifier ?revdoc_label . } } UNION { ?inrefitem a rpubl:Forfattningsreferens; rpubl:angerGrundforfattning ?current; ?refprop ?reftext . { ?revdoc rpubl:kapitel ?revchapter . ?revchapter rpubl:paragraf ?revpara . ?revpara ?paraRefRev ?inrefitem . } UNION { ?revdoc rpubl:paragraf ?revpara . ?revpara ?paraRefRev ?inrefitem . } UNION { ?revdoc ?refRev ?inrefitem . } ?revdoc a ?revdoctype; dct:identifier ?revdoc_id . } }