com.bbn.swede.editor.visualeditors.restriction
Class RestrictionWrapper

java.lang.Object
  extended bycom.bbn.swede.editor.visualeditors.restriction.RestrictionWrapper

public class RestrictionWrapper
extends Object

A utility class which wraps a restriction (either a Jena restriction, or an OASTNode of type Restriction), and allows for convenient access, and, in the case of an OAST Restriction, editing.

Author:
aperezlo

Nested Class Summary
(package private) static interface RestrictionWrapper.IRestrictionWrapper
          A wrapper for interacting with restrictions.
 
Field Summary
static String ALLVALUES
          Label for owl:allValuesFrom restrictions.
static String CARDINALITY
          Label for owl:cardinality restrictions.
static String HASVALUE
          Label for owl:hasValue restrictions.
static String MAX
          Label for owl:maxCardinality restrictions.
static String MIN
          Label for owl:minCardinality restrictions.
static String SOMEVALUES
          Label for owl:someValuesFrom restrictions.
 
Constructor Summary
RestrictionWrapper(Restriction wrapee)
          Creates a restriction wrapper for a restriction in an OAST.
 
Method Summary
 Object getOnProperty()
          Returns a URI (String form) or OAST Node, depending on whether this is a Jena or OAST wrapper, respectively.
 String getOnPropertyURI()
          Retrieves a String representing the URI of the property upon which this restriction applies.
 String getRestrictionType()
          Returns a string representing which type of restriction this wrapper wraps.
 Object getRestrictionTypeNode()
          Returns a Jena Statement, or an OAST Node, representing this restriction type, depending on whether this is a Jena or OAST restriction, respectively.
 String getRestrictionValueText()
          The text of the restriction.
 Object getRestrictionValueTextNode()
          Returns the node that holds the restriction value text, either as a Jena Node, or as an OAST Literal Node, depending on whether this is a Jena or OAST wrapper.
 URI getRestrictionValueURI()
          Retrieves a URI containing the reference of the restriction value, or null if it is not applicable.
 IStatus setOnPropertyURI(URI uri)
          Set this restriction's owl:OnProperty value to the URI specified by the parameter.
 IStatus setRestictionType(String type)
          Set this restriction's type to the value specified by the parameter.
 IStatus setRestrictionValueText(String text)
          Set this restriction's text value to the text specified by the parameter.
 void setRestrictionValueURI(URI uri)
          Set this restriction's value to the URI specified by the parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOMEVALUES

public static final String SOMEVALUES
Label for owl:someValuesFrom restrictions.

See Also:
Constant Field Values

ALLVALUES

public static final String ALLVALUES
Label for owl:allValuesFrom restrictions.

See Also:
Constant Field Values

HASVALUE

public static final String HASVALUE
Label for owl:hasValue restrictions.

See Also:
Constant Field Values

MIN

public static final String MIN
Label for owl:minCardinality restrictions.

See Also:
Constant Field Values

MAX

public static final String MAX
Label for owl:maxCardinality restrictions.

See Also:
Constant Field Values

CARDINALITY

public static final String CARDINALITY
Label for owl:cardinality restrictions.

See Also:
Constant Field Values
Constructor Detail

RestrictionWrapper

public RestrictionWrapper(Restriction wrapee)
Creates a restriction wrapper for a restriction in an OAST.

Parameters:
wrapee - the OAST Restriction to wrap
Method Detail

getOnProperty

public Object getOnProperty()
Returns a URI (String form) or OAST Node, depending on whether this is a Jena or OAST wrapper, respectively.

Returns:
the value of the restriction's onProperty property

getOnPropertyURI

public String getOnPropertyURI()
Retrieves a String representing the URI of the property upon which this restriction applies.

Returns:
The onProperty URI

getRestrictionType

public String getRestrictionType()
Returns a string representing which type of restriction this wrapper wraps.
Will always return one of ALLVALUES, SOMEVALUES, HASVALUE, MIN, MAX, or CARDINALITY.

Returns:
a string representation of the type of this restriction

getRestrictionTypeNode

public Object getRestrictionTypeNode()
Returns a Jena Statement, or an OAST Node, representing this restriction type, depending on whether this is a Jena or OAST restriction, respectively.

Returns:
the restriction type

getRestrictionValueText

public String getRestrictionValueText()
The text of the restriction. This is suitable for cardinality restrictions, as well as hasValue restrictions where the value is a literal.

Returns:
the value of the restriction, or null if this is not a restriction with a text value (i.e. it is a restriction with a resource value)

getRestrictionValueTextNode

public Object getRestrictionValueTextNode()
Returns the node that holds the restriction value text, either as a Jena Node, or as an OAST Literal Node, depending on whether this is a Jena or OAST wrapper.

Returns:
the value text node of this restriction.

getRestrictionValueURI

public URI getRestrictionValueURI()
Retrieves a URI containing the reference of the restriction value, or null if it is not applicable.

Returns:
The restriction value as a URI

setOnPropertyURI

public IStatus setOnPropertyURI(URI uri)
Set this restriction's owl:OnProperty value to the URI specified by the parameter. Returns an IStatus object indicating the result of the operation.
Note this method does nothing for Jena restrictions.

Parameters:
uri - the new value of the owl:OnProperty property
Returns:
IStatus.

setRestictionType

public IStatus setRestictionType(String type)
Set this restriction's type to the value specified by the parameter. Returns an IStatus object indicating the result of the operation.
Note this method does nothing for Jena restrictions.

Parameters:
type - the new type of this property
Returns:
IStatus.

setRestrictionValueText

public IStatus setRestrictionValueText(String text)
Set this restriction's text value to the text specified by the parameter. Returns an IStatus object indicating the result of the operation.
Note this method does nothing for Jena restrictions.

Parameters:
text - the new text value of this restriction (e.g. 7)
Returns:
IStatus.

setRestrictionValueURI

public void setRestrictionValueURI(URI uri)
Set this restriction's value to the URI specified by the parameter. Returns an IStatus object indicating the result of the operation.
Note this method does nothing for Jena restrictions.

Parameters:
uri - the new value of the restriction (e.g. xsd:string)


Copyright © 2004-2005 BBN Technologies. All Rights Reserved.