001: /**
002: * generated by http://RDFReactor.semweb4j.org ($Id: CodeGenerator.java 785 2007-05-31 15:47:01Z voelkel $) on 02.07.07 21:37
003: */package org.ontoware.semweb4j.lessons.lesson5.gen;
004:
005: import org.ontoware.rdf2go.exception.ModelRuntimeException;
006: import org.ontoware.rdf2go.model.Model;
007: import org.ontoware.rdf2go.model.node.BlankNode;
008: import org.ontoware.rdf2go.model.node.URI;
009: import org.ontoware.rdf2go.model.node.impl.URIImpl;
010:
011: /**
012: * This class acts as a catch-all for all properties, for which no domain has specified.
013: *
014: * This class was generated by <a href="http://RDFReactor.semweb4j.org">RDFReactor</a> on 02.07.07 21:37
015: */
016: public class Thing extends
017: org.ontoware.rdfreactor.schema.rdfschema.Class {
018:
019: /** http://www.w3.org/2000/01/rdf-schema#Class */
020: public static final URI RDFS_CLASS = new URIImpl(
021: "http://www.w3.org/2000/01/rdf-schema#Class", false);
022:
023: /** all property-URIs with this class as domain */
024: public static final URI[] MANAGED_URIS = {
025:
026: };
027:
028: // protected constructors needed for inheritance
029:
030: /**
031: * Returns a Java wrapper over an RDF object, identified by URI.
032: * Creating two wrappers for the same instanceURI is legal.
033: * @param model RDF2GO Model implementation, see http://rdf2go.semweb4j.org
034: * @param classURI URI of RDFS class
035: * @param instanceIdentifier Resource that identifies this instance
036: * @param write if true, the statement (this, rdf:type, TYPE) is written to the model
037: */
038: protected Thing(Model model, URI classURI,
039: org.ontoware.rdf2go.model.node.Resource instanceIdentifier,
040: boolean write) {
041: super (model, classURI, instanceIdentifier, write);
042: }
043:
044: // public constructors
045:
046: /**
047: * Returns a Java wrapper over an RDF object, identified by URI.
048: * Creating two wrappers for the same instanceURI is legal.
049: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
050: * @param instanceIdentifier an RDF2Go Resource identifying this instance
051: * @param write if true, the statement (this, rdf:type, TYPE) is written to the model
052: */
053: public Thing(Model model,
054: org.ontoware.rdf2go.model.node.Resource instanceIdentifier,
055: boolean write) {
056: super (model, RDFS_CLASS, instanceIdentifier, write);
057: }
058:
059: /**
060: * Returns a Java wrapper over an RDF object, identified by URI.
061: * Creating two wrappers for the same instanceURI is legal.
062: * The statement (this, rdf:type, TYPE) is written to the model
063: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
064: * @param uri URI of this instance
065: */
066: public Thing(Model model, URI uri) {
067: this (model, uri, true);
068: }
069:
070: /**
071: * Returns a Java wrapper over an RDF object, identified by URI.
072: * Creating two wrappers for the same instanceURI is legal.
073: * The statement (this, rdf:type, TYPE) is written to the model
074: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
075: * @param uriString A URI of this instance, represented as a String
076: * @throws ModelRuntimeException if URI syntax is wrong
077: */
078: public Thing(Model model, String uriString)
079: throws ModelRuntimeException {
080: this (model, new URIImpl(uriString), true);
081: }
082:
083: /**
084: * Returns a Java wrapper over an RDF object, identified by a blank node.
085: * Creating two wrappers for the same blank node is legal.
086: * The statement (this, rdf:type, TYPE) is written to the model
087: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
088: * @param bnode BlankNode of this instance
089: */
090: public Thing(Model model, BlankNode bnode) {
091: this (model, bnode, true);
092: }
093:
094: /**
095: * Returns a Java wrapper over an RDF object, identified by
096: * a randomly generated URI.
097: * Creating two wrappers results in different URIs.
098: * The statement (this, rdf:type, TYPE) is written to the model
099: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
100: */
101: public Thing(Model model) {
102: this (model, model.newRandomUniqueURI(), true);
103: }
104:
105: ///////////////////////////////////////////////////////////////////
106: // getters, setters, ...
107:
108: /**
109: * @param model RDF2Go model
110: * @param uri instance identifier
111: * @return an instance of Thing or null if none existst
112: * @throws Exception if Model causes problems
113: */
114: public static Thing getInstance(Model model, URI uri)
115: throws Exception {
116: return (Thing) getInstance(model, uri, Thing.class);
117: }
118:
119: /**
120: * @param model
121: * @param uri
122: * @return true if uri is an instance of this class in the model
123: */
124: public static boolean hasInstance(Model model, URI uri) {
125: return hasInstance(model, uri, RDFS_CLASS);
126: }
127:
128: /**
129: * @return all instances of this class
130: */
131: public Thing[] getAllInstances() {
132: return (Thing[]) getAllInstances(super .model, Thing.class);
133: }
134:
135: /**
136: * @return all instances of this class in the given Model
137: * @param model an RDF2Go model
138: */
139: public static Thing[] getAllInstances(Model model) {
140: return (Thing[]) getAllInstances(model, Thing.class);
141: }
142:
143: }
|