Class UriExpression
java.lang.Object
org.incenp.obofoundry.sssom.uriexpr.UriExpression
Represents a “URI Expression ID”, a way to encode composed entities in a URI.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionUriExpression
(String schema) Creates a new blank expression in the given schema. -
Method Summary
Modifier and TypeMethodDescriptiongetComponent
(String key) Gets the value of the given slot in this expression.Gets the name of all slots present in this expression.Gets the schema part of this expression.static UriExpression
parse
(String uri, PrefixManager prefixManager) Parses a string into a URI Expression object.void
putComponent
(String key, String value) Inserts a new component into this expression.toURI
(PrefixManager prefixManager) Turns this object back to a string representation.
-
Constructor Details
-
UriExpression
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 Details
-
getSchema
Gets the schema part of this expression.- Returns:
- The schema.
-
putComponent
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
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
null
if the expression has no such slot.
-
getComponentNames
Gets the name of all slots present in this expression.- Returns:
- The slot names.
-
toURI
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
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
null
if the string does not contain a valid URI Expression.
-