ubiware.core
Class SemanticStatement

java.lang.Object
  extended by ubiware.core.SemanticStatement
All Implemented Interfaces:
java.io.Serializable

public class SemanticStatement
extends java.lang.Object
implements jade.util.leap.Serializable

Representation of a triple (subject, predicate, object).

Since:
3 Aug 2010
Author:
Michael Cochez for Ubiware project
See Also:
Serialized Form

Field Summary
 java.util.List<java.lang.String> memberOf
          List of ID's of referencing Contexts if there are several.
 java.lang.String object
           
 java.lang.String objectDatatype
          for explicitly typed literals, the type of the object will be set.
 java.lang.String objectLanguage
          for literals with language defined, the language will be set
 java.lang.String predicate
           
 int referenced
          The number of referencing contexts.
 java.lang.String subject
           
 
Constructor Summary
SemanticStatement(SemanticStatement toCopy)
          creates an identical semantic statement (deep copy)
SemanticStatement(java.lang.String s, java.lang.String p, java.lang.String o)
           
SemanticStatement(java.lang.String s, java.lang.String p, java.lang.String o, java.lang.String oD, java.lang.String oL)
           
 
Method Summary
 boolean[] bindVars(java.util.HashMap<java.lang.String,java.lang.String> vars)
           
 boolean equalsUniversal(SemanticStatement other)
          returns true this statement is equal (taking universalities into account) to the 'obj' statement.
 java.lang.String getObjectVariableName()
          Returns the name of the variable of the object if it is a variable.
 java.lang.String getPredicateVariableName()
          Returns the name of the variable of the predicate if it is a variable.
 java.lang.String getSubjectVariableName()
          Returns the name of the variable of the subject if it is a variable.
 int hashCode()
           
 boolean hasVariables()
          Does this statement have variables?
 boolean isObjectAny()
          Is the object '*' or a variable?
 boolean isObjectContext()
          Only true if the object of this semantic statement starts with the CONTEXT_PREFIX
 boolean isObjectVar()
          Is the object a variable?
 boolean isPredicateAny()
          Is the predicate '*' or a variable?
 boolean isPredicateVar()
          Is the predicate a variable?
 boolean isSubjectAny()
          Is the subject '*' or a variable?
 boolean isSubjectContext()
          Only true if the subject of this semantic statement starts with the CONTEXT_PREFIX
 boolean isSubjectVar()
          Is the subject a variable?
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

subject

public java.lang.String subject

predicate

public java.lang.String predicate

object

public java.lang.String object

objectDatatype

public java.lang.String objectDatatype
for explicitly typed literals, the type of the object will be set.


objectLanguage

public java.lang.String objectLanguage
for literals with language defined, the language will be set


memberOf

public java.util.List<java.lang.String> memberOf
List of ID's of referencing Contexts if there are several.


referenced

public int referenced
The number of referencing contexts.

Constructor Detail

SemanticStatement

public SemanticStatement(java.lang.String s,
                         java.lang.String p,
                         java.lang.String o)
Parameters:
s - Subject of the statement.
p - Predicate of the statement.
o - Object of the statement.

SemanticStatement

public SemanticStatement(java.lang.String s,
                         java.lang.String p,
                         java.lang.String o,
                         java.lang.String oD,
                         java.lang.String oL)
Parameters:
s - Subject of the statement.
p - Predicate of the statement.
o - Object of the statement.
oD - Datatype of the object.
oL - Language of the object

SemanticStatement

public SemanticStatement(SemanticStatement toCopy)
creates an identical semantic statement (deep copy)

Parameters:
toCopy - the semantic statement to copy from.
Method Detail

isSubjectAny

public boolean isSubjectAny()
Is the subject '*' or a variable?

Returns:
true if the subject is '*' or a variable, false otherwise

isPredicateAny

public boolean isPredicateAny()
Is the predicate '*' or a variable?

Returns:
true if the predicate is '*' or a variable, false otherwise

isObjectAny

public boolean isObjectAny()
Is the object '*' or a variable?

Returns:
true if the object is '*' or a variable, false otherwise

isSubjectVar

public boolean isSubjectVar()
Is the subject a variable?

Returns:
true if the subject is a variable, false otherwise

isPredicateVar

public boolean isPredicateVar()
Is the predicate a variable?

Returns:
true if the predicate is a variable, false otherwise

isObjectVar

public boolean isObjectVar()
Is the object a variable?

Returns:
true if the object is a variable, false otherwise

hasVariables

public boolean hasVariables()
Does this statement have variables?

Returns:
true if this statement has a variable, false otherwise

getSubjectVariableName

public java.lang.String getSubjectVariableName()
Returns the name of the variable of the subject if it is a variable.

Returns:
the name of the variable if the subject is a variable, null otherwise.

getPredicateVariableName

public java.lang.String getPredicateVariableName()
Returns the name of the variable of the predicate if it is a variable.

Returns:
the name of the variable if the predicate is a variable, null otherwise.

getObjectVariableName

public java.lang.String getObjectVariableName()
Returns the name of the variable of the object if it is a variable.

Returns:
the name of the variable if the object is a variable, null otherwise.

equalsUniversal

public boolean equalsUniversal(SemanticStatement other)
returns true this statement is equal (taking universalities into account) to the 'obj' statement.


bindVars

public boolean[] bindVars(java.util.HashMap<java.lang.String,java.lang.String> vars)

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

isSubjectContext

public boolean isSubjectContext()
Only true if the subject of this semantic statement starts with the CONTEXT_PREFIX

Returns:
is the subject of this statement a context container?

isObjectContext

public boolean isObjectContext()
Only true if the object of this semantic statement starts with the CONTEXT_PREFIX

Returns:
is the object of this statement a context container?