nz.ac.waikato.mcennis.rat.graph
Class UserIDList

java.lang.Object
  extended by nz.ac.waikato.mcennis.rat.graph.model.ModelShell
      extended by nz.ac.waikato.mcennis.rat.graph.UserIDList
All Implemented Interfaces:
java.io.Serializable, Graph, Model, ParsedObject

public class UserIDList
extends ModelShell
implements Graph

Class that records only those users that initiate links. All other forms of adding a user are disabled. All other apsects of the graph are no-ops. Used to create a subset of all seen users that are represented by a FOAF page (i.e. have been crawled).

See Also:
Serialized Form

Field Summary
 
Fields inherited from class nz.ac.waikato.mcennis.rat.graph.model.ModelShell
listener
 
Constructor Summary
UserIDList()
          Creates a new instance of UserIDList
 
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)
          Instead of adding a link, adds the source actor to the list of 'good' actors
 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.
 Actor[] getActor()
          Retrieve an array of all actors of all types.
 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)
          Returns only actors that are present in the index of 'good' actors.
 int getActorCount(java.lang.String mode)
          Returns the number of actors of the given type
 java.util.Iterator<Actor> getActorIterator(java.lang.String type)
          Create a read only iterator over all actors.
 java.lang.String[] getActorTypes()
          List all types - returns null if no actors exist.
 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.
 Graph[] getGraphs(java.util.regex.Pattern pattern)
          Creates an array of graph objects.
 java.lang.String getID()
          Return the ID associated with this Graph
 Link[] getLink()
          Return all user to user links in this graph in an array.
 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.
 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.
 Link[] getLinkByDestination(java.lang.String type, Actor destActor)
          Returns all links (edges, arcs) of type (relation) type that point to the given actor.
 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.lang.String[] getLinkTypes()
          Returns all link types currently in this graph or null if no links are present.
 Parameter[] getParameters()
          Obtain a computer-readable description of the parameters and options this graph supports
 Graph getParent()
          Returns the parent graph of this object or null if this is a root graph
 PathSet[] getPathSet()
          Return all PathSets associated with this graph.
 PathSet getPathSet(java.lang.String id)
          Return the named PathSet.
 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
 Graph getSubGraph(java.util.Properties props, java.util.Set<Actor> actor)
          Creates a new graph from the current graph using the Properties props containing the actors actor and all links that link between actors in actor.
 Graph[] getSubGraph(Query q)
          Return newly created subgraphs that matches the given query FIXME: Currently not implemented in any graph.
 void init(java.util.Properties props)
          Set the parameters of this graph from the following property object.
 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 setID(java.lang.String id)
          Set this graph's ID to this value.
 void setSubGraph(Query q)
          Same as getSubGraph but the resulting graphs are stored internally NOTE: this interface may be removed.
 
Methods inherited from class nz.ac.waikato.mcennis.rat.graph.model.ModelShell
addListener, fireChange
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface nz.ac.waikato.mcennis.rat.graph.model.Model
addListener
 

Constructor Detail

UserIDList

public UserIDList()
Creates a new instance of UserIDList

Method Detail

add

public void add(Actor u)
Description copied from interface: Graph
Add a user to the graph. This replaces the user if a user with the same ID already exists.

Specified by:
add in interface Graph
Parameters:
u - user to be included in the graph.

add

public void add(Link link)
Instead of adding a link, adds the source actor to the list of 'good' actors

Specified by:
add in interface Graph
Parameters:
link - link (arc,edge) to be mined

remove

public void remove(Actor u)
Description copied from interface: Graph
Identifies the given user and removes it and all links involving it from the graph.

Specified by:
remove in interface Graph
Parameters:
u - user to be removed from the graph.

remove

public void remove(Link ul)
Description copied from interface: Graph
remove all user links with the same type, user ID, and artist ID from the graph

Specified by:
remove in interface Graph
Parameters:
ul - link to be removed from the graph.

getActor

public Actor getActor(java.lang.String type,
                      java.lang.String ID)
Returns only actors that are present in the index of 'good' actors.

Specified by:
getActor in interface Graph
ID - ID string identifying an user
Returns:
user object who has this ID or null if it is not present

getActor

public Actor[] getActor()
Description copied from interface: Graph
Retrieve an array of all actors of all types. Returns null if no actors are in the graph.

Specified by:
getActor in interface Graph
Returns:
array of all users in the graph

getActor

public Actor[] getActor(java.lang.String type)
Description copied from interface: Graph
Retrieve an array of all actors of a given type. Returns null if there are no actors of that type in the graph.

Specified by:
getActor in interface Graph
Parameters:
type - class of actor to return
Returns:
array of actors of the given type

getActorIterator

public java.util.Iterator<Actor> getActorIterator(java.lang.String type)
Description copied from interface: Graph
Create a read only iterator over all actors.

Specified by:
getActorIterator in interface Graph
Parameters:
type - type (mode) of actor to return
Returns:
iterator over all actors of the given type

getActorTypes

public java.lang.String[] getActorTypes()
Description copied from interface: Graph
List all types - returns null if no actors exist.

Specified by:
getActorTypes in interface Graph
Returns:
array of all type names in this graph

getLink

public Link[] getLink()
Description copied from interface: Graph
Return all user to user links in this graph in an array. Returns null if no such user link exists.

Specified by:
getLink in interface Graph
Returns:
array of all userlinks or null

getLink

public Link[] getLink(java.lang.String type)
Description copied from interface: Graph
Retrieve an array of all userlinks of the given type from this graph or null if no such links are in this graph.

Specified by:
getLink in interface Graph
Returns:
array of all user links of a given type or null

getLinkBySource

public Link[] getLinkBySource(java.lang.String type,
                              Actor sourceActor)
Description copied from interface: Graph
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.

Specified by:
getLinkBySource in interface Graph
Parameters:
type - type (relation) of link to return
sourceActor - starting point of the link
Returns:
Array of links or null

getLinkByDestination

public Link[] getLinkByDestination(java.lang.String type,
                                   Actor destActor)
Description copied from interface: Graph
Returns all links (edges, arcs) of type (relation) type that point to the given actor. Returns null if no such links exist

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

getLink

public Link[] getLink(java.lang.String type,
                      Actor sourceActor,
                      Actor destActor)
Description copied from interface: Graph
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.

Specified by:
getLink in interface Graph
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

getLinkTypes

public java.lang.String[] getLinkTypes()
Description copied from interface: Graph
Returns all link types currently in this graph or null if no links are present.

Specified by:
getLinkTypes in interface Graph
Returns:
array of link types

getSubGraph

public Graph[] getSubGraph(Query q)
Description copied from interface: Graph
Return newly created subgraphs that matches the given query FIXME: Currently not implemented in any graph. FIXME: Query structure needs to be defined.

Specified by:
getSubGraph in interface Graph
Parameters:
q - query object to be executed.
Returns:
Array of graphs created by the query or null if none are created

setSubGraph

public void setSubGraph(Query q)
Description copied from interface: Graph
Same as getSubGraph but the resulting graphs are stored internally NOTE: this interface may be removed.

Specified by:
setSubGraph in interface Graph
Parameters:
q - Query to be executed

getProperty

public Property[] getProperty()
Description copied from interface: Graph
Returns an array of all properties associated with this object or null if none exist

Specified by:
getProperty in interface Graph
Returns:
Array of properties

getProperty

public Property getProperty(java.lang.String type)
Description copied from interface: Graph
Return a property named by the given string or null if no property by this name exists

Specified by:
getProperty in interface Graph
Parameters:
type - property's name
Returns:
Given property

add

public void add(Property prop)
Description copied from interface: Graph
Add a property to this graph. If a property by this name already exists, it is overwritten with the given property.

Specified by:
add in interface Graph
Parameters:
prop - property to be added.

getPathSet

public PathSet[] getPathSet()
Description copied from interface: Graph
Return all PathSets associated with this graph. Null if no PathSets are in the current graph.

Specified by:
getPathSet in interface Graph
Returns:
Array of PathSets

getPathSet

public PathSet getPathSet(java.lang.String id)
Description copied from interface: Graph
Return the named PathSet. Returns null if no PathSet of the given ID exists.

Specified by:
getPathSet in interface Graph
Parameters:
id - ID of the PathSet to return
Returns:
PathSet specified by this ID

add

public void add(PathSet pathSet)
Description copied from interface: Graph
Add a PathSet to this graph. If another PathSet of the same ID exists, it will be overwritten.

Specified by:
add in interface Graph
Parameters:
pathSet - PathSet to be added to this graph

setID

public void setID(java.lang.String id)
Description copied from interface: Graph
Set this graph's ID to this value. Graph ID's must be unique.

Specified by:
setID in interface Graph
Parameters:
id - graph ID

getID

public java.lang.String getID()
Description copied from interface: Graph
Return the ID associated with this Graph

Specified by:
getID in interface Graph
Returns:
ID

commit

public void commit()
Description copied from interface: Graph
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.)

Specified by:
commit in interface Graph

add

public void add(Graph g)
Description copied from interface: Graph
Add a graph (g) to the graph. Will be changed to be a graph helper - deprecated by addChild(Graph g)

Specified by:
add in interface Graph
Parameters:
g - graph to be added

close

public void close()
Description copied from interface: Graph
Close database connections or write to file. Operations on a graph after close are undefined.

Specified by:
close in interface Graph

anonymize

public void anonymize()
Description copied from interface: Graph
Replaces all actor IDs with an anonymous numeric ID.

Specified by:
anonymize in interface Graph

getParent

public Graph getParent()
Description copied from interface: Graph
Returns the parent graph of this object or null if this is a root graph

Specified by:
getParent in interface Graph
Returns:
parent graph

getChildren

public Graph[] getChildren()
Description copied from interface: Graph
Returns the children graphs of this object or null if none exist

Specified by:
getChildren in interface Graph
Returns:
Array of graphs that are children of this graph

getChildren

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

Specified by:
getChildren in interface Graph
Parameters:
id - ID of the graph to return
Returns:
Graph with the given ID

addChild

public void addChild(Graph g)
Description copied from interface: Graph
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.

Specified by:
addChild in interface Graph
Parameters:
g - Child Graph

getSubGraph

public Graph getSubGraph(java.util.Properties props,
                         java.util.Set<Actor> actor)
Description copied from interface: Graph
Creates a new graph from the current graph using the Properties props containing the actors actor and all links that link between actors in actor.

Specified by:
getSubGraph in interface Graph
Parameters:
props - Properties for creating a new Graph
actor - subset of graph's actors to make the subgraph from
Returns:
child graph of this graph

getGraphs

public Graph[] getGraphs(java.util.regex.Pattern pattern)
Description copied from interface: Graph
Creates an array of graph objects. Created as follows: if the graph matches, it adds itself to the array, else it recursively checks every child. This ensures that algorithms only execute at one level of the tree.

Specified by:
getGraphs in interface Graph
Parameters:
pattern - Regular expression for identifying graphs
Returns:
array of graphs or an empty graph array if no graph matches

getParameters

public Parameter[] getParameters()
Description copied from interface: Graph
Obtain a computer-readable description of the parameters and options this graph supports

Specified by:
getParameters in interface Graph
Returns:
Description of all parameters this graph object supports.

init

public void init(java.util.Properties props)
Description copied from interface: Graph
Set the parameters of this graph from the following property object.

Specified by:
init in interface Graph
Parameters:
props - properties to be set

getActorCount

public int getActorCount(java.lang.String mode)
Description copied from interface: Graph
Returns the number of actors of the given type

Specified by:
getActorCount in interface Graph
Parameters:
mode - type of actor to query
Returns:
int number of actors of the given type