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: import org.ontoware.rdfreactor.runtime.RDFDataException;
011:
012: /**
013: * the tags which are assigned to people
014: *
015: * This class manages access to these properties:
016: * <ul>
017: * <li> Name </li>
018: * </ul>
019: *
020: * This class was generated by <a href="http://RDFReactor.semweb4j.org">RDFReactor</a> on 02.07.07 21:37
021: */
022: public class Tag extends Thing {
023:
024: /** http://example.com/semweb4j#Tag */
025: public static final URI RDFS_CLASS = new URIImpl(
026: "http://example.com/semweb4j#Tag", false);
027:
028: /** http://example.com/semweb4j#name */
029: public static final URI NAME = new URIImpl(
030: "http://example.com/semweb4j#name", false);
031:
032: /** all property-URIs with this class as domain */
033: public static final URI[] MANAGED_URIS = { new URIImpl(
034: "http://example.com/semweb4j#name", false) };
035:
036: // protected constructors needed for inheritance
037:
038: /**
039: * Returns a Java wrapper over an RDF object, identified by URI.
040: * Creating two wrappers for the same instanceURI is legal.
041: * @param model RDF2GO Model implementation, see http://rdf2go.semweb4j.org
042: * @param classURI URI of RDFS class
043: * @param instanceIdentifier Resource that identifies this instance
044: * @param write if true, the statement (this, rdf:type, TYPE) is written to the model
045: */
046: protected Tag(Model model, URI classURI,
047: org.ontoware.rdf2go.model.node.Resource instanceIdentifier,
048: boolean write) {
049: super (model, classURI, instanceIdentifier, write);
050: }
051:
052: // public constructors
053:
054: /**
055: * Returns a Java wrapper over an RDF object, identified by URI.
056: * Creating two wrappers for the same instanceURI is legal.
057: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
058: * @param instanceIdentifier an RDF2Go Resource identifying this instance
059: * @param write if true, the statement (this, rdf:type, TYPE) is written to the model
060: */
061: public Tag(Model model,
062: org.ontoware.rdf2go.model.node.Resource instanceIdentifier,
063: boolean write) {
064: super (model, RDFS_CLASS, instanceIdentifier, write);
065: }
066:
067: /**
068: * Returns a Java wrapper over an RDF object, identified by URI.
069: * Creating two wrappers for the same instanceURI is legal.
070: * The statement (this, rdf:type, TYPE) is written to the model
071: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
072: * @param uri URI of this instance
073: */
074: public Tag(Model model, URI uri) {
075: this (model, uri, true);
076: }
077:
078: /**
079: * Returns a Java wrapper over an RDF object, identified by URI.
080: * Creating two wrappers for the same instanceURI is legal.
081: * The statement (this, rdf:type, TYPE) is written to the model
082: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
083: * @param uriString A URI of this instance, represented as a String
084: * @throws ModelRuntimeException if URI syntax is wrong
085: */
086: public Tag(Model model, String uriString)
087: throws ModelRuntimeException {
088: this (model, new URIImpl(uriString), true);
089: }
090:
091: /**
092: * Returns a Java wrapper over an RDF object, identified by a blank node.
093: * Creating two wrappers for the same blank node is legal.
094: * The statement (this, rdf:type, TYPE) is written to the model
095: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
096: * @param bnode BlankNode of this instance
097: */
098: public Tag(Model model, BlankNode bnode) {
099: this (model, bnode, true);
100: }
101:
102: /**
103: * Returns a Java wrapper over an RDF object, identified by
104: * a randomly generated URI.
105: * Creating two wrappers results in different URIs.
106: * The statement (this, rdf:type, TYPE) is written to the model
107: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
108: */
109: public Tag(Model model) {
110: this (model, model.newRandomUniqueURI(), true);
111: }
112:
113: ///////////////////////////////////////////////////////////////////
114: // getters, setters, ...
115:
116: /**
117: * @param model RDF2Go model
118: * @param uri instance identifier
119: * @return an instance of Tag or null if none existst
120: * @throws Exception if Model causes problems
121: */
122: public static Tag getInstance(Model model, URI uri)
123: throws Exception {
124: return (Tag) getInstance(model, uri, Tag.class);
125: }
126:
127: /**
128: * @param model
129: * @param uri
130: * @return true if uri is an instance of this class in the model
131: */
132: public static boolean hasInstance(Model model, URI uri) {
133: return hasInstance(model, uri, RDFS_CLASS);
134: }
135:
136: /**
137: * @return all instances of this class
138: */
139: public Tag[] getAllInstances() {
140: return (Tag[]) getAllInstances(super .model, Tag.class);
141: }
142:
143: /**
144: * @return all instances of this class in the given Model
145: * @param model an RDF2Go model
146: */
147: public static Tag[] getAllInstances(Model model) {
148: return (Tag[]) getAllInstances(model, Tag.class);
149: }
150:
151: /**
152: * @return all A's that have a relation 'Tag' to this Tag instance
153: */
154: public Person[] getAllTag_Inverse() {
155: return (Person[]) getAll_Inverse(Person.TAG,
156: this .getResource(), Person.class);
157: }
158:
159: /**
160: * add 'Tag'-Inverse
161: * @param value
162: */
163: public void addTag_Inverse(Person value) {
164: value.add(Person.TAG, this );
165: }
166:
167: /**
168: * Schema Comment: a name of a person or tag
169: * @return the only value. null if none is found
170: * @throws RDFDataException, if the property has multiple values
171: */
172: public java.lang.String getName() {
173: return (java.lang.String) get(NAME, java.lang.String.class);
174: }
175:
176: /**
177: * removes all values and sets this one
178: * @param value the value to be set
179: * Schema Comment: a name of a person or tag
180: */
181: public void setName(java.lang.String value) {
182: set(NAME, value);
183: }
184:
185: /**
186: * removes current value(s)
187: * Schema Comment: a name of a person or tag
188: */
189: public void removeName() {
190: removeAll(NAME);
191: }
192:
193: /**
194: * removes a value
195: * @param value the value to be removed
196: * Schema Comment: a name of a person or tag
197: */
198: public void removeName(java.lang.String value) {
199: remove(NAME, value);
200: }
201:
202: /**
203: * removes all values
204: * Schema Comment: a name of a person or tag
205: */
206: public void removeAllName() {
207: removeAll(NAME);
208: }
209:
210: /**
211: * @param value
212: * @return true if the model contains a statement (this, NAME, value)
213: */
214: public boolean hasName(java.lang.String value) {
215: return hasValue(NAME, value);
216: }
217:
218: /**
219: * @return true if the model contains a statement (this, NAME, *)
220: */
221: public boolean hasName() {
222: return hasValue(NAME);
223: }
224:
225: /**
226: * adds a value
227: * @param value the value to be added
228: * Schema Comment: a name of a person or tag
229: */
230: public void addName(java.lang.String value) {
231: add(NAME, value);
232: }
233:
234: /**
235: * @return all values
236: * Schema Comment: a name of a person or tag
237: */
238: public java.lang.String[] getAllName() {
239: return (java.lang.String[]) getAll(NAME, java.lang.String.class);
240: }
241:
242: }
|