0

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.

Tomasz Pluskiewicz
  • 3,622
  • 1
  • 19
  • 42
Thomas
  • 4,030
  • 4
  • 40
  • 79

1 Answers1

3

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:

  • vocab for specifying a default vocabulary (which can be used without prefix)
  • prefix for specifying vocabulary prefixes
  • resource for identifiers
  • typeof for types
  • property for properties

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.)

Community
  • 1
  • 1
unor
  • 92,415
  • 26
  • 211
  • 360
  • Ah, understood. Thanks! Changing the URI in the RDF+XML example to the /resource/ scheme would make sense as well, right? – Thomas Sep 07 '16 at 10:06
  • 2
    @Thomas: Yes, this goes for every RDF serialization. If you use DBpedia’s /page/ URIs, your statements are about the web documents, not about the things these web documents are about. – unor Sep 07 '16 at 14:02