nz.ac.waikato.mcennis.rat.graph
Interface Graph

All Superinterfaces:
java.lang.Comparable, Model, ParsedObject, java.io.Serializable
All Known Implementing Classes:
Clique, DerbyGraph, MemGraph, NullGraph, PostgresqlGraph, Tree, UserIDList, UserList

public interface Graph
extends java.io.Serializable, ParsedObject, Model, java.lang.Comparable

Interface representing a social network. Users are the individuals consuming music, artists are the artists producing music, userlinks are the links between users (with some name or class attached to them), artistlinks are the links between users and artists, and similar artists are the links between different artists.


Method Summary
 void add(Actor u)
          Add a user to the graph.
 void add(Graph g)
          Add a graph (g) to the graph.
 void add(Link link)
          Adds a userlink to the graph.
 void add(PathSet pathSet)
          Add a PathSet to this graph.
 void add(Property prop)
          Add a property to this graph.
 void addChild(Graph g)
          Set the given graph to be a child of the current graph.
 void anonymize()
          Replaces all actor IDs with an anonymous numeric ID.
 void close()
          Close database connections or write to file.
 void commit()
          Commit the contents to database or storage.
 java.util.List<Actor> getActor()
          Retrieve an array of all actors of all types.
 java.util.List<Actor> getActor(java.lang.String type)
          Retrieve an array of all actors of a given type.
 Actor getActor(java.lang.String type, java.lang.String ID)
          Retrieve the users that has the given ID.
 int getActorCount(java.lang.String mode)
          Returns the number of actors of the given type
 java.util.Iterator<Actor> getActorIterator()
           
 java.util.Iterator<Actor> getActorIterator(java.lang.String type)
          Create a read only iterator over all actors.
 java.util.List<java.lang.String> getActorTypes()
          List all types - returns null if no actors exist.
 java.util.List<Graph> getChildren()
          Returns the children graphs of this object or null if none exist
 Graph getChildren(java.lang.String id)
          Returns the children graph with the given id or null if there is not a child with that name.
 java.util.Iterator<Graph> getChildrenIterator()
           
 java.lang.String getID()
          Return the ID associated with this Graph
 java.util.List<Link> getLink()
          Return all user to user links in this graph in an array.
 java.util.List<Link> getLink(java.lang.String type)
          Retrieve an array of all userlinks of the given type from this graph or null if no such links are in this graph.
 java.util.List<Link> getLink(java.lang.String type, Actor sourceActor, Actor destActor)
          Returns all links of the given type (relation) type going from actor sourceActor to actor destActor or null.
 java.util.Iterator<Link> getLinkByDesinationIterator(java.lang.String type, Actor destActor)
           
 java.util.List<Link> getLinkByDestination(java.lang.String type, Actor destActor)
          Returns all links (edges, arcs) of type (relation) type that point to the given actor.
 java.util.List<Link> getLinkBySource(java.lang.String type, Actor sourceActor)
          Returns all links (edges, arcs) of type (relation) type that go from the given actor to any destination.
 java.util.Iterator<Link> getLinkBySourceIterator(java.lang.String type, Actor sourceActor)
           
 java.util.Iterator<Link> getLinkIterator()
           
 java.util.Iterator<Link> getLinkIterator(java.lang.String type)
           
 java.util.Iterator<Link> getLinkIterator(java.lang.String type, Actor sourceActor, Actor destActor)
           
 java.util.List<java.lang.String> getLinkTypes()
          Returns all link types currently in this graph or null if no links are present.
 Properties getParameter()
          Obtain a computer-readable description of the parameters and options this graph supports
 Parameter getParameter(java.lang.String name)
           
 Graph getParent()
          Returns the parent graph of this object or null if this is a root graph
 java.util.List<PathSet> getPathSet()
          Return all PathSets associated with this graph.
 PathSet getPathSet(java.lang.String id)
          Return the named PathSet.
 java.util.Iterator<PathSet> getPathSetIterator()
           
 java.util.List<Property> getProperty()
          Returns an array of all properties associated with this object or null if none exist
 Property getProperty(java.lang.String type)
          Return a property named by the given string or null if no property by this name exists
 java.util.Iterator<Property> getPropertyIterator()
           
 void init(Properties props)
          Set the parameters of this graph from the following property object.
 Graph prototype()
           
 void remove(Actor u)
          Identifies the given user and removes it and all links involving it from the graph.
 void remove(Link ul)
          remove all user links with the same type, user ID, and artist ID from the graph
 void removeProperty(java.lang.String ID)
           
 void setID(java.lang.String id)
          Set this graph's ID to this value.
 
Methods inherited from interface nz.ac.waikato.mcennis.rat.graph.model.Model
addListener
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

add

void add(Actor u)
Add a user to the graph. This replaces the user if a user with the same ID already exists.

Parameters:
u - user to be included in the graph.

add

void add(Link link)
Adds a userlink to the graph. There is no limit on the number of links between users or even with the same type, source user, and destination user.

Parameters:
link - description of a named link between two users

remove

void remove(Actor u)
Identifies the given user and removes it and all links involving it from the graph.

Parameters:
u - user to be removed from the graph.

remove

void remove(Link ul)
remove all user links with the same type, user ID, and artist ID from the graph

Parameters:
ul - link to be removed from the graph.

getActor

Actor getActor(java.lang.String type,
               java.lang.String ID)
Retrieve the users that has the given ID. Returns null if no user is in the graph with that ID.

Parameters:
type -
ID - ID string identifying an user
Returns:
user object who has this ID or null if it is not present

getActor

java.util.List<Actor> getActor()
Retrieve an array of all actors of all types. Returns null if no actors are in the graph.

Returns:
array of all users in the graph

getActorIterator

java.util.Iterator<Actor> getActorIterator()

getActor

java.util.List<Actor> getActor(java.lang.String type)
Retrieve an array of all actors of a given type. Returns null if there are no actors of that type in the graph.

Parameters:
type - class of actor to return
Returns:
array of actors of the given type

getActorIterator

java.util.Iterator<Actor> getActorIterator(java.lang.String type)
Create a read only iterator over all actors.

Parameters:
type - type (mode) of actor to return
Returns:
iterator over all actors of the given type

getActorTypes

java.util.List<java.lang.String> getActorTypes()
List all types - returns null if no actors exist.

Returns:
array of all type names in this graph

getLink

java.util.List<Link> getLink()
Return all user to user links in this graph in an array. Returns null if no such user link exists.

Returns:
array of all userlinks or null

getLinkIterator

java.util.Iterator<Link> getLinkIterator()

getLink

java.util.List<Link> getLink(java.lang.String type)
Retrieve an array of all userlinks of the given type from this graph or null if no such links are in this graph.

Parameters:
type -
Returns:
array of all user links of a given type or null

getLinkIterator

java.util.Iterator<Link> getLinkIterator(java.lang.String type)

getLinkBySource

java.util.List<Link> getLinkBySource(java.lang.String type,
                                     Actor sourceActor)
Returns all links (edges, arcs) of type (relation) type that go from the given actor to any destination. Returns null if no such links exist.

Parameters:
type - type (relation) of link to return
sourceActor - starting point of the link
Returns:
Array of links or null

getLinkBySourceIterator

java.util.Iterator<Link> getLinkBySourceIterator(java.lang.String type,
                                                 Actor sourceActor)

getLinkByDestination

java.util.List<Link> getLinkByDestination(java.lang.String type,
                                          Actor destActor)
Returns all links (edges, arcs) of type (relation) type that point to the given actor. Returns null if no such links exist

Parameters:
type - type (relation) of link to return
destActor - actor pointed to by links
Returns:
Array of links or null

getLinkByDesinationIterator

java.util.Iterator<Link> getLinkByDesinationIterator(java.lang.String type,
                                                     Actor destActor)

getLink

java.util.List<Link> getLink(java.lang.String type,
                             Actor sourceActor,
                             Actor destActor)
Returns all links of the given type (relation) type going from actor sourceActor to actor destActor or null. This is typically 1 link or null, but the spec does not forbid multiple links of the same type (relation) between two actors.

Parameters:
type - type (relation) of the link to return
sourceActor - starting point of the link
destActor - actor pointed to by links
Returns:
Array of links or null

getLinkIterator

java.util.Iterator<Link> getLinkIterator(java.lang.String type,
                                         Actor sourceActor,
                                         Actor destActor)

getLinkTypes

java.util.List<java.lang.String> getLinkTypes()
Returns all link types currently in this graph or null if no links are present.

Returns:
array of link types

getProperty

java.util.List<Property> getProperty()
Returns an array of all properties associated with this object or null if none exist

Returns:
Array of properties

getPropertyIterator

java.util.Iterator<Property> getPropertyIterator()

removeProperty

void removeProperty(java.lang.String ID)

getProperty

Property getProperty(java.lang.String type)
Return a property named by the given string or null if no property by this name exists

Parameters:
type - property's name
Returns:
Given property

add

void add(Property prop)
Add a property to this graph. If a property by this name already exists, it is overwritten with the given property.

Parameters:
prop - property to be added.

getPathSet

java.util.List<PathSet> getPathSet()
Return all PathSets associated with this graph. Null if no PathSets are in the current graph.

Returns:
Array of PathSets

getPathSetIterator

java.util.Iterator<PathSet> getPathSetIterator()

getPathSet

PathSet getPathSet(java.lang.String id)
Return the named PathSet. Returns null if no PathSet of the given ID exists.

Parameters:
id - ID of the PathSet to return
Returns:
PathSet specified by this ID

add

void add(PathSet pathSet)
Add a PathSet to this graph. If another PathSet of the same ID exists, it will be overwritten.

Parameters:
pathSet - PathSet to be added to this graph

setID

void setID(java.lang.String id)
Set this graph's ID to this value. Graph ID's must be unique.

Parameters:
id - graph ID

getID

java.lang.String getID()
Return the ID associated with this Graph

Returns:
ID

commit

void commit()
Commit the contents to database or storage. This is a null operation for memory only objects. (Delaying committing changes to be in batches can result in a massive decrease in execution time.)


add

void add(Graph g)
Add a graph (g) to the graph. Will be changed to be a graph helper - deprecated by addChild(Graph g)

Parameters:
g - graph to be added

close

void close()
Close database connections or write to file. Operations on a graph after close are undefined.


anonymize

void anonymize()
Replaces all actor IDs with an anonymous numeric ID.


getParent

Graph getParent()
Returns the parent graph of this object or null if this is a root graph

Returns:
parent graph

getChildren

java.util.List<Graph> getChildren()
Returns the children graphs of this object or null if none exist

Returns:
Array of graphs that are children of this graph

getChildrenIterator

java.util.Iterator<Graph> getChildrenIterator()

getChildren

Graph getChildren(java.lang.String id)
Returns the children graph with the given id or null if there is not a child with that name.

Parameters:
id - ID of the graph to return
Returns:
Graph with the given ID

addChild

void addChild(Graph g)
Set the given graph to be a child of the current graph. NOTE: this does not verify that all actors and links only reference actors or links in the parent - this is the responsibility of the caller.

Parameters:
g - Child Graph

getParameter

Properties getParameter()
Obtain a computer-readable description of the parameters and options this graph supports

Returns:
Description of all parameters this graph object supports.

getParameter

Parameter getParameter(java.lang.String name)

init

void init(Properties props)
Set the parameters of this graph from the following property object.

Parameters:
props - properties to be set

getActorCount

int getActorCount(java.lang.String mode)
Returns the number of actors of the given type

Parameters:
mode - type of actor to query
Returns:
int number of actors of the given type

prototype

Graph prototype()

Get Relational Analysis Toolkit at SourceForge.net. Fast, secure and Free Open Source software downloads