RDF increasingly becomes the preferred model for metadata on the
        Web.  It thus provoked me to do a bit of research into the RDF
        and RDF/XML compatibility of the Metalink XML format.

        Regarding the previous discussion of using RDF (and Dublin Core)
        I was able to locate [1], my understanding is that the point
        isn't about making Metalink XML compatible with RDF/XML, but
        rather about defining a mapping, which can be used to “import”
        Metalink metadata into RDF-based models.

        As shown below, the most valuable elements of Metalink XML
        cannot be parsed with an RDF/XML parser, which is somewhat
        unfortunate.

        Dublin Core is less of a problem.  Apparently, the “best current
        practice” for an RDF-based representation is to define its own
        vocabulary of predicates, while also specifying how these
        predicates relate to the similar ones in other vocabularies,
        including Dublin Core.  Such relations may be described in OWL.

        Now, into the technicalities…

        The subsection 2.13 of the RDF/XML specification [2] reads:

    It is common for RDF graphs to have rdf:type predicates from subject
    nodes.  These are conventionally called typed nodes in the graph, or
    typed node elements in the RDF/XML.  RDF/XML allows this triple to
    be expressed more concisely. by replacing the rdf:Description node
    element name with the namespaced-element corresponding to the RDF
    URI reference of the value of the type relationship.  There may, of
    course, be multiple rdf:type predicates but only one can be used in
    this way, the others must remain as property elements or property
    attributes.

        This way, some Metalink documents may be read as RDF/XML
        documents, provided that the following two superficial changes
        are made:

        • the top-level ‘metalink’ element be replaced with ‘rdf:RDF’;

        • all the attributes are given namespace prefixes.

        Consider, e. g.:

$ cat < example.metalink 
<?xml version="1.0" ?>
<rdf:RDF
   xmlns="urn:ietf:params:xml:ns:metalink"
   xmlns:mtl="urn:ietf:params:xml:ns:metalink"
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";>
  <file mtl:name="example.ext">
    <size>14471447</size>
    <url>ftp://ftp.example.com/example.ext</url>
    <url>http://example.com/example.ext</url>
  </file>
</rdf:RDF>
$ rdfproc example-metalink \
      parse example.metalink rdfxml 
rdfproc: Parsing URI file:... with rdfxml parser
$ rdfproc example-metalink \
      serialize turtle 
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .

[]
    a <urn:ietf:params:xml:ns:metalinkfile> ;
    <urn:ietf:params:xml:ns:metalinkname> "example.ext" ;
    <urn:ietf:params:xml:ns:metalinksize> "14471447" ;
    <urn:ietf:params:xml:ns:metalinkurl> "ftp://ftp.example.com/example.ext";, 
"http://example.com/example.ext"; .
$ 

        Note, however, that (apart from the changes shown above) RDF/XML
        representation is incompatible with Metalink in that the
        “objects” (RDF graph “nodes”) must be interspersed with
        “properties” (RDF “arcs”), which is incompatible with, e. g.:

   <file ...>
     ...
     <metaurl
        mtl:mediatype="torrent"
        >http://example.com/example.ext.torrent</metaurl>
     ...
   </file>

        There, the ‘metaurl’ element is directly contained within
        ‘file’, and thus is considered a “proprety” by the RDF/XML
        parser, while it should be a “node” in order to contain the
        ‘mtl:mediatype’ attribute (which would then be considered a
        property by RDF/XML.)

        Unfortunately, most of the valuable elements of Metalink are
        specified as both having attributes, and being direct
        descendants of the ‘file’ element, which makes them incompatible
        with RDF/XML.  In particular, these are: ‘metalink:pieces’,
        ‘metalink:hash’, ‘metalink:metaurl’, ‘metalink:origin’,
        ‘metalink:publisher’, ‘metalink:signature’, ‘metalink:url’.

        While this particular issue could be solved by providing a
        separate Metalink XML parser to the RDF tool in question (or by
        providing an XSLT transformation), it isn't clear as to whether
        the elements above should name (typed) RDF nodes or arcs (or
        both?)

[1] http://article.gmane.org/gmane.comp.web.metalink.devel/318
[2] http://www.w3.org/TR/REC-rdf-syntax/#section-Syntax-typed-nodes

-- 
FSF associate member #7257

Attachment: pgp1OxOubbjwx.pgp
Description: PGP signature

Reply via email to