Class BottomUpIndex

  • All Implemented Interfaces:
    KnowledgeIndex

    public final class BottomUpIndex
    extends java.lang.Object
    implements KnowledgeIndex
    Computes all of the parent shapes of resources and operations from the bottom-up.
    • Constructor Detail

      • BottomUpIndex

        public BottomUpIndex​(Model model)
    • Method Detail

      • getAllParents

        public java.util.List<EntityShape> getAllParents​(ToShapeId service,
                                                         ToShapeId operationOrResource)
        Gets all of the parents of an operation or resource within a service.

        The returned list contains each EntityShape parent (a resource or service shape). The first element in the list is the direct parent of the resource/operation, followed by that resource's parent, until finally the last element in the list is always a ServiceShape.

        Parameters:
        service - Service to query.
        operationOrResource - The operation or resource for which to find the parents.
        Returns:
        Returns the parents of the resource.
      • getEntityBinding

        public java.util.Optional<EntityShape> getEntityBinding​(ToShapeId service,
                                                                ToShapeId operationOrResource)
        Gets the direct parent of an operation or resource.
        Parameters:
        service - Service closure to query.
        operationOrResource - The operation or resource to query.
        Returns:
        Returns the optionally found parent, a resource or service shape.
      • getResourceBinding

        public java.util.Optional<ResourceShape> getResourceBinding​(ToShapeId service,
                                                                    ToShapeId operationOrResource)
        Gets the direct parent resource of an operation or resource if and only if the given resource or operation is bound to a resource and not bound to a service.
        Parameters:
        service - Service closure to query.
        operationOrResource - The operation or resource to query.
        Returns:
        Returns the optionally found parent resource.