rdfsemantic-webrdfardf-xml

Equivalent RDFa markup for RDF+XML snippet


I'm currently learning about all things RDF and was wondering what the equivalent RDFa markup would look like for this RDF+XML snippet:

<?xml version="1.0" encoding="utf-8" ?>
<rdf:RDF 
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"   
    xmlns:dbo="http://dbpedia.org/ontology#" >

    <rdf:Description rdf:about="http://dbpedia.org/page/Bavaria">
        <dbo:population>12440000</dbo:population>
        <dbo:capital rdf:resource="http://dbpedia.org/page/Munich" />
    </rdf:Description>
</rdf:RDF>

I've been looking at the documentation, but can't really figure this out.


Solution

  • Assuming the HTML is

    <p>
      Munich is the capital of Bavaria (population: 12440000).
    </p>
    

    then you could use

    <p prefix="dbo: http://dbpedia.org/ontology#" resource="http://dbpedia.org/resource/Bavaria">
      <span property="dbo:capital" resource="http://dbpedia.org/resource/Munich">Munich</span> is the capital of Bavaria (population: <span property="dbo:population">12440000</span>).
    </p>
    

    to get exactly the same RDF as in your RDF/XML example. There are of course many other possible solutions.

    You only need to know a few attributes for RDFa Lite:

    For more complex cases, refer to the "full" HTML+RDFa spec.


    (Note that I used http://dbpedia.org/resource/… instead of http://dbpedia.org/page/… URIs. See why.)