Package com.apicatalog.rdf.canon
Class IdentifierIssuer
- java.lang.Object
-
- com.apicatalog.rdf.canon.IdentifierIssuer
-
public class IdentifierIssuer extends java.lang.ObjectAn issuer of counted identifiers to map identifiers from one naming scheme to another.
-
-
Constructor Summary
Constructors Constructor Description IdentifierIssuer(java.lang.String prefix)Create a new instance.IdentifierIssuer(java.lang.String prefix, java.util.Map<java.lang.String,java.lang.String> mapping, int counter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidassign(IdentifierIssuer other)Create a mapping in another issuer for all identifiers issued by this, in the same order that they were issued by this.IdentifierIssuercopy()Create a copy of this issuer.private java.lang.StringgetForBlank(java.lang.String value)java.lang.StringgetId(java.lang.String id)Get or allocate a new ID for the specified old ID.java.lang.StringgetIfExists(java.lang.String value)Get the resource replaced by a proper blank identifier if appropriate.booleanhasId(java.lang.String id)Does an old ID have an allocated new ID?.java.util.Map<java.lang.String,java.lang.String>mapping()Get blank nodes mapping table.
-
-
-
Constructor Detail
-
IdentifierIssuer
public IdentifierIssuer(java.lang.String prefix)
Create a new instance.- Parameters:
prefix- the prefix for new identifiers.
-
IdentifierIssuer
public IdentifierIssuer(java.lang.String prefix, java.util.Map<java.lang.String,java.lang.String> mapping, int counter)
-
-
Method Detail
-
assign
public void assign(IdentifierIssuer other)
Create a mapping in another issuer for all identifiers issued by this, in the same order that they were issued by this.- Parameters:
other- the other identifier issuer.
-
copy
public IdentifierIssuer copy()
Create a copy of this issuer.- Returns:
- the issuer to copy
-
getForBlank
private java.lang.String getForBlank(java.lang.String value)
-
getId
public java.lang.String getId(java.lang.String id)
Get or allocate a new ID for the specified old ID.- Parameters:
id- the old ID- Returns:
- the new ID
-
getIfExists
public java.lang.String getIfExists(java.lang.String value)
Get the resource replaced by a proper blank identifier if appropriate.- Parameters:
value- the resource to check- Returns:
- the value or the replaced value
-
hasId
public boolean hasId(java.lang.String id)
Does an old ID have an allocated new ID?.- Parameters:
id- the old ID- Returns:
- true of a new ID has been allocated for this old ID.
-
mapping
public java.util.Map<java.lang.String,java.lang.String> mapping()
Get blank nodes mapping table.- Returns:
- a mapping table
-
-