Class UriExpression
- java.lang.Object
-
- org.incenp.obofoundry.sssom.uriexpr.UriExpression
-
public class UriExpression extends Object
Represents a “URI Expression ID”, a way to encode composed entities in a URI.- See Also:
- The URI Expression Language proposal.
-
-
Constructor Summary
Constructors Constructor Description UriExpression(String schema)Creates a new blank expression in the given schema.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetComponent(String key)Gets the value of the given slot in this expression.Set<String>getComponentNames()Gets the name of all slots present in this expression.StringgetSchema()Gets the schema part of this expression.static UriExpressionparse(String uri, PrefixManager prefixManager)Parses a string into a URI Expression object.voidputComponent(String key, String value)Inserts a new component into this expression.StringtoURI(PrefixManager prefixManager)Turns this object back to a string representation.
-
-
-
Constructor Detail
-
UriExpression
public UriExpression(String schema)
Creates a new blank expression in the given schema.This constructor is mostly intended for internal use. Client code is expected to obtain a UriExpression object by parsing a string using
parse(String, PrefixManager).- Parameters:
schema- The schema this expression conforms to.
-
-
Method Detail
-
getSchema
public String getSchema()
Gets the schema part of this expression.- Returns:
- The schema.
-
putComponent
public void putComponent(String key, String value)
Inserts a new component into this expression.This is mostly intended for internal use. Client code should refrain from modifying a URI Expression after it has been parsed.
- Parameters:
key- The name of the slot.value- The value of the slot.
-
getComponent
public String getComponent(String key)
Gets the value of the given slot in this expression.- Parameters:
key- The name of the slot to retrieve.- Returns:
- The value associated with that slot, or
nullif the expression has no such slot.
-
getComponentNames
public Set<String> getComponentNames()
Gets the name of all slots present in this expression.- Returns:
- The slot names.
-
toURI
public String toURI(PrefixManager prefixManager)
Turns this object back to a string representation.- Parameters:
prefixManager- The prefix manager to use for condensing slot values into CURIEs.- Returns:
- A string containing the encoded expression.
-
parse
public static UriExpression parse(String uri, PrefixManager prefixManager)
Parses a string into a URI Expression object.- Parameters:
uri- The string to parse.prefixManager- The prefix manager to use to expand CURIEs found within the expression.- Returns:
- The parsed expression, or
nullif the string does not contain a valid URI Expression.
-
-