Class ResourceLocator

java.lang.Object
it.uniroma2.art.semanticturkey.data.access.ResourceLocator

public class ResourceLocator extends Object
This class is used to locate a resource either as belonging to a currently open project or to a remote dataset.
  • Field Details

  • Constructor Details

    • ResourceLocator

      public ResourceLocator()
  • Method Details

    • locateResource

      public ResourcePosition locateResource(Project project, org.eclipse.rdf4j.repository.Repository projectRepository, org.eclipse.rdf4j.model.Resource resource, ProjectACL.AccessLevel requestedAccessLevel, ProjectACL.LockLevel requestedLockLevel) throws ProjectAccessException
      Locate a resource. The locator implements the following algorithm:
      1. if resource is a bnode (Value.isBNode() returns true), then assumes it belongs to the provided project
      2. otherwise; resource is a uri, then do the following
        1. if the namespace of resource is equal to the default namespace of project or resource is described in any graph of project (i.e. resource appears as the subject of a triple), then assumes that resource belongs to project
        2. for each open and accessible project p, if the namespace of resource starts with the namespace of p
        3. , then assumes that resource belongs to p
        4. attempt to locate resource in a remote dataset (see MetadataRegistryBackend.findDatasetForResource(IRI)
        5. otherwise; states that the position is unknown
      Parameters:
      project - the current project
      projectRepository - the repository holding the data inside the project
      resource - the resource to be located
      requestedAccessLevel -
      requestedLockLevel -
      Returns:
      Throws:
      ModelAccessException
      ProjectAccessException
    • locateResource

      public ResourcePosition locateResource(Project project, org.eclipse.rdf4j.repository.Repository projectRepository, org.eclipse.rdf4j.model.Resource resource) throws ProjectAccessException
      An overload of locateResource(Project, Repository, Resource), with the last two parameters set to ProjectACL.AccessLevel.R and ProjectACL.LockLevel.NO, respectively.
      Parameters:
      project -
      projectRepository -
      resource -
      Returns:
      Throws:
      ProjectAccessException
      ModelAccessException
    • listResourceLocations

      public List<ResourcePosition> listResourceLocations(Project project, org.eclipse.rdf4j.repository.Repository projectRepository, org.eclipse.rdf4j.model.Resource resource, ProjectACL.AccessLevel requestedAccessLevel, ProjectACL.LockLevel requestedLockLevel) throws ProjectAccessException
      Locate a resource. The locator implements the following algorithm:
      1. if resource is a bnode (ARTNode#isBlank() returns true), then assumes it belongs to the provided project
      2. otherwise; resource is a uri, then do the following
        1. if the namespace of resource is equal to the default namespace of project or resource is defined in any graph of project (see RDFModel#isLocallyDefined(ARTResource, ARTResource...), then assumes that resource belongs to project
        2. for each open and accessible project p, if the namespace of resource is equal to the default namespace of p
        3. , then assumes that resource belongs to p
        4. attempt to locate resource in a remote dataset (see DatasetMetadataRepositoryImpl#findDatasetForResource(IRI)
        5. otherwise; states that the position is unknown
      Parameters:
      project - the current project
      projectRepository - the repository holding the data inside the project
      resource - the resource to be located
      requestedAccessLevel -
      requestedLockLevel -
      Returns:
      Throws:
      ModelAccessException
      ProjectAccessException
    • listResourceLocations

      public List<ResourcePosition> listResourceLocations(Project project, org.eclipse.rdf4j.repository.Repository projectRepository, org.eclipse.rdf4j.model.Resource resource) throws ProjectAccessException
      An overload of listResourceLocations(Project, Repository, Resource), with the last two parameters set to ProjectACL.AccessLevel.R and ProjectACL.LockLevel.NO, respectively.
      Parameters:
      project -
      projectRepository -
      resource -
      Returns:
      Throws:
      ProjectAccessException
      ModelAccessException