info.sswap.impl.empire.model
Class IndividualImpl

java.lang.Object
  extended by info.sswap.impl.empire.model.ModelImpl
      extended by info.sswap.impl.empire.model.ElementImpl
          extended by info.sswap.impl.empire.model.IndividualImpl
All Implemented Interfaces:
com.clarkparsia.empire.SupportsRdfId, SSWAPElement, SSWAPIndividual, SSWAPModel
Direct Known Subclasses:
NodeImpl, NonEmpireIndividual

public abstract class IndividualImpl
extends ElementImpl
implements SSWAPIndividual

Implementation of a SSWAP individual (objects in SSWAP). The RDF properties of SSWAPIndividuals are generally converted into SSWAPProperties. Yet, there is a group of properties which have special meaning, and their RDF details are hidden from the users of this API (e.g., rdf:type). Usually, the data encoded in such hidden properties is available via a special function in this API (e.g., getTypes()).

Author:
Blazej Bulka

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.clarkparsia.empire.SupportsRdfId
com.clarkparsia.empire.SupportsRdfId.BNodeKey, com.clarkparsia.empire.SupportsRdfId.RdfKey<T>, com.clarkparsia.empire.SupportsRdfId.URIKey
 
Field Summary
private  SSWAPType declaredTypeIntersection
          Contains a type that is intersection of all declared types.
private  java.util.Set<java.lang.String> ignoredProperties
          A set of rdf properties that is ignored (i.e., not visible to the users of this object)
private  java.util.Set<java.lang.String> ignoredTypes
           
private  SSWAPType inferredTypeIntersection
          Contains a type that is intersection of all inferred types.
private  java.util.HashMap<java.net.URI,java.util.List<SSWAPProperty>> properties
          The list of all visible SSWAPProperties of this individual.
private static java.lang.String RDF_TYPE_URI
          Constant for rdf:type property
private  java.util.Set<SSWAPType> types
          The list of all declared (told) types of this individual.
 
Constructor Summary
IndividualImpl()
          Creates an empty individual.
 
Method Summary
private  void addCloseWorldRestrictions(java.net.URI predicateURI, int count)
           
 void addComment(java.lang.String comment)
          Adds and rdfs:comment to this type.
protected  void addIgnoredProperty(java.lang.String ignoredProperty)
          Adds a new property to the list of ignored properties.
protected  void addIgnoredType(java.lang.String ignoredType)
           
 void addLabel(java.lang.String label)
          Adds an rdfs:label statement to this type.
 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.
(package private)  void addProperty(SSWAPProperty property)
           
 void addType(SSWAPType type)
          Adds a new declared type to the individual
 SSWAPIndividual asIndividual()
          Allows to safely cast this individual to SSWAPIndividual.
protected  void assertType(java.lang.String typeURI)
           
 void clearProperty(SSWAPPredicate predicate)
          Removes all property instances of the specified predicate.
 void clearProperty(java.net.URI uri)
           
(package private)  void closeWorld()
          Closing the world for all *existing* properties of the individual by adding an owl:maxCardinality restriction for each property (i.e., we are not closing the world for properties that are not known for this individual)
private  PropertyImpl createProperty(java.net.URI uri, SSWAPElement value)
          Creates a property instance for the specified predicate URI and value
private  void detachProperties(java.util.Collection<SSWAPProperty> properties)
          Detaches SSWAPProperties from this individual and source model.
private  void disableUNA(java.util.Collection<SSWAPElement> values)
           
private  void doAddProperty(SSWAPProperty property)
           
private  void doAddType(SSWAPType type)
           
private  void doRemoveProperty(SSWAPProperty property)
           
private  void doRemoveType(SSWAPType type)
           
 boolean equals(java.lang.Object o)
          Overridden equals() method.
private  void forEachProperty(com.google.common.base.Function<com.hp.hpl.jena.rdf.model.Statement,java.lang.Void> function)
          Executes a function for every non-ignored Jena property for this individual.
 SSWAPType getDeclaredType()
          Gets a single type for this individual that summarizes all the declared types.
 java.util.Collection<SSWAPType> getDeclaredTypes()
          Gets all declared (told) types of this individual.
private  java.util.Map<SSWAPProperty,SSWAPProperty> getEquivalentPropertiesMap()
           
protected  java.util.Set<java.lang.String> getIgnoredProperties()
          Gets the information about the ignored properties (hidden) from the user.
protected  java.util.Set<java.lang.String> getIgnoredTypes()
           
 SSWAPIndividual getInferredIndividual()
          Retrieves an inferred view (a copy) of the individual.
 java.util.Collection<SSWAPProperty> getProperties()
          Gets a set of properties for this object.
 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.
private  java.util.List<SSWAPProperty> getPropertyListForURI(java.net.URI name)
          Gets a list of properties from the properties map that holds all the SSWAPProperties with the given URI.
 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).
 int hashCode()
          Overridden hash code method to make sure that the generated hashcodes are consistent with the overriden equals() method.
 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 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 isIndividual()
          Allows to check whether this is a SSWAP individual.
 boolean isOfType(SSWAPType type)
          Checks whether this individual is of a given type.
private static boolean isRDGPropertyDefined(SSWAPProperty rdgProperty, java.util.Collection<SSWAPProperty> properties)
          Checks whether a property defined in the RDG is defined for this individual (or whether a subproperty of the RDG's property is defined for this individual)
private static boolean isUNADisabledWhenClosingWorld()
           
 void persist()
          Synchronizes the information stored in this individual to the underlying data source.
private  void readProperties()
          Scans the source model to find all the properties of this object, and initializes properties map.
private  void readTypes(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource resource)
          Reads the declared type information about an individual
 void refresh()
          Refreshes the information stored in this individual by rescanning the underlying data source.
private  void removeProperties()
          Removes all statements about this object that correspond to non-ignored properties.
 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 property from this individual.
 void removeType(SSWAPType type)
          Removes a type from the individual.
private  void removeTypes()
           
(package private)  void setDefaultParameterValues(IndividualImpl rdgIndividual)
          Sets the default parameter values for this individual based on the information from the individual in an RDG.
 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.
(package private)  void setProperty(SSWAPProperty property)
           
 void setSourceModel(SourceModel sourceModel)
          Sets the source model for this individual.
private  void storeProperties()
          Creates statements about all non-ignored properties.
private  void storeTypes()
           
private  void updateProperties()
          Updates the SSWAPProperties in the underlying data source.
private  void updateTypes()
           
private  void verifyReservedPredicate(SSWAPPredicate predicate)
           
 
Methods inherited from class info.sswap.impl.empire.model.ElementImpl
asBoolean, asDouble, asInteger, asList, asLiteral, asString, getComment, getJenaResource, getLabel, isAnonymous, isList, isLiteral
 
Methods inherited from class info.sswap.impl.empire.model.ModelImpl
addImport, assertModel, assertSourceModel, checkProfile, dereference, dereference, doClosure, getAllDependentObjects, getDependentObject, getDocument, getExpressivity, getImports, getInputStream, getNsPrefixMap, getReasoningService, getSourceModel, getTypeSignature, getURI, hasSourceModel, hasSourceModelWithEntityManager, isDereferenced, rdfIdEquals, rdfIdHashCode, refreshSiblings, removeImport, removeNsPrefix, serialize, serialize, setDereferenced, setNsPrefix, setURI, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface info.sswap.api.model.SSWAPIndividual
isAnonymous
 
Methods inherited from interface info.sswap.api.model.SSWAPElement
asBoolean, asDouble, asInteger, asList, asLiteral, asString, getComment, getLabel, 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
 
Methods inherited from interface com.clarkparsia.empire.SupportsRdfId
getRdfId, setRdfId
 

Field Detail

RDF_TYPE_URI

private static final java.lang.String RDF_TYPE_URI
Constant for rdf:type property

See Also:
Constant Field Values

ignoredProperties

private java.util.Set<java.lang.String> ignoredProperties
A set of rdf properties that is ignored (i.e., not visible to the users of this object)


properties

private java.util.HashMap<java.net.URI,java.util.List<SSWAPProperty>> properties
The list of all visible SSWAPProperties of this individual. Initialized by readProperties() method.


types

private java.util.Set<SSWAPType> types
The list of all declared (told) types of this individual. (It does not contain any inferred types.) Initialized by initTypes() method.


ignoredTypes

private java.util.Set<java.lang.String> ignoredTypes

declaredTypeIntersection

private SSWAPType declaredTypeIntersection
Contains a type that is intersection of all declared types. Initialized lazily by getDeclaredType() and cleared by addType() and removeType() methods.


inferredTypeIntersection

private SSWAPType inferredTypeIntersection
Contains a type that is intersection of all inferred types. Initialized lazily by getType() and cleared by addType(), and removeType(). TODO: maybe this field should also be cleared on any modification to this individual (?) -- after all the inferred type may also change based on the properties this individual has (e.g., if these properties have domain/range defined).

Constructor Detail

IndividualImpl

public IndividualImpl()
Creates an empty individual.

Method Detail

getProperties

public java.util.Collection<SSWAPProperty> getProperties()
Gets a set of properties for this object. (If the object is not dereferenced, it will return an empty set.

Specified by:
getProperties in interface SSWAPIndividual
Returns:
non-null set of properties (may be empty)

getProperty

public SSWAPProperty getProperty(SSWAPPredicate predicate)
Description copied from interface: SSWAPIndividual
Gets the property by its Predicate. If there are multiple values for the predicate, this method return only the first value.

Specified by:
getProperty in interface SSWAPIndividual
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

public java.util.Collection<SSWAPProperty> getProperties(SSWAPPredicate predicate)
Description copied from interface: SSWAPIndividual
Gets all the properties (and their values) for the predicate

Specified by:
getProperties in interface SSWAPIndividual
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

getPropertyListForURI

private java.util.List<SSWAPProperty> getPropertyListForURI(java.net.URI name)
Gets a list of properties from the properties map that holds all the SSWAPProperties with the given URI. If there is no such a key in the map, one would be created, and an empty list will be put there.

Parameters:
name - the URI of the property
Returns:
a list for the properties with the specified name.

getDeclaredTypes

public java.util.Collection<SSWAPType> getDeclaredTypes()
Gets all declared (told) types of this individual. (This method does not return any inferred types.)

Specified by:
getDeclaredTypes in interface SSWAPIndividual
Returns:
a non-null set of types (may be empty if the current individual does not have any type information).

addType

public void addType(SSWAPType type)
Description copied from interface: SSWAPIndividual
Adds a new declared type to the individual

Specified by:
addType in interface SSWAPIndividual
Parameters:
type - the type to be added

doAddType

private void doAddType(SSWAPType type)

removeType

public void removeType(SSWAPType type)
Description copied from interface: SSWAPIndividual
Removes a type from the individual. If the passed type is not a current type of this individual, this method does nothing.

Specified by:
removeType in interface SSWAPIndividual
Parameters:
type - the type to be removed.

doRemoveType

private void doRemoveType(SSWAPType type)

getDeclaredType

public SSWAPType getDeclaredType()
Description copied from interface: SSWAPIndividual
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.

Specified by:
getDeclaredType in interface SSWAPIndividual
Returns:
a single type that represents all declared types for this individual

getType

public SSWAPType getType()
Description copied from interface: SSWAPIndividual
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.

Specified by:
getType in interface SSWAPIndividual
Returns:
a single type that represents all the types for this individual

getTypes

public java.util.Collection<SSWAPType> getTypes()
Description copied from interface: SSWAPIndividual
Gets all types for this individual (including both explicitly declared types and inferred types).

Specified by:
getTypes in interface SSWAPIndividual
Returns:
a collection of all types for this individual (including explicitly declared types and inferred ones)

addProperty

void addProperty(SSWAPProperty property)

doAddProperty

private void doAddProperty(SSWAPProperty property)

setProperty

void setProperty(SSWAPProperty property)

removeProperty

public void removeProperty(SSWAPProperty property)
Removes a property from this individual.

Specified by:
removeProperty in interface SSWAPIndividual
Parameters:
property - the property to be removed
See Also:
SSWAPIndividual.removeProperty(SSWAPPredicate, SSWAPElement), SSWAPIndividual.clearProperty(SSWAPPredicate)

removeProperty

public void removeProperty(SSWAPPredicate predicate,
                           SSWAPElement value)
Description copied from interface: SSWAPIndividual
Removes a single property from this individual (property is identified by the predicate and the value)

Specified by:
removeProperty in interface SSWAPIndividual
Parameters:
predicate - the predicate for the property to be removed
value - the value for the property to be removed

doRemoveProperty

private void doRemoveProperty(SSWAPProperty property)

clearProperty

public void clearProperty(java.net.URI uri)

clearProperty

public void clearProperty(SSWAPPredicate predicate)
Description copied from interface: SSWAPIndividual
Removes all property instances of the specified predicate.

Specified by:
clearProperty in interface SSWAPIndividual
Parameters:
predicate - the predicate whose all values should be removed
See Also:
SSWAPIndividual.removeProperty(SSWAPProperty)

getEquivalentPropertiesMap

private java.util.Map<SSWAPProperty,SSWAPProperty> getEquivalentPropertiesMap()

readProperties

private void readProperties()
Scans the source model to find all the properties of this object, and initializes properties map. This method also initializes the type information for this individual (by calling initTypes())


forEachProperty

private void forEachProperty(com.google.common.base.Function<com.hp.hpl.jena.rdf.model.Statement,java.lang.Void> function)
Executes a function for every non-ignored Jena property for this individual.

Parameters:
function - the function to be executed

updateTypes

private void updateTypes()

removeTypes

private void removeTypes()

storeTypes

private void storeTypes()

updateProperties

private void updateProperties()
Updates the SSWAPProperties in the underlying data source. This consists of removing all underlying statements relating to the properties first, and then recreating them from scratch.


removeProperties

private void removeProperties()
Removes all statements about this object that correspond to non-ignored properties. (That is, after this operation, only ignored properties will remain.)


storeProperties

private void storeProperties()
Creates statements about all non-ignored properties. (It is assumed that none of such statements exist at this point.)


readTypes

private void readTypes(com.hp.hpl.jena.rdf.model.Model model,
                       com.hp.hpl.jena.rdf.model.Resource resource)
Reads the declared type information about an individual

Parameters:
model - the model containing the information about the individual
resource - the Jena resource corresponding to the individual

setSourceModel

public void setSourceModel(SourceModel sourceModel)
Sets the source model for this individual. Additionally forces a refresh when this happens to ensure proper initialization of properties and types.

Overrides:
setSourceModel in class ModelImpl
Parameters:
sourceModel - the new source model

refresh

public void refresh()
Refreshes the information stored in this individual by rescanning the underlying data source.

Overrides:
refresh in class ModelImpl

persist

public void persist()
Synchronizes the information stored in this individual to the underlying data source.

Overrides:
persist in class ModelImpl

getIgnoredProperties

protected java.util.Set<java.lang.String> getIgnoredProperties()
Gets the information about the ignored properties (hidden) from the user. This method is intentionally protected to allow subtypes to define their own sets of special properties.

Returns:
the set of URIs of ignored properties

getIgnoredTypes

protected java.util.Set<java.lang.String> getIgnoredTypes()

addIgnoredProperty

protected void addIgnoredProperty(java.lang.String ignoredProperty)
Adds a new property to the list of ignored properties. This method should be mostly called by the subclasses that wish to hide their SSWAP-specific properties (e.g., Subject's "sswap:mapsTo").

Parameters:
ignoredProperty - the URL of the property that should be ignored

addIgnoredType

protected void addIgnoredType(java.lang.String ignoredType)

asIndividual

public SSWAPIndividual asIndividual()
Allows to safely cast this individual to SSWAPIndividual. (Useful when holding a reference to this object as SSWAPElement.)

Specified by:
asIndividual in interface SSWAPElement
Overrides:
asIndividual in class ElementImpl
Returns:
a reference to this individual cast to SSWAPIndividual

isIndividual

public boolean isIndividual()
Allows to check whether this is a SSWAP individual. (It overrides the SSWAPElement.isIndividual() method, which returns false.)

Specified by:
isIndividual in interface SSWAPElement
Overrides:
isIndividual in class ElementImpl
Returns:
always true, since this is an individual

assertType

protected void assertType(java.lang.String typeURI)
                   throws ValidationException
Throws:
ValidationException

isRDGPropertyDefined

private static boolean isRDGPropertyDefined(SSWAPProperty rdgProperty,
                                            java.util.Collection<SSWAPProperty> properties)
Checks whether a property defined in the RDG is defined for this individual (or whether a subproperty of the RDG's property is defined for this individual)

Parameters:
rdgProperty - the property defined in RDG
properties - the properties defined for this individual
Returns:
true if there exists a property for this individual (incl. a subproperty) for the specified RDG property

setDefaultParameterValues

void setDefaultParameterValues(IndividualImpl rdgIndividual)
Sets the default parameter values for this individual based on the information from the individual in an RDG.

Parameters:
rdgIndividual -

isOfType

public boolean isOfType(SSWAPType type)
Description copied from interface: SSWAPIndividual
Checks whether this individual is of a given type.

Specified by:
isOfType in interface SSWAPIndividual
Parameters:
type - the type to be checked
Returns:
true if this individual is of given type, false otherwise

isCompatibleWith

public boolean isCompatibleWith(SSWAPType type)
Description copied from interface: SSWAPIndividual
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?

Specified by:
isCompatibleWith in interface SSWAPIndividual
Parameters:
type - type whose compatibility with this individual should be checked
Returns:
true if the type is compatible, false otherwise

createProperty

private PropertyImpl createProperty(java.net.URI uri,
                                    SSWAPElement value)
                             throws java.lang.IllegalArgumentException
Creates a property instance for the specified predicate URI and value

Parameters:
uri - the URI of the predicate
value - the value
Returns:
the created property
Throws:
java.lang.IllegalArgumentException - if the value is not legal for the specified predicate (e.g., literal for an object property)

addProperty

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

Specified by:
addProperty in interface SSWAPIndividual
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

public SSWAPProperty addProperty(SSWAPPredicate predicate,
                                 java.lang.String value)
                          throws java.lang.IllegalArgumentException
Description copied from interface: SSWAPIndividual
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.

Specified by:
addProperty in interface SSWAPIndividual
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

public SSWAPProperty addProperty(SSWAPPredicate predicate,
                                 java.lang.String value,
                                 java.net.URI datatype)
                          throws java.lang.IllegalArgumentException
Description copied from interface: SSWAPIndividual
Adds a property to this individual with the specified literal value with the specified datatype.

Specified by:
addProperty in interface SSWAPIndividual
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

public SSWAPProperty addProperty(SSWAPPredicate predicate,
                                 SSWAPLiteral literal)
                          throws java.lang.IllegalArgumentException
Description copied from interface: SSWAPIndividual
Adds a property to this individual with the specified literal value

Specified by:
addProperty in interface SSWAPIndividual
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

public SSWAPProperty setProperty(SSWAPPredicate predicate,
                                 SSWAPIndividual individual)
                          throws java.lang.IllegalArgumentException
Description copied from interface: SSWAPIndividual
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.

Specified by:
setProperty in interface SSWAPIndividual
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

public SSWAPProperty setProperty(SSWAPPredicate predicate,
                                 java.lang.String value)
                          throws java.lang.IllegalArgumentException
Description copied from interface: SSWAPIndividual
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.

Specified by:
setProperty in interface SSWAPIndividual
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

public SSWAPProperty setProperty(SSWAPPredicate predicate,
                                 java.lang.String value,
                                 java.net.URI datatype)
                          throws java.lang.IllegalArgumentException
Description copied from interface: SSWAPIndividual
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.

Specified by:
setProperty in interface SSWAPIndividual
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

public SSWAPProperty setProperty(SSWAPPredicate predicate,
                                 SSWAPLiteral literal)
Description copied from interface: SSWAPIndividual
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.

Specified by:
setProperty in interface SSWAPIndividual
Parameters:
predicate - the predicate for the added property
literal - value for the property
Returns:
the newly created property

hasValue

public boolean hasValue(SSWAPPredicate predicate,
                        SSWAPElement element)
Description copied from interface: SSWAPIndividual
Checks whether the individual has a property with the specified value for the predicate.

Specified by:
hasValue in interface SSWAPIndividual
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

public java.util.Collection<SSWAPProperty> hasValue(SSWAPElement element)
Description copied from interface: SSWAPIndividual
Retrieves all properties of the individual with the specified value (regardless of the predicate of these properties)

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

detachProperties

private void detachProperties(java.util.Collection<SSWAPProperty> properties)
Detaches SSWAPProperties from this individual and source model. (To be called if the SSWAPProperties are no longer used in the current individual.)

Parameters:
properties -

equals

public boolean equals(java.lang.Object o)
Overridden equals() method. For an individual, it is only equal to another individual with the same rdf identifier (URL or BNode).

Overrides:
equals in class java.lang.Object
Parameters:
o - another object to be compared for equality with this one
Returns:
true if another object is equivalent to this one, false otherwise

hashCode

public int hashCode()
Overridden hash code method to make sure that the generated hashcodes are consistent with the overriden equals() method.

Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode.

addLabel

public void addLabel(java.lang.String label)
Description copied from interface: SSWAPElement
Adds an rdfs:label statement to this type.

Specified by:
addLabel in interface SSWAPElement
Overrides:
addLabel in class ElementImpl
Parameters:
label - the label to be added

addComment

public void addComment(java.lang.String comment)
Description copied from interface: SSWAPElement
Adds and rdfs:comment to this type.

Specified by:
addComment in interface SSWAPElement
Overrides:
addComment in class ElementImpl
Parameters:
comment - the comment to be added to this type

getInferredIndividual

public SSWAPIndividual getInferredIndividual()
Description copied from interface: SSWAPIndividual
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).

Specified by:
getInferredIndividual in interface SSWAPIndividual
Returns:
an inferred view of this individual

verifyReservedPredicate

private void verifyReservedPredicate(SSWAPPredicate predicate)
                              throws java.lang.IllegalArgumentException
Throws:
java.lang.IllegalArgumentException

isUNADisabledWhenClosingWorld

private static boolean isUNADisabledWhenClosingWorld()

closeWorld

void closeWorld()
Closing the world for all *existing* properties of the individual by adding an owl:maxCardinality restriction for each property (i.e., we are not closing the world for properties that are not known for this individual)


addCloseWorldRestrictions

private void addCloseWorldRestrictions(java.net.URI predicateURI,
                                       int count)

disableUNA

private void disableUNA(java.util.Collection<SSWAPElement> values)


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