Re: Transformation to RDF reification

On 26/09/12 19:20, Dominik Tomaszuk wrote:
> Hi all,
>
> Does anyone know a tool for transforming from normal RDF to RDF with
> reification?
>
> I mean:
>
> :s1 :p1 :o1 .
> :s2 :p2 :o2 .
>
> transform to:
>
> _:a rdf:type rdf:Statement .
> _:a rdf:subject :s1 .
> _:a rdf:predicate :p1 .
> _:a rdf:object :o1 .
> _:b rdf:type rdf:Statement .
> _:b rdf:subject :s2 .
> _:b rdf:predicate :p2 .
> _:b rdf:object :o2 .
>
> Supported syntaxes are irrelevant.
>
> Best,
> Dominik
>

SPARQL Query, to output a new graph:

PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
CONSTRUCT { [] rdf:type rdf:Statement ;
                rdf:subject ?s ;
                rdf:predicate ?p ;
                rdf:object ?o . }
WHERE { ?s ?p ?o }

or to change in place, removing the old data:
SPARQL Update:

PREFIX rdf:     <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
DELETE { ?s ?p ?o }
INSERT { [] rdf:type rdf:Statement ;
             rdf:subject ?s ;
             rdf:predicate ?p ;
             rdf:object ?o . }
WHERE { ?s ?p ?o }

	Andy

Received on Wednesday, 26 September 2012 22:02:22 UTC