Search code examples
semantic-web

Why use RDF instead of XML for the semantic web


I've done a bit of searching around the web about why we use RDF instead of XML for the semantic modeling. I came across this article, but it's still not completely clear to me. i was wondering if someone could just give me a couple of points on why we cannot use XML instead of RDF. From my limited understanding, XML's extensibility just gives us a way to define a document but does not give us any mechanisms to describe the meaning of it. Any examples would be greatly appreciated.

Thank you very much


Solution

  • From my limited understanding, XML's extensibility just gives us a way to define a document but does not give us any mechanisms to describe the meaning of it.

    You're correct. XML describes data but does not do well at describing the relationship between different data elements.

    RDF describes the data and the data relationships. Think of RDF as a textual meta-database. The article calls RDF a semantic model.

    Here's an RDF example:

    <?xml version="1.0"?>
    
    <rdf:RDF
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:cd="http://www.recshop.fake/cd#">
    
    <rdf:Description
        rdf:about="http://www.recshop.fake/cd/Empire Burlesque">
        <cd:artist>Bob Dylan</cd:artist>
        <cd:country>USA</cd:country>
        <cd:company>Columbia</cd:company>
        <cd:price>10.90</cd:price>
        <cd:year>1985</cd:year>
    </rdf:Description>
    
    <rdf:Description
        rdf:about="http://www.recshop.fake/cd/Hide your heart">
        <cd:artist>Bonnie Tyler</cd:artist>
        <cd:country>UK</cd:country>
        <cd:company>CBS Records</cd:company>
        <cd:price>9.90</cd:price>
        <cd:year>1988</cd:year>
    </rdf:Description>
    .
    .
    .
    </rdf:RDF>