Why does the W3C RDF validator replace the RDF URI with its own?
Asked Answered
S

1

5

Let us say that we input the following RDF code to the W3C RDF validator at http://www.w3.org/RDF/Validator/.

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:uni="http://www.example.org/uni-ns#">

  <rdf:Description rdf:about="949352">
    <uni:name>Grigoris Antoniou</uni:name>
    <uni:title>Professor</uni:title>
  </rdf:Description>
</rdf:RDF>

Once I ask to parse the RDF code, I find that in the triples, the RDF URI has been replaced with the own URI of the validator.

enter image description here

Should not the subject of the triples be http://www.w3.org/1999/02/22-rdf-syntax-ns#949352?

Why does the validator do this?

Schertz answered 12/11, 2014 at 4:51 Comment(0)
L
6

The rdf:about attribute takes an IRI as value.

You have 949352 as value, which is a relative IRI. It gets resolved to the IRI of the base document (which is the validator in your case).

You could, for example, provide an absolute IRI (example 1), or specify the xml:base (example 2).

Example 1:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:uni="http://www.example.org/uni-ns#">

  <rdf:Description rdf:about="http://my-site.example.com/my-page/949352">
    <uni:name>Grigoris Antoniou</uni:name>
    <uni:title>Professor</uni:title>
  </rdf:Description>
</rdf:RDF>

Example 2:

<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
    xmlns:uni="http://www.example.org/uni-ns#"
    xml:base="http://my-site.example.com/my-page/">

  <rdf:Description rdf:about="949352">
    <uni:name>Grigoris Antoniou</uni:name>
    <uni:title>Professor</uni:title>
  </rdf:Description>
</rdf:RDF>
Lavallee answered 12/11, 2014 at 10:38 Comment(1)
Thanks, looks like I missed the obvious. Your examples will be very enlightening for me as well as others.Schertz

© 2022 - 2024 — McMap. All rights reserved.