-
Notifications
You must be signed in to change notification settings - Fork 42
Qualified Names in ProvToolbox
The topic of "qualified names" is complex, since it involves the notions of:
- QName in XML,
- PrefixedName in Sparql/turtle, and
- prov:QUALIFIED_NAME in PROV-N.
ProvToolbox uses the class org.openprovenance.prov.model.QualifiedName to represent qualified names.
PROV-DM, PROV-N, PROV-O all use http://www.w3.org/2000/10/XMLSchema# as the XML Schema Namespace URI. Since 0.7.0, this namespace URI is also the default for XML Schema in ProvToolbox. (See http://openprovenance.org/java/site/latest/apidocs/org/openprovenance/prov/model/NamespacePrefixMapper.html#XSD_NS)
The W3C XML Schema Definition Language (XSD) 1.1 Part 2: Datatypes uses the namespace URI http://www.w3.org/2001/XMLSchema for its built-in datatypes. Note the lack of hash (#) at the end of the URI: it is not a typo. So good for interoperability! Since 0.7.0, this namespace URI is only used when marshalling or unmarshalling XML documents. (It used to be the XML namespace URI that ProvToobox used by default before 0.7.0, but we have moved away from this)
PROV-N states that The two following expressions are qualified names. Values of type qualified name can be conveniently expressed within single quotes.
"ex:value" %% prov:QUALIFIED_NAME
'ex:value'
Before version 0.7.0, ProvToolbox was not supporting the notation with prov:QUALIFIED_NAME. It supports it with 0.7.0.
PROV-DM states ``If RDF 1.1 Concepts and Abstract Syntax becomes a W3C Recommendation, all references in PROV to RDF Concepts and Abstract Syntax will be normative references to the 1.1 Recommendation.
RDF concepts itself states that xsd:QName
is amongst the xsd datatypes that should not be used because it require an enclosing XML document context. Therefore, xsd:QName
should not be used in PROV.
For this reason, ProvToolbox introduces org.openprovenance.prov.model.QualifiedName
and prefers using it over javax.xml.namespace.QName
(even though they have similar constructors and accessors).
Having said this, how should the following example be understood:
document
prefix ex <http://example.org/>
entity(ex:a,[ex:attr="ex:hello" %% xsd:QName])
endDocument
Currently, a conversion to PROV-XML results in:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<prov:document xmlns:prov="http://www.w3.org/ns/prov#" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ex="http://example.org/">
<prov:entity prov:id="ex:a">
<ex:attr xsi:type="xsd:QName">ex:hello</ex:attr>
</prov:entity>
</prov:document>
This PROV-XML document, when converted back to PROV-N, gives:
document
prefix ex <http://example.org/>
entity(ex:a,[ex:attr = 'ex:hello'])
endDocument
So the PROV-N parser is permissive.
See https://github.com/lucmoreau/ProvToolbox/wiki/Syntax-of-prov:QUALIFIED_NAME.
See https://github.com/lucmoreau/ProvToolbox/wiki/Mapping-PROV-Qualified-Names-to-xsd:QName