Skip to content

Test case 0319 #49

@Porges

Description

@Porges

I believe this test case is incorrect.

The given XML is:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <base href="http://example.com/"/>
  <title>Test 0319</title>
</head>
<body prefix="pr: relative/iri#" xmlns:xpr="relative/uri#">
  <p property="pr:prop xpr:prop">value</p>
</body>
</html>

The expected output is:

@prefix pr: <http://rdfa.info/test-suite/test-cases/rdfa1.1/xhtml5/relative/iri#> .
@prefix xpr: <http://rdfa.info/test-suite/test-cases/rdfa1.1/xhtml5/relative/uri#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://example.com/> pr:prop "value";
   xpr:prop "value" .

The given rationale is:

Relative IRI's used with @prefix do not resolve against the document base; they are not processed in any way.
However, the returned document does have a base, so when queried, it will seem to have the same base as the original document.

It is correct that relative IRIs are not absolutized when adding them to the IRI mappings [7.5 step 3]:

Mappings are defined via @prefix. Values in this attribute are evaluated from beginning to end (e.g., left to right in typical documents). For backward compatibility, RDFa Processors SHOULD also permit the definition of mappings via @xmlns. In this case, the value to be mapped is set by the XML namespace prefix, and the value to map is the value of the attribute — an IRI. (Note that prefix mapping via @xmlns is deprecated, and may be removed in a future version of this specification.) When xmlns is supported, such mappings MUST be processed before processing any mappings from @prefix on the same element. Regardless of how the mapping is declared, the value to be mapped MUST be converted to lower case, and the IRI is not processed in any way; in particular if it is a relative path it MUST NOT be resolved against the current base. Authors SHOULD NOT use relative paths as the IRI.

However, as the note at the end of 7.4 says:

Note that it is generally considered a bad idea to use relative paths in prefix declarations. Since it is possible that an author may ignore this guidance, it is further possible that the IRI obtained from a CURIE is relative. However, since all IRIs must be resolved relative to base before being used to create triples, the use of relative paths should not have any effect on processing.

Thus, even if the IRI mappings value is relative, resolving the CURIE pr:prop should give relative/iri#prop, which is then resolved against base which is http://example.com/ before producing triples, not against http://rdfa.info/test-suite/test-cases/rdfa1.1/xhtml5/0319.xhtml.

Also 7.4:

when converting RDFa to triples, any relative IRIs MUST be resolved relative to the base IRI

The <base> element overrides the default base, so the rdfa.info URI should essentially be inaccessible from inside the document — there can only be one base, not multiple.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions