info.sswap.api.model
Interface SSWAPIndividual

All Superinterfaces:
SSWAPElement, SSWAPModel
All Known Subinterfaces:
SSWAPGraph, SSWAPNode, SSWAPObject, SSWAPProvider, SSWAPResource, SSWAPSubject
All Known Implementing Classes:
EmpireGeneratedNodeImpl, GraphImpl, IndividualImpl, NodeImpl, NonEmpireIndividual, ObjectImpl, ProviderImpl, ResourceImpl, SubjectImpl, TranslatedSubjectImpl

public interface SSWAPIndividual
extends SSWAPElement

Represents an individual in SSWAP, which corresponds to an RDF resource (a URI or blank node). Individuals can have properties (both object properties and datatype properties), which in turn have values. An individual is always in reference to a document; to create a new individual, see SSWAPDocument.

Author:
Blazej Bulka

Method Summary
 SSWAPProperty addProperty(SSWAPPredicate predicate, SSWAPIndividual individual)
          Adds a property to this individual with the specified individual as the value.
 SSWAPProperty addProperty(SSWAPPredicate predicate, SSWAPLiteral literal)
          Adds a property to this individual with the specified literal value
 SSWAPProperty addProperty(SSWAPPredicate predicate, java.lang.String value)
          Adds a property to this individual with the specified value.
 SSWAPProperty addProperty(SSWAPPredicate predicate, java.lang.String value, java.net.URI datatype)
          Adds a property to this individual with the specified literal value with the specified datatype.
 void addType(SSWAPType type)
          Adds a new declared type to the individual
 void clearProperty(SSWAPPredicate predicate)
          Removes all property instances of the specified predicate.
 SSWAPType getDeclaredType()
          Gets a single type for this individual that summarizes all the declared types.
 java.util.Collection<SSWAPType> getDeclaredTypes()
          Gets all declared types of the individual.
 SSWAPIndividual getInferredIndividual()
          Retrieves an inferred view (a copy) of the individual.
 java.util.Collection<SSWAPProperty> getProperties()
          Gets all the properties for this individual.
 java.util.Collection<SSWAPProperty> getProperties(SSWAPPredicate predicate)
          Gets all the properties (and their values) for the predicate
 SSWAPProperty getProperty(SSWAPPredicate predicate)
          Gets the property by its Predicate.
 SSWAPType getType()
          Gets a single type for this individual that summarizes all the types for this individual (both explicitly declared and inferred).
 java.util.Collection<SSWAPType> getTypes()
          Gets all types for this individual (including both explicitly declared types and inferred types).
 java.util.Collection<SSWAPProperty> hasValue(SSWAPElement element)
          Retrieves all properties of the individual with the specified value (regardless of the predicate of these properties)
 boolean hasValue(SSWAPPredicate predicate, SSWAPElement element)
          Checks whether the individual has a property with the specified value for the predicate.
 boolean isAnonymous()
          Checks whether this node is a blank node (i.e., it does not have its own URI, but rather it is represented by a blank node in the RDF).
 boolean isCompatibleWith(SSWAPType type)
          Checks whether this individual is compatible with the argument type; i.e., if the individual is asserted to be of this type (e.g., via addType(SSWAPType) method), would the ontology remain consistent or become inconsistent?
 boolean isOfType(SSWAPType type)
          Checks whether this individual is of a given type.
 void removeProperty(SSWAPPredicate predicate, SSWAPElement value)
          Removes a single property from this individual (property is identified by the predicate and the value)
 void removeProperty(SSWAPProperty property)
          Removes a single property instance from this individual (identified by the specified SSWAPProperty instance).
 void removeType(SSWAPType type)
          Removes a type from the individual.
 SSWAPProperty setProperty(SSWAPPredicate predicate, SSWAPIndividual individual)
          Sets the value of the property to the individual.
 SSWAPProperty setProperty(SSWAPPredicate predicate, SSWAPLiteral literal)
          Sets the value of the property to the literal object.
 SSWAPProperty setProperty(SSWAPPredicate predicate, java.lang.String value)
          Sets the value of the property to the specified value.
 SSWAPProperty setProperty(SSWAPPredicate predicate, java.lang.String value, java.net.URI datatype)
          Sets the value of the property to the specified value and datatype URI.
 
Methods inherited from interface info.sswap.api.model.SSWAPElement
addComment, addLabel, asBoolean, asDouble, asIndividual, asInteger, asList, asLiteral, asString, getComment, getLabel, isIndividual, isList, isLiteral
 
Methods inherited from interface info.sswap.api.model.SSWAPModel
addImport, checkProfile, dereference, dereference, doClosure, getDocument, getImports, getInputStream, getNsPrefixMap, getReasoningService, getTypeSignature, getURI, isDereferenced, removeImport, removeNsPrefix, serialize, serialize, setNsPrefix, validate
 

Method Detail

isAnonymous

boolean isAnonymous()
Checks whether this node is a blank node (i.e., it does not have its own URI, but rather it is represented by a blank node in the RDF).

Returns:
true if this is a blank node, false otherwise.

getDeclaredTypes

java.util.Collection<SSWAPType> getDeclaredTypes()
Gets all declared types of the individual.

Returns:
a collection of declared types for this individual

getDeclaredType

SSWAPType getDeclaredType()
Gets a single type for this individual that summarizes all the declared types. If the individual contains one declared type, this is the type that will be returned. If the individual contains more than one declared type, it will return an anonymous type that is an intersection of all of the declared types. If the individual does not have any declared type, it returns owl:Thing.

Returns:
a single type that represents all declared types for this individual

getTypes

java.util.Collection<SSWAPType> getTypes()
Gets all types for this individual (including both explicitly declared types and inferred types).

Returns:
a collection of all types for this individual (including explicitly declared types and inferred ones)

getType

SSWAPType getType()
Gets a single type for this individual that summarizes all the types for this individual (both explicitly declared and inferred). The type returned by this method is an anonymous type that is an intersection of all the types.

Returns:
a single type that represents all the types for this individual

addType

void addType(SSWAPType type)
Adds a new declared type to the individual

Parameters:
type - the type to be added

removeType

void removeType(SSWAPType type)
Removes a type from the individual. If the passed type is not a current type of this individual, this method does nothing.

Parameters:
type - the type to be removed.

getProperties

java.util.Collection<SSWAPProperty> getProperties()
Gets all the properties for this individual.

Returns:
the set of the properties.

getProperty

SSWAPProperty getProperty(SSWAPPredicate predicate)
Gets the property by its Predicate. If there are multiple values for the predicate, this method return only the first value.

Parameters:
predicate - the predicate for which property should be retrieved
Returns:
the property with this predicate, or null if there are no values for this predicate

getProperties

java.util.Collection<SSWAPProperty> getProperties(SSWAPPredicate predicate)
Gets all the properties (and their values) for the predicate

Parameters:
predicate - the predicate for which the properties should be retrieved
Returns:
the collection of the properties with this predicate, or null if there are no such properties

removeProperty

void removeProperty(SSWAPProperty property)
Removes a single property instance from this individual (identified by the specified SSWAPProperty instance). If the individual has other values for this property, these entries are unaffected (as opposed to clearProperty(SSWAPPredicate)). If the specified property does not exist for this individual, this method does nothing.

Parameters:
property - property and its value to be removed
See Also:
removeProperty(SSWAPPredicate, SSWAPElement), clearProperty(SSWAPPredicate)

removeProperty

void removeProperty(SSWAPPredicate predicate,
                    SSWAPElement value)
Removes a single property from this individual (property is identified by the predicate and the value)

Parameters:
predicate - the predicate for the property to be removed
value - the value for the property to be removed

clearProperty

void clearProperty(SSWAPPredicate predicate)
Removes all property instances of the specified predicate.

Parameters:
predicate - the predicate whose all values should be removed
See Also:
removeProperty(SSWAPProperty)

isOfType

boolean isOfType(SSWAPType type)
Checks whether this individual is of a given type.

Parameters:
type - the type to be checked
Returns:
true if this individual is of given type, false otherwise

isCompatibleWith

boolean isCompatibleWith(SSWAPType type)
Checks whether this individual is compatible with the argument type; i.e., if the individual is asserted to be of this type (e.g., via addType(SSWAPType) method), would the ontology remain consistent or become inconsistent?

Parameters:
type - type whose compatibility with this individual should be checked
Returns:
true if the type is compatible, false otherwise

addProperty

SSWAPProperty addProperty(SSWAPPredicate predicate,
                          SSWAPIndividual individual)
                          throws java.lang.IllegalArgumentException
Adds a property to this individual with the specified individual as the value.

Parameters:
predicate - the predicate for the added property
individual - the value for the property
Returns:
the newly created property
Throws:
java.lang.IllegalArgumentException - if the individual is not legal for the predicate (e.g., an object for a datatype property)

addProperty

SSWAPProperty addProperty(SSWAPPredicate predicate,
                          java.lang.String value)
                          throws java.lang.IllegalArgumentException
Adds a property to this individual with the specified value. For predicates with a declared rdfs:range, the system will tag the value with the appropriate datatype.

Parameters:
predicate - the predicate for the added property
value - the literal value for the property
Returns:
the newly created property
Throws:
java.lang.IllegalArgumentException - if the value is not legal for the predicate (e.g., a literal for an object property)

addProperty

SSWAPProperty addProperty(SSWAPPredicate predicate,
                          java.lang.String value,
                          java.net.URI datatype)
                          throws java.lang.IllegalArgumentException
Adds a property to this individual with the specified literal value with the specified datatype.

Parameters:
predicate - the predicate for the added property
value - the literal value for the property
datatype - URI for typing the literal value (e.g., SSWAPDatatype.XSD.anyURI)
Returns:
the newly created property
Throws:
java.lang.IllegalArgumentException - if the value or datatype is not legal for the predicate (e.g., a literal for an object property)

addProperty

SSWAPProperty addProperty(SSWAPPredicate predicate,
                          SSWAPLiteral literal)
                          throws java.lang.IllegalArgumentException
Adds a property to this individual with the specified literal value

Parameters:
predicate - the predicate for the added property
literal - the literal value for the property
Returns:
the newly created property
Throws:
java.lang.IllegalArgumentException - if the literal is not legal for the predicate (e.g., a literal for an object property)

setProperty

SSWAPProperty setProperty(SSWAPPredicate predicate,
                          SSWAPIndividual individual)
                          throws java.lang.IllegalArgumentException
Sets the value of the property to the individual. Setting the value removes any other values the current individual may have for the specified predicate.

Parameters:
predicate - the predicate for the added property
individual - the individual
Returns:
the newly created property
Throws:
java.lang.IllegalArgumentException - if the individual is not legal for the predicate (e.g., an object for a datatype property)

setProperty

SSWAPProperty setProperty(SSWAPPredicate predicate,
                          java.lang.String value)
                          throws java.lang.IllegalArgumentException
Sets the value of the property to the specified value. Setting the value removes any other values the current individual may have for the predicate. For predicates with a declared rdfs:range, the system will tag the value with the appropriate datatype.

Parameters:
predicate - the predicate for the added property
value - the literal value
Returns:
the newly created property
Throws:
java.lang.IllegalArgumentException - if the value is not legal for the predicate (e.g., a literal for an object property)

setProperty

SSWAPProperty setProperty(SSWAPPredicate predicate,
                          java.lang.String value,
                          java.net.URI datatype)
                          throws java.lang.IllegalArgumentException
Sets the value of the property to the specified value and datatype URI. Setting the value removes any other values the current individual may have for the predicate.

Parameters:
predicate - the predicate for the added property
value - the literal value
datatype - URI for typing the literal value (e.g., SSWAPDatatype.XSD.anyURI)
Returns:
the newly created property
Throws:
java.lang.IllegalArgumentException - if the value or datatype is not legal for the predicate (e.g., a literal for an object property)

setProperty

SSWAPProperty setProperty(SSWAPPredicate predicate,
                          SSWAPLiteral literal)
                          throws java.lang.IllegalArgumentException
Sets the value of the property to the literal object. Setting the value removes any other values the current individual may have for the predicate.

Parameters:
predicate - the predicate for the added property
literal - value for the property
Returns:
the newly created property
Throws:
java.lang.IllegalArgumentException - if the literal is not legal for the predicate (e.g., a literal for an object property)

hasValue

boolean hasValue(SSWAPPredicate predicate,
                 SSWAPElement element)
Checks whether the individual has a property with the specified value for the predicate.

Parameters:
predicate - the predicate for the property
element - the value for the property
Returns:
true, if there is such a property for this individual, false otherwise

hasValue

java.util.Collection<SSWAPProperty> hasValue(SSWAPElement element)
Retrieves all properties of the individual with the specified value (regardless of the predicate of these properties)

Parameters:
element - the value for properties to be returned
Returns:
a collection of properties with the specified value (may be empty but never null)

getInferredIndividual

SSWAPIndividual getInferredIndividual()
Retrieves an inferred view (a copy) of the individual. The view contains both explicitly asserted and inferred properties and types, so that they can be retrieved by methods such as getProperty(), etc. This view is a snapshot of inferences and is computed at the time of invocation of this method (i.e., it is not updated if this individual's properties change; for an updated version of the inferred model, this method has to be invoked again).

Returns:
an inferred view of this individual


Copyright (c) 2011, iPlant Collaborative, University of Arizona, Cold Spring Harbor Laboratories, University of Texas at Austin.