info.sswap.impl.empire.model
Class PredicateImpl

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.PredicateImpl
All Implemented Interfaces:
com.clarkparsia.empire.SupportsRdfId, SSWAPElement, SSWAPModel, SSWAPPredicate

public class PredicateImpl
extends ElementImpl
implements SSWAPPredicate

Implementation of SSWAPPredicate. (A definition of a property.)

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 static java.util.Set<com.hp.hpl.jena.rdf.model.Property> BUILTIN_ANNOTATION_PROPS
           
private  com.clarkparsia.empire.SupportsRdfId.RdfKey rdfKey
          The RDF identifier of this type.
private  com.hp.hpl.jena.rdf.model.Resource resource
          The Jena resource that defines this type (important for fast access to type information).
 
Constructor Summary
PredicateImpl(SourceModel parent, java.net.URI uri)
          Creates a property definition.
 
Method Summary
 void addAnnotationPredicate(SSWAPPredicate predicate, SSWAPElement value)
          Annotates a predicate with the given annotation predicate.
 void addDomain(SSWAPType type)
          Adds an rdfs:domain axiom to this predicate
 void addEquivalentPredicate(SSWAPPredicate propertyDef)
          Adds an owl:equivalentProperty axiom to this predicate
 void addInverseOf(SSWAPPredicate propertyDef)
          Adds owl:inverseOf axiom to this predicate
 void addRange(SSWAPDatatype type)
          Adds an rdfs:range axiom to this predicate
 void addRange(SSWAPType type)
          Adds an rdfs:range axiom to this predicate
 void addSubPredicateOf(SSWAPPredicate propertyDef)
          Adds an rdfs:subPropertyOf axiom to this type
 void addType(SSWAPType type)
          Adds the type information to this property (i.e., whether this is a DatatypeProperty, an ObjectProperty, FunctionalProperty, InverseProperty etc.)
 boolean equals(java.lang.Object o)
           
 java.lang.String getDatatypePredicateRange()
          Gets the datatype for the range for a datatype predicate.
 java.util.Collection<java.lang.String> getDatatypePredicateRanges()
          Gets all the datatypes for the range for a datatype predicate.
 SSWAPType getDomain()
          Retrieves information about the domain of the specified predicate.
 SSWAPType getObjectPredicateRange()
          Gets the type for the range for an object predicate.
 java.util.Collection<SSWAPType> getObjectPredicateRanges()
          Gets all the types for the range for an object predicate.
 com.clarkparsia.empire.SupportsRdfId.RdfKey getRdfId()
          Gets the RDF identifier of this type.
private  ReasoningServiceImpl getReasoningServiceImpl()
           
(package private)  com.hp.hpl.jena.rdf.model.Resource getResource()
          Gets the corresponding Jena resource for this property.
 int hashCode()
          Overridden hash code method to make sure that the generated hashcodes are consistent with the overriden equals() method.
 boolean isAnnotationPredicate()
          Checks whether the given predicate is defined as an annotation predicate
 boolean isDatatypePredicate()
          Checks whether the given predicate is defined as a datatype predicate
 boolean isObjectPredicate()
          Checks whether the given predicate is defined as an object predicate
 boolean isReserved()
          Checks whether the given predicate belongs to restricted vocabulary (e.g., predicates defined in RDF, RDFS, OWL or SSWAP namespaces).
 boolean isStrictSubPredicateOf(SSWAPPredicate sup)
          Checks whether this predicate is a strict sub predicate of the other.
 boolean isSubPredicateOf(SSWAPPredicate sup)
          Checks whether this predicate is a sub predicate of other.
 void setRdfId(com.clarkparsia.empire.SupportsRdfId.RdfKey rdfKey)
          Sets the RDF identifier of this type.
 
Methods inherited from class info.sswap.impl.empire.model.ElementImpl
addComment, addLabel, asBoolean, asDouble, asIndividual, asInteger, asList, asLiteral, asString, getComment, getJenaResource, getLabel, isAnonymous, isIndividual, 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, persist, rdfIdEquals, rdfIdHashCode, refresh, refreshSiblings, removeImport, removeNsPrefix, serialize, serialize, setDereferenced, setNsPrefix, setSourceModel, 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.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
 

Field Detail

BUILTIN_ANNOTATION_PROPS

private static final java.util.Set<com.hp.hpl.jena.rdf.model.Property> BUILTIN_ANNOTATION_PROPS

rdfKey

private com.clarkparsia.empire.SupportsRdfId.RdfKey rdfKey
The RDF identifier of this type. (The types can also be anonymous classes, and therefore they may not have an URI.)


resource

private com.hp.hpl.jena.rdf.model.Resource resource
The Jena resource that defines this type (important for fast access to type information). This field is lazily initialized by getResource(). All accesses to this field should be made via the getResource() method.

Constructor Detail

PredicateImpl

public PredicateImpl(SourceModel parent,
                     java.net.URI uri)
Creates a property definition.

Parameters:
parent - the source model to which this predicate belongs
uri - the URI of the property.
Method Detail

getResource

com.hp.hpl.jena.rdf.model.Resource getResource()
Gets the corresponding Jena resource for this property. This method lazily initializes the "resource" field of this property

Returns:
Jena Resource for the predicate

getRdfId

public com.clarkparsia.empire.SupportsRdfId.RdfKey getRdfId()
Gets the RDF identifier of this type.

Specified by:
getRdfId in interface com.clarkparsia.empire.SupportsRdfId
Returns:
the RDF identifier of this type (URL or BNode identifier)

setRdfId

public void setRdfId(com.clarkparsia.empire.SupportsRdfId.RdfKey rdfKey)
Sets the RDF identifier of this type.

Specified by:
setRdfId in interface com.clarkparsia.empire.SupportsRdfId
Parameters:
rdfKey - the RDF identifier of this type (URL or BNode identifier).

addDomain

public void addDomain(SSWAPType type)
Description copied from interface: SSWAPPredicate
Adds an rdfs:domain axiom to this predicate

Specified by:
addDomain in interface SSWAPPredicate
Parameters:
type - the domain of this predicate

addEquivalentPredicate

public void addEquivalentPredicate(SSWAPPredicate propertyDef)
Description copied from interface: SSWAPPredicate
Adds an owl:equivalentProperty axiom to this predicate

Specified by:
addEquivalentPredicate in interface SSWAPPredicate
Parameters:
propertyDef - the other equivalent predicate

addInverseOf

public void addInverseOf(SSWAPPredicate propertyDef)
Description copied from interface: SSWAPPredicate
Adds owl:inverseOf axiom to this predicate

Specified by:
addInverseOf in interface SSWAPPredicate
Parameters:
propertyDef - the inverse predicate to this one

addRange

public void addRange(SSWAPType type)
Description copied from interface: SSWAPPredicate
Adds an rdfs:range axiom to this predicate

Specified by:
addRange in interface SSWAPPredicate
Parameters:
type - the domain of this predicate

addRange

public void addRange(SSWAPDatatype type)
Description copied from interface: SSWAPPredicate
Adds an rdfs:range axiom to this predicate

Specified by:
addRange in interface SSWAPPredicate
Parameters:
type - the domain of this predicate

addSubPredicateOf

public void addSubPredicateOf(SSWAPPredicate propertyDef)
Description copied from interface: SSWAPPredicate
Adds an rdfs:subPropertyOf axiom to this type

Specified by:
addSubPredicateOf in interface SSWAPPredicate
Parameters:
propertyDef - the super predicate type

addType

public void addType(SSWAPType type)
Description copied from interface: SSWAPPredicate
Adds the type information to this property (i.e., whether this is a DatatypeProperty, an ObjectProperty, FunctionalProperty, InverseProperty etc.)

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

addAnnotationPredicate

public void addAnnotationPredicate(SSWAPPredicate predicate,
                                   SSWAPElement value)
Description copied from interface: SSWAPPredicate
Annotates a predicate with the given annotation predicate.

Specified by:
addAnnotationPredicate in interface SSWAPPredicate
Parameters:
predicate - the predicate to be used in annotation

isObjectPredicate

public boolean isObjectPredicate()
Description copied from interface: SSWAPPredicate
Checks whether the given predicate is defined as an object predicate

Specified by:
isObjectPredicate in interface SSWAPPredicate
Returns:
true if the predicate is defined as an object predicate

isDatatypePredicate

public boolean isDatatypePredicate()
Description copied from interface: SSWAPPredicate
Checks whether the given predicate is defined as a datatype predicate

Specified by:
isDatatypePredicate in interface SSWAPPredicate
Returns:
true if the predicate is defined as a datatype predicate

isAnnotationPredicate

public boolean isAnnotationPredicate()
Description copied from interface: SSWAPPredicate
Checks whether the given predicate is defined as an annotation predicate

Specified by:
isAnnotationPredicate in interface SSWAPPredicate
Returns:
true if the predicate is defined as an annotation predicate

getReasoningServiceImpl

private ReasoningServiceImpl getReasoningServiceImpl()

isSubPredicateOf

public boolean isSubPredicateOf(SSWAPPredicate sup)
Description copied from interface: SSWAPPredicate
Checks whether this predicate is a sub predicate of other.

Specified by:
isSubPredicateOf in interface SSWAPPredicate
Parameters:
sup - the potential super predicate
Returns:
true if this is a subpredicate of sup

isStrictSubPredicateOf

public boolean isStrictSubPredicateOf(SSWAPPredicate sup)
Description copied from interface: SSWAPPredicate
Checks whether this predicate is a strict sub predicate of the other.

Specified by:
isStrictSubPredicateOf in interface SSWAPPredicate
Parameters:
sup - the potential strict super predicate
Returns:
true if this is a strict sub predicate of sup

getObjectPredicateRange

public SSWAPType getObjectPredicateRange()
Description copied from interface: SSWAPPredicate
Gets the type for the range for an object predicate. If the predicate has more than one type for the range, this method will return an intersection of all these types. If the range is not defined, this method will return owl:Thing.

Specified by:
getObjectPredicateRange in interface SSWAPPredicate
Returns:
the type for the range for an object predicate

getObjectPredicateRanges

public java.util.Collection<SSWAPType> getObjectPredicateRanges()
Description copied from interface: SSWAPPredicate
Gets all the types for the range for an object predicate.

Specified by:
getObjectPredicateRanges in interface SSWAPPredicate
Returns:
the collection of types for the object predicate

getDatatypePredicateRange

public java.lang.String getDatatypePredicateRange()
Description copied from interface: SSWAPPredicate
Gets the datatype for the range for a datatype predicate. In the rare case, when a datatype predicate has more than one range, this method will only return the first datatype. To retrieve all datatypes use getDatatypePredicateRanges().

Specified by:
getDatatypePredicateRange in interface SSWAPPredicate
Returns:
the URI of the datatype or null, if not known

getDatatypePredicateRanges

public java.util.Collection<java.lang.String> getDatatypePredicateRanges()
Description copied from interface: SSWAPPredicate
Gets all the datatypes for the range for a datatype predicate.

Specified by:
getDatatypePredicateRanges in interface SSWAPPredicate
Returns:
collection of URIs for the range of the datatype predicate

getDomain

public SSWAPType getDomain()
Description copied from interface: SSWAPPredicate
Retrieves information about the domain of the specified predicate. If the domain of the predicate has more than one type, this method will return an intersection of all the types in the domain. If the domain is not defined, this method will return owl:Thing.

Specified by:
getDomain in interface SSWAPPredicate
Returns:
the type for the domain of this predicate

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

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.

isReserved

public boolean isReserved()
Description copied from interface: SSWAPPredicate
Checks whether the given predicate belongs to restricted vocabulary (e.g., predicates defined in RDF, RDFS, OWL or SSWAP namespaces).

Specified by:
isReserved in interface SSWAPPredicate
Returns:
true if the predicate belongs to restricted vocabulary.


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