Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support namespaces #2

Open
AlexanderWillner opened this issue Jul 27, 2014 · 3 comments
Open

Support namespaces #2

AlexanderWillner opened this issue Jul 27, 2014 · 3 comments

Comments

@AlexanderWillner
Copy link

Description: The library doesn't seem to handle RDFa if it's not in the default name space.
Version: Latest (today / 1.3.0)

Steps that will reproduce the problem?

  1. Add a prefix to an attribute (e.g. test 0330)
  2. Run the test

What is the expected result?
Test should pass.

What happens instead?
Test fails.

Possible workaround:
?

Any additional information:

  • See "RDFa Core 1.1 §4.2 RDFa Host Language Conformance".
  • The modified file:
<?xml version="1.0" encoding="UTF-8"?>
<root prefix="dcterms: http://purl.org/dc/terms/ xsd: http://www.w3.org/2001/XMLSchema#"
xmlns:foo="http://www.w3.org/1999/xhtml"
>
<head>
   <title>Test 0330</title>
</head>
<body lang="en">
  <div foo:property="dc:date" foo:datatype="xsd:date">2010-11-12</div>
</body>
</root>
  • The proof that this is valid RDFa data:
$ rapper -qi rdfa -o ntriples 0330.xml > 0330.n3
$ sparql --data="0330.n3" --query="0330.sparql"
Ask => Yes
$
@alexmilowski
Copy link
Owner

There is no expectation that XML, it its most generic senses as a host language, use prefixed attributes. Test 0330 for XML does not contain namespaces RDFa attributes (see http://rdfa.info/test-suite/test-cases/rdfa1.1/xml/0330.xml).

Green Turtle passes the test suite and, in particular, this test. It does not support the ability to process host languages where the attributes are in the XHTML namespace. Although that feature could be added, it isn't planned at this time.

@AlexanderWillner
Copy link
Author

Might be a misunderstanding. I just used Test 0330 as an arbitrary example to introduce a namespace. I was referring to the following sentence in the "RDFa Core 1.1 - Second Edition" document: "When a Host Language does not use the attributes in 'no namespace', they must be referenced via the XHTML Namespace (http://www.w3.org/1999/xhtml)."
When embedding RDFa in existing XML documents, this is sometimes needed.

But your summary seems to nail it down: while the specification allows namespaces, Green Turtle does not support them, yet. Thanks.

@alexmilowski
Copy link
Owner

Actually, the specification says that "When a Host Language does not use the attributes in 'no namespace' ..." and XML, as a generic host language, allows for attributes in the no namespace. As such, the clause does not apply.

If there was an XML vocabulary that forbid them or forbid any extra attributes without a namespace, then you would want a processor that supported such a mode. For example, I couldn't add RDFa attributes to the XProc vocabulary because it forbids any attributes without a namespace except its own. As such, to add RDFa to XProc, I would need to use the XHTML namespace with the attributes. As such, the Green Turtle processor can't process such a situation.

As I said, it would be possible to add that support. In RDFaProcessor.js you would have to override setContext() to detect the vocabulary. Unfortunately, the code would need to be refactored to use a table of attribute namespaces as the names are just literals in the various places.

Not a huge amount of work but I can't get to this now. I'll keep this open because such refactoring should be done anyway.

I'd be happy to accept a patch. ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants