Search code examples
phpxmlrdfeasyrdf

How to add rdf:datatype with EasyRdf


I am using http://www.easyrdf.org/ PHP library to create an RDF document. I don't know how to add to the RDF document the rdf:datatype.

So what I am trying to achieve is

<rdf:Description rdf:datatype="&xsd:integer">58</rdf:Description>

Solution

  • This produces the desired effect

    // Add xsd:integer to the resource
    $rdf_resource->add(
        'rdf:Description',
        EasyRdf_Literal::create(58, null, 'xsd:integer')
    );