rdf:ID                                                       

Definition

The rdf:ID attribute on a node element (not property element, that has another meaning) can be used instead of rdf:about and gives a relative RDF URI reference equivalent to # concatenated with the rdf:ID attribute value.

The rdf:ID is a Production syntaxTerm (not a concept).

EXAMPLE:    If rdf:ID="name", that would be equivalent to rdf:about="#name". rdf:ID provides an additional check since the same name can only appear once in the scope of an xml:base value (or document, if none is given), so is useful for defining a set of distinct, related terms relative to the same RDF URI reference.

Example listing

Triple

 

RDF/XML

Example using rdf:ID and xml:base for shortening URIs

    <?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/"

                      xml:base="http://example.org/here/">

        <rdf:Description rdf:ID="snack">

            <ex:prop rdf:resource="fruit/apple"/>

        </rdf:Description>

    </rdf:RDF>

This shows abbreviating the node RDF URI reference of http://example.org/here/#snack using an xml:base of http://example.org/here/ and an rdf:ID on the rdf:Description node element. The object node of the ex:prop predicate is an absolute RDF URI reference resolved from the rdf:resource XML attribute value using the in-scope base URI to give the RDF URI reference http://example.org/here/fruit/apple.

Other information

RDF/XML allows further abbreviating RDF URI references in XML attributes in two ways. The XML Infoset provides a base URI attribute xml:base that sets the base URI for resolving relative RDF URI references, otherwise the base URI is that of the document. The base URI applies to all RDF/XML attributes that deal with RDF URI references which are rdf:about, rdf:resource, rdf:ID and rdf:datatype.

Both forms require a base URI to be known, either from an in-scope xml:base or from the URI of the RDF/XML document.

Use in ISO 15926