gr.forth.ics.rdfsuite.vrp.corevrp.model
Class RDF_DAG

java.lang.Object
  extended by gr.forth.ics.rdfsuite.vrp.corevrp.model.RDF_DAG

public class RDF_DAG
extends java.lang.Object

RDF_DAG.java - DAG stands for Directed Acyclic Graph. This class has been generated to describe the Directed Acyclic Graph for classes and properties in respect to the subClass and subProperty relations. It consists of a HashMap containing the Objects as key and the corresponding sub resources are in a HashSet as the value. The graph might consist of several parts that are not connected. To enable an easy traversal the roots are stored in a seperate ArrayList.

In addition, every key of the HashMap points to the following Arraylists structure:
Object Key --> ArrayList -|->[0] (HashSet) Descendants
|->[1] (HashSet) Ancestors
|->[2] (Integer) Number of total Descendants
|->[3] (Integer) Number of total Ancestors
|->[4] (Integer) level distro
|->[5] reserved for data needed by algorithms


Field Summary
 java.util.HashMap dag
          Containing the elements of the adjazenz list.
protected static org.apache.log4j.Logger log
           
 
Constructor Summary
RDF_DAG()
          Creates a new RDF_DAG object.
 
Method Summary
 void computeLevelDistro()
          Computes the level distro of the resources entered in the dag.
 void computeRelatives()
          Computes for all resources in the dag their relatives and put the number in the dag.
 void enter(java.lang.Object sub, java.lang.Object super_res, boolean resource)
          enter to the dag a resource
 void enter(RDF_Resource s)
           
 void enter(RDF_Resource sub, RDF_Resource super_res)
           
 void enumerate(RDF_Model model)
          Print the DAG-Graph to Std IO.
 java.util.HashSet findLeaves()
          Find the leaves, i.e., the nodes without descendants based on the information
 java.util.HashSet findRoots()
          Recompute the roots, i.e., the nodes without ancestors based on the information
 void getAllAncestors()
          Computes the distinct ancestors for all nodes contained in the dag and put the number of the descendants in the dag
 void getAllDescendants(RDF_Resource res)
          Computes the distinct descendants for all nodes under the node and put the number of the descendants in the dag
 java.util.HashMap getdag()
           
 java.util.HashSet getDirectAncestors(RDF_Schema_Resource res, IRDF_Model model)
          5/12/2007 This method as far as I can understand,returns the direct ancestors that are NOT inferred by some other subsumption relationship?
 java.util.HashSet getLeaves()
           
 java.util.ArrayList getLevelDistro()
          Returns an ArrayList of HashSets containing the resources of the same level.
 java.util.ArrayList getloop_element()
           
 boolean getno_loop()
           
 java.util.ArrayList getorder()
           
 java.util.HashSet getRelatives(RDF_Resource res, int i)
          Returns a HashSet containing all the distinct relatives of a node res
 java.util.HashSet getroots()
           
 java.util.HashSet getRoots()
           
 boolean loopcheck()
          Checking the graph for loops and creating the topological order list.
 java.lang.String output()
          Return a string containing the topological order of the DAG
 boolean remove(java.lang.Object sub, java.lang.Object super_res, boolean resource)
           
 boolean remove(RDF_Resource res)
           
 boolean remove(RDF_Resource sub, RDF_Resource super_res)
          Tries to remove the link from 'sub' to 'superResource' out of the DAG
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dag

public java.util.HashMap dag
Containing the elements of the adjazenz list.


log

protected static final org.apache.log4j.Logger log
Constructor Detail

RDF_DAG

public RDF_DAG()
Creates a new RDF_DAG object. We are creating an adjazenz list here.

Method Detail

getLevelDistro

public java.util.ArrayList getLevelDistro()
Returns an ArrayList of HashSets containing the resources of the same level. For example the first element of the ArrayList is a hashset containing all elements of level zero, the second element a hashset of all resources of level one and so on.

Returns:
the level distribution of the resources

getorder

public java.util.ArrayList getorder()
Returns:
the order of the graph

getRoots

public java.util.HashSet getRoots()
Returns:
the roots of the dag

getroots

public java.util.HashSet getroots()

getLeaves

public java.util.HashSet getLeaves()
Returns:
the leaves of the dag

getloop_element

public java.util.ArrayList getloop_element()
Returns:
the elemnt(s) causing the loop

getno_loop

public boolean getno_loop()
Returns:
true if there is no loop

getdag

public java.util.HashMap getdag()
Returns:
the HasmMap Object containing the dag

getDirectAncestors

public java.util.HashSet getDirectAncestors(RDF_Schema_Resource res,
                                            IRDF_Model model)
                                     throws gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException
5/12/2007 This method as far as I can understand,returns the direct ancestors that are NOT inferred by some other subsumption relationship?

Parameters:
res -
model -
Returns:
Throws:
gr.forth.ics.rdfsuite.services.exceptions.LabelCreationException

getRelatives

public java.util.HashSet getRelatives(RDF_Resource res,
                                      int i)
Returns a HashSet containing all the distinct relatives of a node res

Parameters:
res - the node reference
i - When it is set to 0 it computes the distinct descendants of the node. When it is set to 1 computes the distinct ancestors

getAllDescendants

public void getAllDescendants(RDF_Resource res)
Computes the distinct descendants for all nodes under the node and put the number of the descendants in the dag


getAllAncestors

public void getAllAncestors()
Computes the distinct ancestors for all nodes contained in the dag and put the number of the descendants in the dag


enter

public void enter(java.lang.Object sub,
                  java.lang.Object super_res,
                  boolean resource)
enter to the dag a resource

Parameters:
sub -
super_res -
resource -

enter

public void enter(RDF_Resource sub,
                  RDF_Resource super_res)

enter

public void enter(RDF_Resource s)

remove

public boolean remove(RDF_Resource sub,
                      RDF_Resource super_res)
Tries to remove the link from 'sub' to 'superResource' out of the DAG


remove

public boolean remove(RDF_Resource res)

remove

public boolean remove(java.lang.Object sub,
                      java.lang.Object super_res,
                      boolean resource)

loopcheck

public boolean loopcheck()
Checking the graph for loops and creating the topological order list. Returns true if there is no loop, otherwise it will return false


computeLevelDistro

public void computeLevelDistro()
Computes the level distro of the resources entered in the dag. This method creates the ArrayList returned by the getLevelDistro method, and enters to each resource map in the dag a fifth element, an Integer Object, containing the level where it belongs to.


findRoots

public java.util.HashSet findRoots()
Recompute the roots, i.e., the nodes without ancestors based on the information


findLeaves

public java.util.HashSet findLeaves()
Find the leaves, i.e., the nodes without descendants based on the information


computeRelatives

public void computeRelatives()
Computes for all resources in the dag their relatives and put the number in the dag.


output

public java.lang.String output()
Return a string containing the topological order of the DAG


enumerate

public void enumerate(RDF_Model model)
Print the DAG-Graph to Std IO.