Package org.openprovenance.prov.model
Class Namespace
- java.lang.Object
-
- org.openprovenance.prov.model.Namespace
-
public class Namespace extends Object
A class to manipulate Namespaces when creating, serializing and converting prov documents.- Author:
- Luc Moreau
-
-
Method Summary
-
-
-
Method Detail
-
getThreadNamespace
public static Namespace getThreadNamespace()
-
extendWith
public void extendWith(Namespace ns)
Extends this Namespace with all the prefix/namespace registration of the Namespace received as argument.
-
setParent
public void setParent(Namespace parent)
-
getParent
public Namespace getParent()
-
addKnownNamespaces
public void addKnownNamespaces()
-
getDefaultNamespace
public String getDefaultNamespace()
-
setDefaultNamespace
public void setDefaultNamespace(String defaultNamespace)
-
registerDefault
public void registerDefault(String namespace)
-
newPrefix
public void newPrefix(String namespace)
-
unregisterDeafult
public void unregisterDeafult(String namespace)
-
gatherNamespaces
public static Namespace gatherNamespaces(Bundle bundle, ProvFactory pFactory)
-
stringToQualifiedName
public QualifiedName stringToQualifiedName(String id, ProvFactory pFactory)
-
stringToQualifiedName
public QualifiedName stringToQualifiedName(String id, ProvFactory pFactory, boolean isEscaped)
-
qualifiedName
public QualifiedName qualifiedName(String prefix, String local, ProvFactory pFactory)
Creates a qualified name, with given prefix and local name. The prefix needs to have been pre-registered. Prefix is allowed to be null: in that case, the intended namespace is the default namespace (seegetDefaultNamespace()
) which must have been pre-registered.- Parameters:
prefix
- the prefix for theQualifiedName
local
- the local name for theQualifiedName
pFactory
- the factory method used to construct theQualifiedName
- Returns:
- a
QualifiedName
- Throws:
QualifiedNameException
- if prefix is not pre-registered.NullPointerException
- if prefix is null and defaultnamespace has not been registered.
-
qualifiedNameToStringWithNamespace
public static String qualifiedNameToStringWithNamespace(QualifiedName name)
-
qualifiedNameToString
public String qualifiedNameToString(QualifiedName name)
-
qualifiedNameToString
public String qualifiedNameToString(QualifiedName name, Namespace child)
- Parameters:
name
- the QualifiedName to convert to stringchild
- argument used just for the purpose of debugging when throwing an exception- Returns:
- a string representation of the QualifiedName
-
qualifiedNameToString
public String qualifiedNameToString(QName name, Namespace child)
- Parameters:
name
- the QName to convert to stringchild
- argument used just for the purpose of debugging when throwing an exception- Returns:
- a string representation of the QualifiedName
-
-