# Subgraph Extents

Jump to navigation
Jump to search

## Overview

A subgraph extent is a set of statements bound by a given set of root resources. Subgraph extents are needed in

- Copy-paste
- Import and export
- Delete

## Domain

A subgraph extent domain is the set of resources for which all parent resources are included in the root set. The set of parents for resource *r* are found by

- including all resources
*par*for statements (*r*, p <R http://www.simantics.org/Layer0-1.0/PartOf,*par*) - including all containing ordered sets
*ord*from statements (*r*,*ord*<R http://www.simantics.org/Layer0-1.0/HasNext, _) where*ord*is not*r*.

If the preceding procedure yielded no parents then the parent set is determined by

- including all resources
*par*for statements (*par*, p <R http://www.simantics.org/Layer0-1.0/IsRelatedTo,*r*)

## Extent descriptions

The set of statements in a subgraph extent is determined by applying subgraph extent descriptions to the domain resources. The extent descriptions are specified in ontologies and attached to types. An extent description is implemented using the following adapter class

public interface SubgraphExtent { interface Callback { void statement(ReadGraph graph, Statement statement) throws DatabaseException; void value(ReadGraph graph, Resource resource, byte[] value) throws DatabaseException; } Set<Resource> types(ReadGraph graph) throws DatabaseException; void traverse(ReadGraph graph, Resource resource, Collection<Resource> domain, Callback callback) throws DatabaseException; }

## Extent determination procedure

- Determine the domain set by walking IsRelatedTo from root set and the discovered domain.
- Determine the set of extent descriptions found from root set dependencies (ontologies).
- Divide the set of available extent descriptions into included and excluded sets.
- Determine the set of (potentially) included statements by applying included extent descriptions on the domain set
- Determine the set of excluded statements by applying excluded extent descriptions on the domain set
- Remove the set of excluded statements from the included statement set