slib.sglib.model.graph
Interface G


public interface G

Interface of a multi directed Graph defined as a set of vertices and a set of oriented edges. Vertices are identified by URI, edge by a triplet subject predicate object (s,p,o) of URIs. The model doesn't support multiple edges s,p,o of the same predicate (p), see E interface. The main aim is to provide an easy to use graph model to manipulate semantic graphs composed of classes (concept) and instances identified by URIs. The classes and instances can established semantic relationships through triplets. All the vertices of the graph are uniquely identified by URIs, we therefore sometimes refer to an URIs corresponding to a vertex through the term vertex. This graph is not RDF compliant as it doesn't support values such as Literals or blank nodes. In the documentation of this class we refer to a triplet or URIs through the term edge. An edge is therefore a statement in which the subject, the predicate and the object are URIs. The subject of the edge is called the source, the predicate is sometimes called the type of the edge, and the object is called the target.

Author:
Sebastien Harispe
See Also:
URI, E, Direction, WalkConstraint

Method Summary
 void addE(E e)
          Add the given edge to the graph
 void addE(org.openrdf.model.URI src, org.openrdf.model.URI type, org.openrdf.model.URI target)
          Add an edge of the given type (URI) between the specified source and target.
 void addEdges(Set<E> e)
          Add the given set of edges of the graph
 void addV(Set<org.openrdf.model.URI> v)
          Add the given set of vertices to the graph.
 void addV(org.openrdf.model.URI v)
          Add the given vertex to the graph.
 boolean containsVertex(org.openrdf.model.URI v)
          Check if the graph contains a Vertex associated to the given Value.
 Set<E> getE()
          Access to a view of the set of edges contained in the graph.
 Set<E> getE(Set<org.openrdf.model.URI> types)
          Retrieve a view of all edges characterized by one of specified predicate URIs.
 Set<E> getE(Set<org.openrdf.model.URI> predicates, org.openrdf.model.URI source, Direction dir)
          Retrieve a view of all edges of the graph characterized by the constraint.
 Set<E> getE(org.openrdf.model.URI predicate)
          Retrieve a view of all edges characterized by the specified URI predicate.
 Set<E> getE(org.openrdf.model.URI v, Direction dir)
          Access to a view of all edges involving a specific vertex considering a particular direction.
 Set<E> getE(org.openrdf.model.URI predicate, org.openrdf.model.URI v, Direction dir)
          Retrieve a view of all edges of the graph characterized by the specified constraint.
 Set<E> getE(org.openrdf.model.URI v, WalkConstraint wc)
          Retrieve a view of all edges of the graph which can be reached from a given vertex respecting the given constraint.
 int getNumberEdges()
           
 int getNumberVertices()
          Return the number of vertices
 org.openrdf.model.URI getURI()
           
 Set<org.openrdf.model.URI> getV()
           
 Set<org.openrdf.model.URI> getV(org.openrdf.model.URI v, org.openrdf.model.URI predicate, Direction dir)
          Return all neighbors vertices of a given vertex considering a particular direction and URI predicate.
 Set<org.openrdf.model.URI> getV(org.openrdf.model.URI v, WalkConstraint wc)
          Retrieve view of all vertices of the graph which can be reached from a given vertex respecting the given constraint.
 void removeE(E e)
          Used to remove an Edge of the graph
 void removeE(Set<E> e)
          Used to remove a set of edges of the graph
 void removeE(org.openrdf.model.URI t)
          Used to remove all edges of a specific type (predicate).
 void removeV(Set<org.openrdf.model.URI> setV)
          Remove all specified vertices.
 void removeV(org.openrdf.model.URI v)
          Remove the given vertex to the graph.
 

Method Detail

getE

Set<E> getE()
Access to a view of the set of edges contained in the graph.

Returns:
an unmodifiable view of the set of edges contained in the graph.

getE

Set<E> getE(org.openrdf.model.URI v,
            Direction dir)
Access to a view of all edges involving a specific vertex considering a particular direction. If the vertex is set to null all edges are retrieved. Setting the direction to null is the same as Direction.BOTH.

Parameters:
v - the vertex of interest
dir - the direction to consider i.e. IN, OUT or BOTH, see Direction
Returns:
the set of edges corresponding to the query. The method return an empty set if no results are associated to the query.

getE

Set<E> getE(org.openrdf.model.URI predicate)
Retrieve a view of all edges characterized by the specified URI predicate. No restriction is applied if the given URI is equals to null.

Parameters:
predicate - the predicate URI of interest
Returns:
a set of edges respecting the given constraints (empty set if no results)

getE

Set<E> getE(Set<org.openrdf.model.URI> types)
Retrieve a view of all edges characterized by one of specified predicate URIs. If the given set of types (predicated )is empty or equal to null no restriction is applied and all edges will be returned.

Parameters:
types - the set of predicate URIs of interest
Returns:
the set of edges of the graph respecting the given constraints (empty set if no results)

getE

Set<E> getE(org.openrdf.model.URI predicate,
            org.openrdf.model.URI v,
            Direction dir)
Retrieve a view of all edges of the graph characterized by the specified constraint. The constraint can be tuned based on the following parameters: If a parameter is set to null, the constraint is relaxed considering this parameter. As an example if the predicate URI is set to null, all edges respecting the other constraints will be returned.

Parameters:
predicate - the predicate URI of the edges of interest
v - the vertex of interest
dir - the direction to consider
Returns:
a set of edges respecting the given constraint (empty Set if no results)

getE

Set<E> getE(Set<org.openrdf.model.URI> predicates,
            org.openrdf.model.URI source,
            Direction dir)
Retrieve a view of all edges of the graph characterized by the constraint. The constraint can be tuned based on the following parameters: If a parameter is set to null, the constraint is relaxed considering this parameter. As an example if the predicate URI is set to null, all edges respecting the other conditions will be returned

Parameters:
predicates - the set of predicate URIs to consider.
source - the vertex of interest
dir - the direction to consider
Returns:
a set of edges respecting the given constraint (empty Set if no results)

getE

Set<E> getE(org.openrdf.model.URI v,
            WalkConstraint wc)
Retrieve a view of all edges of the graph which can be reached from a given vertex respecting the given constraint.

Parameters:
v - the vertex of interest
wc - the object defining the constraint
Returns:
the set of edges which can be reached considering the constraint.

getV

Set<org.openrdf.model.URI> getV(org.openrdf.model.URI v,
                                WalkConstraint wc)
Retrieve view of all vertices of the graph which can be reached from a given vertex respecting the given constraint.

Parameters:
v - the vertex of interest
wc - the object defining the constraint
Returns:
the set of vertices which can be reached considering the constraint.

addE

void addE(org.openrdf.model.URI src,
          org.openrdf.model.URI type,
          org.openrdf.model.URI target)
Add an edge of the given type (URI) between the specified source and target. If the given edge already exits nothing is done. If the source/target of the edge is not part of the graph it will be added.

Parameters:
src - the source of the edge (not null)
type - the predicate URI of the edge to create (not null)
target - the target of the edge (not null)

addE

void addE(E e)
Add the given edge to the graph

Parameters:
e - an edge

addEdges

void addEdges(Set<E> e)
Add the given set of edges of the graph

Parameters:
e - a set of edges

removeE

void removeE(E e)
Used to remove an Edge of the graph

Parameters:
e - the edge to remove

removeE

void removeE(org.openrdf.model.URI t)
Used to remove all edges of a specific type (predicate).

Parameters:
t - the type (predicate) of the edges to remove

removeE

void removeE(Set<E> e)
Used to remove a set of edges of the graph

Parameters:
e - a set of edges

addV

void addV(org.openrdf.model.URI v)
Add the given vertex to the graph. Nothing is done if the graph already exists.

Parameters:
v - the vertex to add

addV

void addV(Set<org.openrdf.model.URI> v)
Add the given set of vertices to the graph.

Parameters:
v - the set of vertices

removeV

void removeV(org.openrdf.model.URI v)
Remove the given vertex to the graph. All related edges (in / out) will also be removed.

Parameters:
v - The vertex to remove

removeV

void removeV(Set<org.openrdf.model.URI> setV)
Remove all specified vertices. All related edges (in / out) will also be removed.

Parameters:
setV - The set of vertices to remove

containsVertex

boolean containsVertex(org.openrdf.model.URI v)
Check if the graph contains a Vertex associated to the given Value.

Parameters:
v - the value to test
Returns:
a boolean : true if the vertex exists else return false
See Also:
V#equals(Object)

getV

Set<org.openrdf.model.URI> getV()
Returns:
an unmodifiable view of the set of vertices contained in the graph.

getNumberVertices

int getNumberVertices()
Return the number of vertices

Returns:
#vertices

getNumberEdges

int getNumberEdges()
Returns:
the number of edges

getV

Set<org.openrdf.model.URI> getV(org.openrdf.model.URI v,
                                org.openrdf.model.URI predicate,
                                Direction dir)
Return all neighbors vertices of a given vertex considering a particular direction and URI predicate. If the given URI is null no restriction on predicate URI is applied.

Parameters:
v - the focusing vertex
predicate - the URI of the edges to consider
dir - the direction to consider
Returns:
the set of vertices associated to the given conditions

getURI

org.openrdf.model.URI getURI()
Returns:
the URI associated to the graph


Copyright © 2013. All Rights Reserved.