Class RdfModelObject

java.lang.Object
org.spdx.rdfparser.model.RdfModelObject
All Implemented Interfaces:
Cloneable, IRdfModel
Direct Known Subclasses:
Annotation, AnyLicenseInfo, Checksum, CompoundPointer, CrossRef, DoapProject, ExternalDocumentRef, ExternalRef, ReferenceType, Relationship, SinglePointer, SpdxElement

public abstract class RdfModelObject
extends Object
implements IRdfModel, Cloneable
The superclass for all classes the use the Jena RDF model. There are two different lifecycles for objects that subclass RdfModelObject: - If there is an existing model which already contains this object, use the static method RdfModelObject.createModelObject(ModelContainer container, Node node) where the node contains the property values for the class. The subclass implementations should implement the population of the Java properties from the model. From that point forward, using standard getters and setters will keep the Jena model updated along with the Java properties. - If creating a new object use the constructor and pass in the initial property values or use setters to set the property values. To populate the Jena model, invoke the method Resource createResource(IModelContainer modelContainer). This create a new resource in the model and populate the Jena model from the Java properties. Once this method has been invoked, all subsequent calls to setters will update both the Java properties and the Jena RDF property values. To implement a new RdfModelObject subclass, the following methods must be implemented: - Clone: All concrete classes must implement a clone method which will copy the Java values but not copy the model data. The clone method can be used to duplicate an RdfModelObject in a different Jena model. - getType: Return the RDF Resource that describes RDF class associated with the Java class - getUri: Returns a URI string for RDF resoures where an absolute URI is required. If null, an anonymous node is created. - populateModel: Populates the RDF model from the Java properties - equivalent: Returns true if the parameter has the same property values - A constructor of the form O(Type1 p1, Type2 p2, ...) where p1, p2, ... are Java properties to initialize the Java object. - A constructor of the form O(ModelContainer modelContainer, Node node) This class implements several common and helper methods including methods to find and set resources to the model. The methods to set a resource are named setPropertyValue while the methods to find a resource value is named findTypePropertyValue where where Type is the type of Java object to be found. If no property value is found, null is returned.
Author:
Gary O'Neall