Syntax of prov:QUALIFIED_NAME

Luc Moreau edited this page Jul 24, 2015 · 10 revisions

Syntax of prov:QUALIFIED_NAME

1. Introduction

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.

2. \-Escaping for Qualified Names

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.

3. ProvToolbox support

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.

4. Conclusion

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.