rdf:datatype                                             

Definition

RDF allows typed literals to be given as the object node of a predicate. Typed literals consist of a literal string and a datatype RDF URI reference. These are written in RDF/XML using the same syntax for literal string nodes in the property element form (not property attribute) but with an additional rdf:datatype="datatypeURI" attribute on the property element. Any RDF URI reference can be used in the attribute.

Example listing

Triple

<http://example.org/item01>    <http://example.org/stuff/1.0/size>     "123"^^<http://www.w3.org/2001/XMLSchema#int> .

RDF/XML

An example of an RDF typed literal is given below where there is a single RDF triple with the subject node RDF URI reference http://example.org/item01, the predicate RDF URI reference http://example.org/stuff/1.0/size (from ex:size) and the object node with the typed literal ("123", http://www.w3.org/2001/XMLSchema#int) to be interpreted as an W3C XML Schema [XML-SCHEMA2] datatype int.

    <?xml version="1.0"?>

    <rdf:RDF

        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"

        xmlns:ex="http://example.org/stuff/1.0/">

        <rdf:Description rdf:about="http://example.org/item01">

            <ex:size rdf:datatype="http://www.w3.org/2001/XMLSchema#int">123</ex:size>

        </rdf:Description>

    </rdf:RDF>

Other information

 

Use in ISO 15926