- From: Toby Inkster <tai@g5n.co.uk>
- Date: Thu, 17 Dec 2009 17:45:12 +0000
- To: www-tag@w3.org
I was skimming the TAG minutes just now and noticed that TAG was looking at this. I recently implemented an XRD parser in Perl that parses XRD into an RDF model (which can then, say, be queried with SPARQL or serialised as N-Triples). http://search.cpan.org/dist/XRD-Parser/ Most of XRD has an obvious mapping to RDF. Things that don't are: 1. <Alias> - I mapped this to a predicate: <http://ontologi.es/xrd#alias>. owl:sameAs seems too strong an assertion going by how I've seen it used in the wild. 2. Link templates - these I've mapped to a literal datatype. However, because they're literals, they can't be used as RDF subjects in subsequent statements, which means that if their media type, title, etc are in the XRD, that information is lost from the RDF. A bnode mapping might be a possibility. I'm hoping to also write a package that serialises from an RDF model to XRD and experiment with how well data can round-trip. Off the top of my head, I'm pretty sure datatypes in RDF would get lost converting to XRD, but probably not much else. Here's an example of the conversion performed by the current version of the parser. ======== <XRD xmlns="http://docs.oasis-open.org/ns/xri/xrd-1.0" xml:id="foo" xmlns:h="http://host-meta.net/ns/1.0"> <Expires>1970-01-01T00:00:00Z</Expires> <h:Host>example.com</h:Host> <h:Host>www.example.com</h:Host> <Link rel="profile" template="http://services.example.com/profile?uri={uri}"> <Property type="http://property.example.net/1">Foo</Property> <Property type="http://property.example.net/2">Bar</Property> </Link> <Property type="http://property.example.net/3">Baz</Property> <Link rel="another" href="/target" type="text/plain"> <Title>Another</Title> <Property type="http://property.example.net/4">Quux</Property> </Link> </XRD> -------- <http://example.org/#foo> <http://xmlns.com/foaf/0.1/primaryTopic> <http://ontologi.es/xrd#host:example.com> . <http://example.org/#foo> <http://ontologi.es/xrd#expires> "1970-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> . <http://ontologi.es/xrd#host:example.com> <http://property.example.net/3> "Baz" . <http://ontologi.es/xrd#host:www.example.com> <http://property.example.net/3> "Baz" . <http://ontologi.es/xrd#host:example.com> <x-xrd+template+for:http://www.iana.org/assignments/relation/profile> "http://services.example.com/profile?uri={uri}"^^<http://ontologi.es/xrd#URITemplate> . <http://ontologi.es/xrd#host:www.example.com> <x-xrd+template+for:http://www.iana.org/assignments/relation/profile> "http://services.example.com/profile?uri={uri}"^^<http://ontologi.es/xrd#URITemplate> . _:n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> . _:n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://ontologi.es/xrd#host:example.com> . _:n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <x-xrd+template+for:http://www.iana.org/assignments/relation/profile> . _:n0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> "http://services.example.com/profile?uri={uri}"^^<http://ontologi.es/xrd#URITemplate> . _:n0 <http://property.example.net/1> "Foo" . _:n0 <http://property.example.net/2> "Bar" . _:n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> . _:n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://ontologi.es/xrd#host:www.example.com> . _:n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <x-xrd+template+for:http://www.iana.org/assignments/relation/profile> . _:n1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> "http://services.example.com/profile?uri={uri}"^^<http://ontologi.es/xrd#URITemplate> . _:n1 <http://property.example.net/1> "Foo" . _:n1 <http://property.example.net/2> "Bar" . <http://ontologi.es/xrd#host:example.com> <http://www.iana.org/assignments/relation/another> <http://example.org/target> . <http://ontologi.es/xrd#host:www.example.com> <http://www.iana.org/assignments/relation/another> <http://example.org/target> . <http://example.org/target> <http://purl.org/dc/terms/format> <http://www.iana.org/assignments/media-types/text/plain> . <http://example.org/target> <http://purl.org/dc/terms/title> "Another" . _:n2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> . _:n2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://ontologi.es/xrd#host:example.com> . _:n2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.iana.org/assignments/relation/another> . _:n2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://example.org/target> . _:n2 <http://property.example.net/4> "Quux" . _:n3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> . _:n3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject> <http://ontologi.es/xrd#host:www.example.com> . _:n3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate> <http://www.iana.org/assignments/relation/another> . _:n3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#object> <http://example.org/target> . _:n3 <http://property.example.net/4> "Quux" . ======== Let me know if you have any questions. I'm not subscribed to this mailing list, so please CC me if you want me to see it! -- Toby A Inkster <mailto:mail@tobyinkster.co.uk> <http://tobyinkster.co.uk>
Received on Thursday, 17 December 2009 17:46:23 UTC