Class ShapeTreeManager

java.lang.Object
com.janeirodigital.shapetrees.core.validation.ShapeTreeManager

public class ShapeTreeManager extends Object
ShapeTreeManager Shape Trees, ยง3: A shape tree manager associates a managed resource with one or more shape trees. No more than one shape tree manager may be associated with a managed resource. A shape tree manager includes one or more shape tree assignments via st:hasAssignment. https://shapetrees.org/TR/specification/#manager
  • Constructor Details

    • ShapeTreeManager

      public ShapeTreeManager(URL id)
      Constructor for a new ShapeTreeManager
      Parameters:
      id - URL of the ShapeTreeManager resource
  • Method Details

    • getUrl

      protected URL getUrl()
      Get the URL (identifier) of the ShapeTreeManager
      Returns:
      URL identifier of the ShapeTreeManager
    • getGraph

      public org.apache.jena.graph.Graph getGraph() throws ShapeTreeException
      Get the ShapeTreeManager as an RDF Graph
      Returns:
      Graph of the ShapeTreeManager
      Throws:
      ShapeTreeException
    • addAssignment

      public void addAssignment(ShapeTreeAssignment assignment) throws ShapeTreeException
      Add a ShapeTreeAssignment to the ShapeTreeManager.
      Parameters:
      assignment - Shape tree assignment to add
      Throws:
      ShapeTreeException
    • mintAssignmentUrl

      public URL mintAssignmentUrl()
      Generates or "mints" a URL for a new ShapeTreeAssignment
      Returns:
      URL minted for a new shape tree assignment
    • mintAssignmentUrl

      public URL mintAssignmentUrl(URL proposedAssignmentUrl)
      Ensure a proposed URL for a new ShapeTreeAssigment doesn't conflict with other assignment URLs already allocated for the ShapeTreeManager
      Parameters:
      proposedAssignmentUrl - URL of the proposed shape tree assignment
      Returns:
      Minted URL for a new shape tree assignment
    • getContainingAssignments

      public List<ShapeTreeAssignment> getContainingAssignments() throws ShapeTreeException
      Throws:
      ShapeTreeException
    • hasContainingAssignments

      public boolean hasContainingAssignments() throws ShapeTreeException
      Throws:
      ShapeTreeException
    • getFromGraph

      public static ShapeTreeManager getFromGraph(URL id, org.apache.jena.graph.Graph managerGraph) throws ShapeTreeException
      Throws:
      ShapeTreeException
    • getAssignmentForShapeTree

      public ShapeTreeAssignment getAssignmentForShapeTree(URL shapeTreeUrl)
    • getAssignmentForRoot

      public ShapeTreeAssignment getAssignmentForRoot(ShapeTreeAssignment rootAssignment)
    • removeAssignment

      public void removeAssignment(ShapeTreeAssignment assignment)
    • removeAssignmentForShapeTree

      public void removeAssignmentForShapeTree(URL shapeTreeUrl)
    • getId

      public URL getId()
    • getAssignments

      public List<ShapeTreeAssignment> getAssignments()