Class UriExpression

    • 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 null if 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 null if the string does not contain a valid URI Expression.