Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## es.upm.gib.mappingAPI2
Class Path

    java.lang.Object
      es.upm.gib.mappingAPI2.Path

All Implemented Interfaces:
  java.io.Serializable

    public class Path

extends java.lang.Object
implements java.io.Serializable

This class is represented by a list of triples and a map of restrictions. It represents a Path of the model.

See Also:
  Serialized Form

Constructor Summary
`Path()` Creates an empty Path
`Path(java.util.ArrayList<Triple> vec)` Create a Path using the vector of triples given as parameter
`Path(Triple firstTriple)` Creates a Path with only one triple.

Method Summary
`void` | `add(Path pt)` Adds a path appending it at the end of the existing Path.
`void` | `add(Triple triple)` Adds a new triple to the end of the path.
`int` | `compareTo(java.lang.Object obj)` compares this path with the object passed as parameter
`boolean` | `containsClass(java.lang.String searchClass)` check if the class given as parameter exists in the Path
`boolean` | `containsRelation(java.lang.String searchRelation)` check if the relation given as parameter exists in the Path
`boolean` | `equals(java.lang.Object obj)` compares "this" object with the object passed as parameter
`Triple` | `firstElement()` Returns the first Triple of the path
`Triple` | `get(int pos)` Returns the Triple in a given position (starting at 0)
`java.lang.String` | `getClass(int pos)` Returns the class in a given position (starting at 0)
`int` | `getClassNumber()` Return the number of classes that composes the Path
`java.util.ArrayList<Triple>` | `getPath()` Retrieves the list of triples of the path
`java.util.Map` | `getRestrictions()` Returns the set of restrictions for this path
`java.lang.String` | `getRestrictions(int index)` returns the restriction associated with the class number "index" in the path.
`boolean` | `isEmpty()` Indicates whether this Path is empty
`boolean` | `isPathSubsumed(Path comparePath, es.upm.gib.owlbasicmodel2.OWLBasicModel2 model)` check if "this" Path is subsumed by comparePath.
`boolean` | `isRestrictionSubsumed(Path comparePath)` Indicates whether the restrictions of this path are equal to the restrictions of a given path
`boolean` | `isSubPathOf(Path superPath)`
`boolean` | `isSubsumed(Path comparePath, es.upm.gib.owlbasicmodel2.OWLBasicModel2 model)` Indicates whether a given path subsumes this path.
`Triple` | `lastElement()` Returns the last Triple of the path
`void` | `removeElementAt(int pos)` Removes the Triple in a given position
`void` | `setPath(java.util.ArrayList<Triple> path)` Set the triples of the path
`void` | `setRestrictions(java.util.Map<java.lang.Integer,java.lang.String> map)` Associates the given Map as parameter with the set of restrictions of this path the hashmap associate the classes of the path with a restriction.
`int` | `size()` Returns the number of triples composing this Path
`java.lang.String` | `toString()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Path

    public Path()

  Creates an empty Path

### Path

    public Path(java.util.ArrayList<Triple> vec)

  Create a Path using the vector of triples given as parameter

  Parameters:
    `vec` - a vector of triple that represents a path

### Path

    public Path(Triple firstTriple)

  Creates a Path with only one triple. The path will be a class-relation-class type path

  Parameters:
    `firstTriple` - the first triple of the Path

Method Detail

### getPath

    public java.util.ArrayList<Triple> getPath()

  Retrieves the list of triples of the path

  Returns:
    triples of the path

### setPath

    public void setPath(java.util.ArrayList<Triple> path)

  Set the triples of the path

  Parameters:
    `path` - List of triples of the path

### add

    public void add(Triple triple)

  Adds a new triple to the end of the path. Care must be taken to ensure that the origen of the given triple equals the destination of the last triple in the path

  Parameters:
    `triple` - the new triple to add

### add

    public void add(Path pt)

  Adds a path appending it at the end of the existing Path. Care must be taken to ensure that the origen of the given triple

  Parameters:
    `pt` - a path to add

### setRestrictions

    public void setRestrictions(java.util.Map<java.lang.Integer,java.lang.String> map)

  Associates the given Map as parameter with the set of restrictions of this path

  the hashmap associate the classes of the path with a restriction.

  so in the path ClassA -> Rel1 -> ClassB -> Rel2 -> ClassC

  if we want to associate the restriction "res=3" to ClassB and "res2=cell" to classC we have to produce an hashmap that contains this entries: 1 -> res=3 2 -> res2=cell

  note that for this purpose ClassB is in position 1 and ClassC is in position 2

  Parameters:
    `map` - the set of defined restriction

### getRestrictions

    public java.lang.String getRestrictions(int index)

  returns the restriction associated with the class number "index" in the path.

  the classes are numbered from 0 to n in the path.

  Parameters:
    `index` - the number of the class selected
  Returns:
    the restriction of the class index

### size

    public int size()

  Returns the number of triples composing this Path

  Returns:
    the number of Triples that compose the Path

### getClassNumber

    public int getClassNumber()

  Return the number of classes that composes the Path

  Returns:
    the number of classes that composes the Path

### get

    public Triple get(int pos)

  Returns the Triple in a given position (starting at 0)

  Parameters:
    `pos` - a position inside the Path
  Returns:
    the Triple contained in the position given as parameter, or null if no triple exists in the given position

### getClass

    public java.lang.String getClass(int pos)

  Returns the class in a given position (starting at 0)

  Parameters:
    `pos` - a position inside the Path
  Returns:
    the class contained in the position given as parameter, or null if no class exists in the given

### removeElementAt

    public void removeElementAt(int pos)

  Removes the Triple in a given position

  Parameters:
    `pos` - the position of the Triple to remove (starting at 0)

### firstElement

    public Triple firstElement()

  Returns the first Triple of the path

  Returns:
    the first Triple of the path

### lastElement

    public Triple lastElement()

  Returns the last Triple of the path

  Returns:
    the last Triple of the path

### isEmpty

    public boolean isEmpty()

  Indicates whether this Path is empty

  Returns:
    true if the Path is empty

### isRestrictionSubsumed

    public boolean isRestrictionSubsumed(Path comparePath)

  Indicates whether the restrictions of this path are equal to the restrictions of a given path

  Parameters:
    `comparePath` - the Path that can subsume "this" Path
  Returns:
    true if the restrictions are equal

### getRestrictions

    public java.util.Map getRestrictions()

  Returns the set of restrictions for this path

  Returns:
    the set of restrictions

### isSubsumed

    public boolean isSubsumed(Path comparePath,
                              es.upm.gib.owlbasicmodel2.OWLBasicModel2 model)

  Indicates whether a given path subsumes this path. Path A is subsumed to path B (or path B sumsumes path A) if: a) the classes and relations in path A are subclasses/subrelations to the corresponding classes and relations in path B b) the restrictions in path A and path B are equal

  Parameters:
    `comparePath` - the Path that can subsume "this" Path
    `model` - the RDF schema associated
  Returns:
    true if "this" Path is subsumed by comparePath

### isPathSubsumed

    public boolean isPathSubsumed(Path comparePath,
                                  es.upm.gib.owlbasicmodel2.OWLBasicModel2 model)

       check if "this" Path is subsumed by comparePath.

       "this" Path is subsumed by compare Path if:

          1. Direct inclusion: "this" is directly included in comparePath.
             given comparePath as     ClassA -> Rel -> ClassB -> Rel2 ->ClassC
             if "this" is ClassA -> Rel ->ClassB->Rel2->ClassC , than it is considered subsumed
             because directly included.

          2. Inheritance: "this" is a path composed (totally or partially) by subclasses of comparePath.
             given comparePath as     ClassA -> Rel -> ClassB
             and considering the classes ClassB1 and classB2 as subclasses of classB
             so if "this" is ClassA -> Rel -> ClassB1 or ClassA -> Rel -> ClassB2
             then it is considered subsumed, because composed by subclasses

          3. Variable usage: "this" is a path that contain an instanciation of the variables that occur in
            comparePath.
            given comparePath as ClassA -> Rel -> ?var1
            and considering the classC and classD as classes reachable from classA through
            the relation Rel
            so if "this" is ClassA -> Rel -> ClassC or ClassA -> Rel -> ClassD
            then it is considered subsumed, because it is an instanciation of the
            comparePath parameter

  Parameters:
    `comparePath` - the Path that can subsume "this" Path
    `model` - the RDF schema associated
  Returns:
    true if "this" Path is subsumed by comparePath

### containsClass

    public boolean containsClass(java.lang.String searchClass)

  check if the class given as parameter exists in the Path

  Parameters:
    `searchClass` - the searched class
  Returns:
    true if the class given as parameter exists in the Path

### containsRelation

    public boolean containsRelation(java.lang.String searchRelation)

  check if the relation given as parameter exists in the Path

  Parameters:
    `searchRelation` - the searched class
  Returns:
    true if the relation given as parameter exists in the Path

### equals

    public boolean equals(java.lang.Object obj)

  compares "this" object with the object passed as parameter

  Overrides:
    `equals` in class `java.lang.Object`
  Parameters:
    `obj` - the object to be compared
  Returns:
    true if "this" instance variable is equal to the parameter one

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### isSubPathOf

    public boolean isSubPathOf(Path superPath)

### compareTo

    public int compareTo(java.lang.Object obj)

  compares this path with the object passed as parameter

  Parameters:
    `obj` - the object to be compared
  Returns:
    a negative value if this precedes obj, zero if this.equals(obj), a positive value if obj precedes this

Overview | Package | Class | Tree | Deprecated | Index | Help

PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD