-
Notifications
You must be signed in to change notification settings - Fork 42
Syntax of prov:QUALIFIED_NAME
PROV-DM defines a PROV Identifier as a Qualified Name, which is a name subject to namespace interpretation. It consists of a namespace, denoted by an optional prefix, and a local name_. PROV-DM stipulates that a qualified name can be mapped into an IRI by concatenating the IRI associated with the prefix and the local part. Before 0.7.0, ProvToolbox was complying with this definition.
However, PROV-N provides a concrete syntax for prov:QUALIFIED_NAME, further noting that a PROV-N qualified name QUALIFIED_NAME can be mapped to a valid IRI [RFC3987] by concatenating the namespace denoted its local name to the local name, whose \-escaped characters have been unescaped by dropping the character '' (backslash). Before 0.7.0, ProvToolbox was not providing any support for this type of escaping.
The PROV-N production PN_CHARS_ESC allows for 11 charcters to be escaped.
[55] <PN_CHARS_ESC> ::= "\" ( "=" | "'" | "(" | ")" | "," | "-" | ":" | ";" | "[" | "]" | "." )
When converting a name to a PROV-N compliant local name PN_LOCAL, ProvToolbox escapes the following characters.
Character in Local Name | Escaped Version | Comment |
= | \= | PROV-N compliant |
' | \' | PROV-N compliant |
( | \( | PROV-N compliant |
) | \) | PROV-N compliant |
, | \, | PROV-N compliant |
: | \: | PROV-N compliant |
; | \; | PROV-N compliant |
[ | \[ | PROV-N compliant |
] | \] | PROV-N compliant |
- | (*) Is not escaped since - is accepted by PN_CHARS | |
- | \- | If local name is - |
. | (*) Is not be escaped since . is accepted by PN_CHARS inside a local name | |
. | \. | If last character of a local name |
< | Is it an oversight in PROV-N, should we have escaped it? | |
> | Is it an oversight in PROV-N, should we have escaped it? |
In the escaping procedure, the entries (*) perform no escaping, as per specified. In the unescaping procedure, . and - are always converted to . and -, respectively.
The factory method ProvFactory.newQualifiedName expects a flag indicating whether syntactic check should be performed, whether warnings should be emitted in case of incorrect syntax, or whether an exception should be raised. This factory method expect syntactically correct local names and prefixes to be provided as input.
The class org.openprovenance.prov.model.QualifiedNameUtils offers conversion methods implementing the encoding describe in this document.
Before 0.7.0, ProvToolbox ignored the exact syntax of prov:QUALIFIED_NAME. It meant that ProvToolbox failed to interoperate properly.
A consequence of releasing ProvToolbox 0.7.0 with support for this syntax is that PROV-N documents previously generated may not be readable if they don't already support this encoding.