Class TrellisUtils


  • public final class TrellisUtils
    extends Object
    The TrellisUtils class provides a set of convenience methods related to generating and processing RDF objects.
    • Method Detail

      • getContainer

        public static Optional<IRI> getContainer​(IRI identifier)
        Get the structural-logical container for this resource.
        Parameters:
        identifier - the resource identifier
        Returns:
        a container, if one exists. Only the root resource would return empty here.
      • normalizeIdentifier

        public static IRI normalizeIdentifier​(IRI identifier)
        For any identifier, normalize its form to remove any hashURIs or trailing slashes.
        Parameters:
        identifier - the identifier
        Returns:
        a normalized identifier
      • buildTrellisIdentifier

        public static IRI buildTrellisIdentifier​(String path)
        Build a Trellis identifier from a path string.
        Parameters:
        path - the resource path
        Returns:
        the trellis identifier
      • normalizePath

        public static String normalizePath​(String path)
        Normalize a path component for a Trellis identifier.
        Parameters:
        path - the path
        Returns:
        the normalized path
      • toGraph

        public static Collector<Triple,​?,​Graph> toGraph()
        Collect a stream of Triples into a Graph.
        Returns:
        a graph
      • toDataset

        public static org.trellisldp.api.TrellisUtils.DatasetCollector toDataset()
        Collect a stream of Quads into a Dataset.
        Returns:
        a Collector that accumulates a Stream of Quads into a Dataset