W3C home > Mailing lists > Public > semantic-web@w3.org > September 2012

Re: Transformation to RDF reification

From: Andy Seaborne <andy.seaborne@epimorphics.com>
Date: Wed, 26 Sep 2012 23:01:48 +0100
Message-ID: <50637B4C.5030207@epimorphics.com>
To: semantic-web@w3.org


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 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 21:45:51 GMT