| java.lang.Object org.ontoware.rdfreactor.runtime.ReactorBaseImpl
All known Subclasses: org.ontoware.rdfreactor.runtime.example.Person,
ReactorBaseImpl | public class ReactorBaseImpl implements ReactorBase(Code) | | ReactorBaseImpl is the base class for instances of classes from the
RDFS/OWL schema generated by the code generator.
If a class inheriting from ReactorBaseImpl is instantiated, it represents an
instance of a class from an RDFS/OWL schema. The properties of this class
instance are stored in an RDF model using RDF2Go (via the static Bridge
object) as triples of the form: (this.instanceIdentifier, key, value).
Besides methods for putting, getting and removing properties, the Map Interface is also supported for handling of all properties of this
instance in one Map, backed by the actual RDF2Go model.
RDF Reactor uses the following naming:
resource - instance of an RDF schema class, identified by the
resource ID (an URI or BlankNode), almost all statements about the resource
use the resource ID as the object
property - a property belongs to a resource, represented by the
predicate of a statement about a resource
value - value of a property of a resource, represented by the object
of the statement with the property as predicate and the resource ID as the
subject
author: $Author: xamde $ version: $Id: ReactorBaseImpl.java,v 1.24 2006/12/05 19:47:28 xamde Exp $ |
Constructor Summary | |
public | ReactorBaseImpl(Model model, URI classURI, Resource instanceIdentifier, boolean write) Constructor: create a ReactorBaseImpl for the RDFS/OWL schema class
identified by classURI, with instanceIdentifier as the identifing URL or
BlankNode. | public | ReactorBaseImpl(Model model, URI classURI, Resource instanceIdentifier) Constructor: create a ReactorBaseImpl for the RDFS/OWL schema class
identified by classURI, with instanceIdentifier as the identifing URL or
BlankNode. |
Method Summary | |
public boolean | add(URI property, Object object) Adds a statement (this, prop, o). | public boolean | add(URI property, Object object, int maxCard) | public Object | castTo(Class> targetType) Cast .this object to the given target Java type. | public void | delete() | public boolean | equals(Object other) | public Object | get(URI prop, Class> returnType) Returns the first x in (this, prop, x) if such a statement is in the
model. | public Object[] | getAll(URI prop, Class> returnType) Returns an array of x with (this, prop, x) if such statements are in the
model. | public static Object[] | getAllInstances(Model model, Class> javaClass) Return all instances of the given class. | public static Iterator> | getAllInstancesAsIterator(Model model, Class javaClass, URI classURI) Return all instances of the given class as a SubjectResultIterator
object.
Parameters: model - -underlying RDF2Go model Parameters: javaClass - -the java class representing the class the instances whichshould be returned Parameters: classURI - -URI of the (RDFS/OWL) class. | public Set<Object> | getAll_AsSet(URI prop, Class> returnType) Get all values for the given property of this resource instance as a Set. | public Object[] | getAll_Inverse(URI property, Node o, Class> returnType) Get all resources having the given property and value. | public static Object | getInstance(Model model, URI uri, Class> javaClass) | public Model | getModel() | public URI | getRDFSClassURI() | public Resource | getResource() | public static boolean | hasInstance(Model model, URI uri, URI classURI) | public boolean | hasValue(URI prop, Object value) | public boolean | hasValue(URI prop) | public int | hashCode() | public boolean | in(Model model) | public boolean | isInstanceof(URI classURI) Check if .this object is an instance of the given RDFS/OWL class URI. | public boolean | isInstanceof(Class> javaClass) Check if .this object is an instance of the given Java class. | public boolean | remove(URI prop, Object o) Tries to remove a statement (this, prop, o). | public boolean | remove(URI prop, Object o, int minCard) | public boolean | removeAll(URI prop) | public void | set(URI prop, Object o) Removes all statements (this, prop, x) and set one anew: (this, prop, o). | public void | setAll(URI prop, Object[] o) Removes all statements (this, prop, x) and sets anew: (this, prop, o[0]),
(this, prop, o[1]), ... | public void | setAll(URI prop, Object[] o, int maxCard) Removes all statements (this, prop, x) and sets anew: (this, prop, o[0]),
(this, prop, o[1]), ... | public String | toString() implement
See Also: Object See Also: methods a string representation of the instance identifier (URI or blanknode). | public boolean | update(URI prop, Object oldValue, Object newValue) Looks for a statement (this, prop, oldValue) and replaces it by a new
statement (this, prop, newValue). |
classURI | protected URI classURI(Code) | | the URI of the RDFS class from which this object is an instance
|
model | protected Model model(Code) | | the underlying RDF2Go model in which the triples representing the
properties of this object are saved
|
ReactorBaseImpl | public ReactorBaseImpl(Model model, URI classURI, Resource instanceIdentifier, boolean write)(Code) | | Constructor: create a ReactorBaseImpl for the RDFS/OWL schema class
identified by classURI, with instanceIdentifier as the identifing URL or
BlankNode.
model,the underlying RDF2Go model classURI,URI of the RDFS/OWL class from which this object is aninstance instanceIdentifier,has to be an URI or URL or BlankNode Parameters: write - if true, the triple (this, rdf:type, classURI) is written tothe model (in addition to any other triples denotingproperties of the instance) |
ReactorBaseImpl | public ReactorBaseImpl(Model model, URI classURI, Resource instanceIdentifier)(Code) | | Constructor: create a ReactorBaseImpl for the RDFS/OWL schema class
identified by classURI, with instanceIdentifier as the identifing URL or
BlankNode. Dont write (this, rdf:type, classURI) for this instance to the
model.
model,the underlying RDF2Go model classURI,URI of the RDFS/OWL class from which this object is aninstance instanceIdentifier,has to be an URI or URL or BlankNode |
add | public boolean add(URI property, Object object)(Code) | | Adds a statement (this, prop, o). Returns false if this statement has
already been in model. True otherwise.
Parameters: property - -URI of the property Parameters: object - -value of the property true if value was already in the model |
add | public boolean add(URI property, Object object, int maxCard) throws CardinalityException(Code) | | Adds a statement (this, prop, o) if the number of statements matching
(this, prop, x) is less then maxCard
Parameters: property - -URI of the property Parameters: object - -value of the property Parameters: maxCard - -number of occurences of (this, prop, x) allowed in the model true if value was already preset throws: CardinalityException - if the resource already has more then maxCard values for theproperty |
castTo | public Object castTo(Class> targetType)(Code) | | Cast .this object to the given target Java type.
Parameters: targetType - -Java type to which to cast this object converted object |
delete | public void delete()(Code) | | Delete all statements of the form (this, *,*)
|
equals | public boolean equals(Object other)(Code) | | implement
See Also: Object See Also: methods |
get | public Object get(URI prop, Class> returnType) throws RDFDataException(Code) | | Returns the first x in (this, prop, x) if such a statement is in the
model. Null otherwise. If there are several x the first is returned
(depending on the underlying RDF store). This method is useful for
functional properties.
Parameters: prop - -URI of the property Parameters: returnType - -desired Java return type null or object typed as returnType throws: RDFDataException - |
getAll | public Object[] getAll(URI prop, Class> returnType)(Code) | | Returns an array of x with (this, prop, x) if such statements are in the
model. Null otherwise.
Parameters: prop - -URI of the property Parameters: returnType - -desired Java return type all values, array can be empty, never null |
getAllInstances | public static Object[] getAllInstances(Model model, Class> javaClass)(Code) | | Return all instances of the given class.
Parameters: model - -underlying RDF2Go model Parameters: javaClass - -the java class representing the class the instances whichshould be returned array of all instances of the given java class in the model |
getAllInstancesAsIterator | public static Iterator> getAllInstancesAsIterator(Model model, Class javaClass, URI classURI)(Code) | | Return all instances of the given class as a SubjectResultIterator
object.
Parameters: model - -underlying RDF2Go model Parameters: javaClass - -the java class representing the class the instances whichshould be returned Parameters: classURI - -URI of the (RDFS/OWL) class. currently not used SubjectResultIterator over the resulting instances |
getAll_AsSet | public Set<Object> getAll_AsSet(URI prop, Class> returnType)(Code) | | Get all values for the given property of this resource instance as a Set.
Parameters: prop - -URI of the property Parameters: returnType - -desired Java return type Set of all values for the given property |
getAll_Inverse | public Object[] getAll_Inverse(URI property, Node o, Class> returnType)(Code) | | Get all resources having the given property and value. Return x matching
(x, property, o).
Parameters: property - -URI of the property Parameters: o - -value of the property Parameters: returnType - -desired Java return type array of desired returnType representing the found resources |
getRDFSClassURI | public URI getRDFSClassURI()(Code) | | the URI of the RDFS schema class of which this object is aninstance |
getResource | public Resource getResource()(Code) | | implements
See Also: ReactorEntity |
hasInstance | public static boolean hasInstance(Model model, URI uri, URI classURI)(Code) | | |
hasValue | public boolean hasValue(URI prop, Object value)(Code) | | Parameters: prop - Parameters: value - true if the model contains the statement (this, prop, value) |
hasValue | public boolean hasValue(URI prop)(Code) | | Parameters: prop - true if the model contains any statement (this, prop, *) |
hashCode | public int hashCode()(Code) | | implement
See Also: Object See Also: methods |
isInstanceof | public boolean isInstanceof(URI classURI) throws ModelRuntimeException(Code) | | Check if .this object is an instance of the given RDFS/OWL class URI.
Parameters: classURI - -URI of the RDFS/OWL class true if .this is an instance of the given classURI |
isInstanceof | public boolean isInstanceof(Class> javaClass) throws ModelRuntimeException(Code) | | Check if .this object is an instance of the given Java class.
Parameters: javaClass - -given Java class true if .this is an instance of the given Java Class in the model |
remove | public boolean remove(URI prop, Object o)(Code) | | Tries to remove a statement (this, prop, o).
Parameters: prop - -URI of the property Parameters: o - -value of the property true, if value was present |
remove | public boolean remove(URI prop, Object o, int minCard) throws CardinalityException(Code) | | Tries to remove a statement (this, prop, o) if the number of statements
matching (this, prop, x) in the model is less then minCard
Parameters: prop - -URI of the property Parameters: o - -value of the property Parameters: minCard - -number of occurences of (this, prop, x) needed in the model true if value was found throws: CardinalityException - if resource has less then minCard values for the property |
removeAll | public boolean removeAll(URI prop)(Code) | | remove all (this, rdf:type, prop) statements
prop,Object of a Triple |
set | public void set(URI prop, Object o)(Code) | | Removes all statements (this, prop, x) and set one anew: (this, prop, o).
Parameters: prop - -URI of the property Parameters: o - -new value for the property |
setAll | public void setAll(URI prop, Object[] o) throws ModelRuntimeException(Code) | | Removes all statements (this, prop, x) and sets anew: (this, prop, o[0]),
(this, prop, o[1]), ...
Parameters: prop - -URI of the property Parameters: o - -array of new values for the property |
setAll | public void setAll(URI prop, Object[] o, int maxCard) throws ModelRuntimeException, CardinalityException(Code) | | Removes all statements (this, prop, x) and sets anew: (this, prop, o[0]),
(this, prop, o[1]), ... But only if the number of objects in o[] is less
than or equal to maxCard.
Parameters: prop - -URI of the property Parameters: o - -array of new values of the property Parameters: maxCard - -the maximum number of triples allowed to match (this, prop, x) throws: CardinalityException - throws: CardinalityException - if the size of o[] is larger then maxCard |
toString | public String toString()(Code) | | implement
See Also: Object See Also: methods a string representation of the instance identifier (URI or blanknode). Representations are dependant on the used RDF2Go adaptor. |
update | public boolean update(URI prop, Object oldValue, Object newValue)(Code) | | Looks for a statement (this, prop, oldValue) and replaces it by a new
statement (this, prop, newValue). If the first cannot be found, false is
returned, true otherwise.
Parameters: prop - -URI of the property Parameters: oldValue - -old value of the property Parameters: newValue - -new value of the property true if old value was found |
|
|