org.openanzo.jastor.inference
Class OntologyProperty

java.lang.Object
  extended by org.openanzo.jastor.inference.OntologyProperty

public class OntologyProperty
extends java.lang.Object

Represents an Ontology Property

Author:
Ben Szekely ( bhszekel@us.ibm.com )

Field Summary
static org.openrdf.model.URI DEFAULT_RANGE
          this uri is a placeholder for the default range of a property that is returned by getAllReturnTypes.
static int ROLE_EXTENSIONCLASS
          This property is defined in an extension class
static int ROLE_HERE
          This property is defined within itself
static int ROLE_LOOSE_RESTRICTION
          This property is a placeholder for a loose restriction to send downstream
 
Constructor Summary
OntologyProperty(_Property ontProperty, JastorContext ctx)
          This version of the constructor should only be use if the instance is used for utility methods on the property..i.e.
OntologyProperty(_Property ontProperty, OntologyClass ontologyClass)
          Create a new Property
 
Method Summary
 void addRestriction(Restriction res)
          Add a restriction to the property
 void addRestrictions(java.util.List<Restriction> res)
          Add a list of restrictions to the property
static java.lang.String capitalize(java.lang.String string)
          Capitalize the first letter of a String
 boolean equals(java.lang.Object o)
           
 OntologyClass getActiveClass()
          Get the ontology class begin generated.
 OntologyComment getComment()
          Get the comment info for this property
static Class getDomain(_Property ontProperty)
          Get the domain bean for the given property
 java.util.List<org.openrdf.model.Value> getHasValueValues()
          Return a list of RDFNodes that are values of hasValue for this property
 OntologyClass getOntologyClass()
          Get the ontology class that declares this property
 _Property getOntProperty()
          Get the jastor Property bean for this property
 Restriction getPrimaryRestriction()
          yields the restriction declared with the original declaration of the property
 java.lang.String getPropertyCapped()
          Return the name of the property capitalized, should be prepended for use in method names
 java.lang.String getPropertyCapped(org.openrdf.model.Resource restrictedRange)
          Return the name of the property capitalized, should be prepended for use in method names *
 java.lang.String getPropertyName()
          Return the name of the property to be used for variable names and as a prefix for vocabulary property constants
 java.lang.String getPropertyName(org.openrdf.model.Resource restrictedRange)
          Return the name of the property to be used for variable names and constants using the restricted range argument
static GraphThing getRange(_Property ontProperty)
          Get the range bean for the given property
 OntologyClass getRangeOntologyClass()
          Get the ontology class for the default range of this property
 OntologyClass getRangeOntologyClass(org.openrdf.model.Resource range)
          Get the ontology class for the given range of this property
 java.lang.String getRangeURI()
          Get the string representation of the full range datatype URI
 java.lang.String getRangeURI(org.openrdf.model.Resource res)
          Get the string representation of the full range datatype URI
 java.util.List<Restriction> getRestrictions()
          Get the list of restrictions for the property
 java.lang.String getReturnType()
          Get the string representation of the full java name of the return type for this property.
 java.lang.String getReturnType(org.openrdf.model.Resource range)
          Get the string representation of the full java name of the return type for this property.
 int getRole()
          Get the role of the property's participation in the owning class.
 java.lang.String getURI()
          Get the Property's URI
 boolean isDatatypeProperty()
          Determine if this is a Datatype property
 boolean isLooseRestriction()
          Returns whether or not this instance is a placeholder for a restriction on a property
 boolean isMultiValued()
          Determine if this property can take on multiple values
 boolean isObjectProperty()
          Determine if this is an Object property
 boolean isSingleValued()
          Determine if this property is single valued
 java.lang.Iterable<org.openrdf.model.Resource> listAllRanges()
          Return an an Iterable of Resources that represent all possible ranges for this property gathered from the entire hierarchy.
 java.lang.Iterable<org.openrdf.model.Resource> listAllRanges(boolean activeClassOnly)
          Return an an interator or Resources that represent all possible ranges for this property.
 java.lang.Iterable<org.openrdf.model.Resource> listAlternativeRanges(boolean activeClassOnly)
          Return an an Iterable of Resources that represent additional ranges for this property.
 java.lang.Iterable<org.openrdf.model.Resource> listRanges(boolean all, boolean activeClassOnly)
          Return an Iterable of ranges for this property
 java.util.Iterator<Restriction> listRestrictions()
          Get the iterator of restrictions for the property
 void setActiveClass(OntologyClass activeClass)
          Set the active class for the property
static void setDomain(_Property ontProperty, org.openrdf.model.Resource domain)
          Set the domain bean for the given property
 void setDuplicateProperty(boolean duplicateProperty)
          Set whether there can be duplicate properties
static void setRange(_Property ontProperty, org.openrdf.model.Resource range)
          Set the range bean for the given property
 void setRole(int role)
          set the role of the property
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_RANGE

public static final org.openrdf.model.URI DEFAULT_RANGE
this uri is a placeholder for the default range of a property that is returned by getAllReturnTypes. We don't use the actual default return type URI in that call because it might be null.


ROLE_HERE

public static final int ROLE_HERE
This property is defined within itself

See Also:
Constant Field Values

ROLE_EXTENSIONCLASS

public static final int ROLE_EXTENSIONCLASS
This property is defined in an extension class

See Also:
Constant Field Values

ROLE_LOOSE_RESTRICTION

public static final int ROLE_LOOSE_RESTRICTION
This property is a placeholder for a loose restriction to send downstream

See Also:
Constant Field Values
Constructor Detail

OntologyProperty

public OntologyProperty(_Property ontProperty,
                        OntologyClass ontologyClass)
                 throws JastorException
Create a new Property

Parameters:
ontProperty - the underlying Jastor property bean
ontologyClass - The parent class for this property
Throws:
JastorException

OntologyProperty

public OntologyProperty(_Property ontProperty,
                        JastorContext ctx)
                 throws JastorException
This version of the constructor should only be use if the instance is used for utility methods on the property..i.e. getName, etc...

Parameters:
ontProperty - the underlying Jastor property bean
ctx - the parent jastor context
Throws:
JastorException
Method Detail

isLooseRestriction

public boolean isLooseRestriction()
Returns whether or not this instance is a placeholder for a restriction on a property

Returns:
whether or not this instance is a placeholder for a restriction on a property

getRole

public int getRole()
Get the role of the property's participation in the owning class.

Returns:
the role of the property's participation in the owning class.

setRole

public void setRole(int role)
set the role of the property

Parameters:
role - the role of the property

getActiveClass

public OntologyClass getActiveClass()
Get the ontology class begin generated.

Returns:
the ontology class begin generated.

setActiveClass

public void setActiveClass(OntologyClass activeClass)
Set the active class for the property

Parameters:
activeClass - the active class for the property

getOntologyClass

public OntologyClass getOntologyClass()
Get the ontology class that declares this property

Returns:
the ontology class that declares this property

getOntProperty

public _Property getOntProperty()
Get the jastor Property bean for this property

Returns:
the jastor Property bean for this property

getComment

public OntologyComment getComment()
Get the comment info for this property

Returns:
the comment info for this property

getPrimaryRestriction

public Restriction getPrimaryRestriction()
yields the restriction declared with the original declaration of the property

Returns:
the restriction declared with the original declaration of the property

addRestriction

public void addRestriction(Restriction res)
Add a restriction to the property

Parameters:
res - restriction to add

addRestrictions

public void addRestrictions(java.util.List<Restriction> res)
Add a list of restrictions to the property

Parameters:
res - a list of restrictions to the property

listRestrictions

public java.util.Iterator<Restriction> listRestrictions()
Get the iterator of restrictions for the property

Returns:
the iterator of restrictions for the property

getRestrictions

public java.util.List<Restriction> getRestrictions()
Get the list of restrictions for the property

Returns:
the list of restrictions for the property

isMultiValued

public boolean isMultiValued()
Determine if this property can take on multiple values

Returns:
true if this property can take on multiple values

isSingleValued

public boolean isSingleValued()
Determine if this property is single valued

Returns:
if this property is single valued

isObjectProperty

public boolean isObjectProperty()
Determine if this is an Object property

Returns:
if this is an Object property

isDatatypeProperty

public boolean isDatatypeProperty()
Determine if this is a Datatype property

Returns:
if this is a Datatype property

getPropertyName

public java.lang.String getPropertyName()
Return the name of the property to be used for variable names and as a prefix for vocabulary property constants

Returns:
the name of the property to be used for variable names and as a prefix for vocabulary property constants

getPropertyName

public java.lang.String getPropertyName(org.openrdf.model.Resource restrictedRange)
Return the name of the property to be used for variable names and constants using the restricted range argument

Parameters:
restrictedRange - restrictedRange argument
Returns:
the name of the property to be used for variable names and constants using the restricted range argument

getPropertyCapped

public java.lang.String getPropertyCapped()
Return the name of the property capitalized, should be prepended for use in method names

Returns:
the name of the property capitalized, should be prepended for use in method names

getPropertyCapped

public java.lang.String getPropertyCapped(org.openrdf.model.Resource restrictedRange)
Return the name of the property capitalized, should be prepended for use in method names *

Parameters:
restrictedRange - restrictedRange argument
Returns:
the name of the property capitalized, should be prepended for use in method names

listRanges

public java.lang.Iterable<org.openrdf.model.Resource> listRanges(boolean all,
                                                                 boolean activeClassOnly)
Return an Iterable of ranges for this property

Parameters:
all - whether or not to include the default range in addition to all default ranges
activeClassOnly - whether or not to include ranges in the activeClass only
Returns:
an Iterable of ranges for this property

listAlternativeRanges

public java.lang.Iterable<org.openrdf.model.Resource> listAlternativeRanges(boolean activeClassOnly)
Return an an Iterable of Resources that represent additional ranges for this property. The activeClassOnly flag determines if we consider only those restrictions declared in the active class

Parameters:
activeClassOnly - only return active class ranges
Returns:
an Iterable of alternative ranges for this property

listAllRanges

public java.lang.Iterable<org.openrdf.model.Resource> listAllRanges()
Return an an Iterable of Resources that represent all possible ranges for this property gathered from the entire hierarchy. An element in the iterator will be a special Resource indicating the default return type. As such, the items in the Iterator may be used in calls to getReturnType(), getPropertyName(), and getPropertyCapped() but should not be treated as verbatim.

Returns:
an Iterable of all ranges

listAllRanges

public java.lang.Iterable<org.openrdf.model.Resource> listAllRanges(boolean activeClassOnly)
Return an an interator or Resources that represent all possible ranges for this property. the boolean parameter indicates whether we should include return types declared in the activeClass only or in the entire hiearchy. The active class is the class we are generating for. *

Parameters:
activeClassOnly - only return active class ranges
Returns:
an Iterable of all ranges

getReturnType

public java.lang.String getReturnType()
Get the string representation of the full java name of the return type for this property. The return type is based on the original range declaration of the property.

Returns:
the string representation of the full java name of the return type for this property

getReturnType

public java.lang.String getReturnType(org.openrdf.model.Resource range)
Get the string representation of the full java name of the return type for this property.

Parameters:
range - indicates an alternative range or the DEFAULT_RANGE
Returns:
the string representation of the full java name of the return type for this property

getRangeURI

public java.lang.String getRangeURI(org.openrdf.model.Resource res)
Get the string representation of the full range datatype URI

Parameters:
res - resource to get string representation
Returns:
the string representation of the full range datatype URI

getRangeURI

public java.lang.String getRangeURI()
Get the string representation of the full range datatype URI

Returns:
the string representation of the full range datatype URI

getRangeOntologyClass

public OntologyClass getRangeOntologyClass()
Get the ontology class for the default range of this property

Returns:
the ontology class for the default range of this property

getRangeOntologyClass

public OntologyClass getRangeOntologyClass(org.openrdf.model.Resource range)
Get the ontology class for the given range of this property

Parameters:
range - indicates an alternative range or the DEFAULT_RANGE
Returns:
the ontology class for the given range of this property

getHasValueValues

public java.util.List<org.openrdf.model.Value> getHasValueValues()
Return a list of RDFNodes that are values of hasValue for this property

Returns:
a list of RDFNodes that are values of hasValue for this property

setDuplicateProperty

public void setDuplicateProperty(boolean duplicateProperty)
Set whether there can be duplicate properties

Parameters:
duplicateProperty - whether there can be duplicate properties

getURI

public java.lang.String getURI()
Get the Property's URI

Returns:
the Property's URI

toString

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

equals

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

capitalize

public static java.lang.String capitalize(java.lang.String string)
Capitalize the first letter of a String

Parameters:
string - String to Capitalize
Returns:
Capitalize version of string

getRange

public static GraphThing getRange(_Property ontProperty)
Get the range bean for the given property

Parameters:
ontProperty - property to get bean
Returns:
the range bean for given property

getDomain

public static Class getDomain(_Property ontProperty)
Get the domain bean for the given property

Parameters:
ontProperty - property to get bean
Returns:
the domain bean for given property

setRange

public static void setRange(_Property ontProperty,
                            org.openrdf.model.Resource range)
Set the range bean for the given property

Parameters:
ontProperty - property to get bean
range - the range resource to set

setDomain

public static void setDomain(_Property ontProperty,
                             org.openrdf.model.Resource domain)
Set the domain bean for the given property

Parameters:
ontProperty - property to get bean
domain - the domain resource to set


Copyright © 2007 Cambridge Semantics Inc.. All Rights Reserved.