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 'atoms' of PeopleTag, people
014: *
015: * This class manages access to these properties:
016: * <ul>
017: * <li> Name </li>
018: * <li> Tag </li>
019: * <li> Knows </li>
020: * </ul>
021: *
022: * This class was generated by <a href="http://RDFReactor.semweb4j.org">RDFReactor</a> on 02.07.07 21:37
023: */
024: public class Person extends Thing {
025:
026: /** http://example.com/semweb4j#Person */
027: public static final URI RDFS_CLASS = new URIImpl(
028: "http://example.com/semweb4j#Person", false);
029:
030: /** http://example.com/semweb4j#name */
031: public static final URI NAME = new URIImpl(
032: "http://example.com/semweb4j#name", false);
033:
034: /** http://example.com/semweb4j#tag */
035: public static final URI TAG = new URIImpl(
036: "http://example.com/semweb4j#tag", false);
037:
038: /** http://example.com/semweb4j#knows */
039: public static final URI KNOWS = new URIImpl(
040: "http://example.com/semweb4j#knows", false);
041:
042: /** all property-URIs with this class as domain */
043: public static final URI[] MANAGED_URIS = {
044: new URIImpl("http://example.com/semweb4j#name", false),
045: new URIImpl("http://example.com/semweb4j#tag", false),
046: new URIImpl("http://example.com/semweb4j#knows", false) };
047:
048: // protected constructors needed for inheritance
049:
050: /**
051: * Returns a Java wrapper over an RDF object, identified by URI.
052: * Creating two wrappers for the same instanceURI is legal.
053: * @param model RDF2GO Model implementation, see http://rdf2go.semweb4j.org
054: * @param classURI URI of RDFS class
055: * @param instanceIdentifier Resource that identifies this instance
056: * @param write if true, the statement (this, rdf:type, TYPE) is written to the model
057: */
058: protected Person(Model model, URI classURI,
059: org.ontoware.rdf2go.model.node.Resource instanceIdentifier,
060: boolean write) {
061: super (model, classURI, instanceIdentifier, write);
062: }
063:
064: // public constructors
065:
066: /**
067: * Returns a Java wrapper over an RDF object, identified by URI.
068: * Creating two wrappers for the same instanceURI is legal.
069: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
070: * @param instanceIdentifier an RDF2Go Resource identifying this instance
071: * @param write if true, the statement (this, rdf:type, TYPE) is written to the model
072: */
073: public Person(Model model,
074: org.ontoware.rdf2go.model.node.Resource instanceIdentifier,
075: boolean write) {
076: super (model, RDFS_CLASS, instanceIdentifier, write);
077: }
078:
079: /**
080: * Returns a Java wrapper over an RDF object, identified by URI.
081: * Creating two wrappers for the same instanceURI is legal.
082: * The statement (this, rdf:type, TYPE) is written to the model
083: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
084: * @param uri URI of this instance
085: */
086: public Person(Model model, URI uri) {
087: this (model, uri, true);
088: }
089:
090: /**
091: * Returns a Java wrapper over an RDF object, identified by URI.
092: * Creating two wrappers for the same instanceURI is legal.
093: * The statement (this, rdf:type, TYPE) is written to the model
094: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
095: * @param uriString A URI of this instance, represented as a String
096: * @throws ModelRuntimeException if URI syntax is wrong
097: */
098: public Person(Model model, String uriString)
099: throws ModelRuntimeException {
100: this (model, new URIImpl(uriString), true);
101: }
102:
103: /**
104: * Returns a Java wrapper over an RDF object, identified by a blank node.
105: * Creating two wrappers for the same blank node is legal.
106: * The statement (this, rdf:type, TYPE) is written to the model
107: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
108: * @param bnode BlankNode of this instance
109: */
110: public Person(Model model, BlankNode bnode) {
111: this (model, bnode, true);
112: }
113:
114: /**
115: * Returns a Java wrapper over an RDF object, identified by
116: * a randomly generated URI.
117: * Creating two wrappers results in different URIs.
118: * The statement (this, rdf:type, TYPE) is written to the model
119: * @param model RDF2GO Model implementation, see http://rdf2go.ontoware.org
120: */
121: public Person(Model model) {
122: this (model, model.newRandomUniqueURI(), true);
123: }
124:
125: ///////////////////////////////////////////////////////////////////
126: // getters, setters, ...
127:
128: /**
129: * @param model RDF2Go model
130: * @param uri instance identifier
131: * @return an instance of Person or null if none existst
132: * @throws Exception if Model causes problems
133: */
134: public static Person getInstance(Model model, URI uri)
135: throws Exception {
136: return (Person) getInstance(model, uri, Person.class);
137: }
138:
139: /**
140: * @param model
141: * @param uri
142: * @return true if uri is an instance of this class in the model
143: */
144: public static boolean hasInstance(Model model, URI uri) {
145: return hasInstance(model, uri, RDFS_CLASS);
146: }
147:
148: /**
149: * @return all instances of this class
150: */
151: public Person[] getAllInstances() {
152: return (Person[]) getAllInstances(super .model, Person.class);
153: }
154:
155: /**
156: * @return all instances of this class in the given Model
157: * @param model an RDF2Go model
158: */
159: public static Person[] getAllInstances(Model model) {
160: return (Person[]) getAllInstances(model, Person.class);
161: }
162:
163: /**
164: * @return all A's that have a relation 'Knows' to this Person instance
165: */
166: public Person[] getAllKnows_Inverse() {
167: return (Person[]) getAll_Inverse(Person.KNOWS, this
168: .getResource(), Person.class);
169: }
170:
171: /**
172: * add 'Knows'-Inverse
173: * @param value
174: */
175: public void addKnows_Inverse(Person value) {
176: value.add(Person.KNOWS, this );
177: }
178:
179: /**
180: * Schema Comment: a name of a person or tag
181: * @return the only value. null if none is found
182: * @throws RDFDataException, if the property has multiple values
183: */
184: public java.lang.String getName() {
185: return (java.lang.String) get(NAME, java.lang.String.class);
186: }
187:
188: /**
189: * removes all values and sets this one
190: * @param value the value to be set
191: * Schema Comment: a name of a person or tag
192: */
193: public void setName(java.lang.String value) {
194: set(NAME, value);
195: }
196:
197: /**
198: * removes current value(s)
199: * Schema Comment: a name of a person or tag
200: */
201: public void removeName() {
202: removeAll(NAME);
203: }
204:
205: /**
206: * removes a value
207: * @param value the value to be removed
208: * Schema Comment: a name of a person or tag
209: */
210: public void removeName(java.lang.String value) {
211: remove(NAME, value);
212: }
213:
214: /**
215: * removes all values
216: * Schema Comment: a name of a person or tag
217: */
218: public void removeAllName() {
219: removeAll(NAME);
220: }
221:
222: /**
223: * @param value
224: * @return true if the model contains a statement (this, NAME, value)
225: */
226: public boolean hasName(java.lang.String value) {
227: return hasValue(NAME, value);
228: }
229:
230: /**
231: * @return true if the model contains a statement (this, NAME, *)
232: */
233: public boolean hasName() {
234: return hasValue(NAME);
235: }
236:
237: /**
238: * adds a value
239: * @param value the value to be added
240: * Schema Comment: a name of a person or tag
241: */
242: public void addName(java.lang.String value) {
243: add(NAME, value);
244: }
245:
246: /**
247: * @return all values
248: * Schema Comment: a name of a person or tag
249: */
250: public java.lang.String[] getAllName() {
251: return (java.lang.String[]) getAll(NAME, java.lang.String.class);
252: }
253:
254: /**
255: * Schema Comment: a tag which has been assigned
256: * @return the only value. null if none is found
257: * @throws RDFDataException, if the property has multiple values
258: */
259: public Tag getTag() {
260: return (Tag) get(TAG, Tag.class);
261: }
262:
263: /**
264: * removes all values and sets this one
265: * @param value the value to be set
266: * Schema Comment: a tag which has been assigned
267: */
268: public void setTag(Tag value) {
269: set(TAG, value);
270: }
271:
272: /**
273: * removes current value(s)
274: * Schema Comment: a tag which has been assigned
275: */
276: public void removeTag() {
277: removeAll(TAG);
278: }
279:
280: /**
281: * removes a value
282: * @param value the value to be removed
283: * Schema Comment: a tag which has been assigned
284: */
285: public void removeTag(Tag value) {
286: remove(TAG, value);
287: }
288:
289: /**
290: * removes all values
291: * Schema Comment: a tag which has been assigned
292: */
293: public void removeAllTag() {
294: removeAll(TAG);
295: }
296:
297: /**
298: * @param value
299: * @return true if the model contains a statement (this, TAG, value)
300: */
301: public boolean hasTag(Tag value) {
302: return hasValue(TAG, value);
303: }
304:
305: /**
306: * @return true if the model contains a statement (this, TAG, *)
307: */
308: public boolean hasTag() {
309: return hasValue(TAG);
310: }
311:
312: /**
313: * adds a value
314: * @param value the value to be added
315: * Schema Comment: a tag which has been assigned
316: */
317: public void addTag(Tag value) {
318: add(TAG, value);
319: }
320:
321: /**
322: * @return all values
323: * Schema Comment: a tag which has been assigned
324: */
325: public Tag[] getAllTag() {
326: return (Tag[]) getAll(TAG, Tag.class);
327: }
328:
329: /**
330: * Schema Comment: a (somehow, weak) known person
331: * @return the only value. null if none is found
332: * @throws RDFDataException, if the property has multiple values
333: */
334: public Person getKnows() {
335: return (Person) get(KNOWS, Person.class);
336: }
337:
338: /**
339: * removes all values and sets this one
340: * @param value the value to be set
341: * Schema Comment: a (somehow, weak) known person
342: */
343: public void setKnows(Person value) {
344: set(KNOWS, value);
345: }
346:
347: /**
348: * removes current value(s)
349: * Schema Comment: a (somehow, weak) known person
350: */
351: public void removeKnows() {
352: removeAll(KNOWS);
353: }
354:
355: /**
356: * removes a value
357: * @param value the value to be removed
358: * Schema Comment: a (somehow, weak) known person
359: */
360: public void removeKnows(Person value) {
361: remove(KNOWS, value);
362: }
363:
364: /**
365: * removes all values
366: * Schema Comment: a (somehow, weak) known person
367: */
368: public void removeAllKnows() {
369: removeAll(KNOWS);
370: }
371:
372: /**
373: * @param value
374: * @return true if the model contains a statement (this, KNOWS, value)
375: */
376: public boolean hasKnows(Person value) {
377: return hasValue(KNOWS, value);
378: }
379:
380: /**
381: * @return true if the model contains a statement (this, KNOWS, *)
382: */
383: public boolean hasKnows() {
384: return hasValue(KNOWS);
385: }
386:
387: /**
388: * adds a value
389: * @param value the value to be added
390: * Schema Comment: a (somehow, weak) known person
391: */
392: public void addKnows(Person value) {
393: add(KNOWS, value);
394: }
395:
396: /**
397: * @return all values
398: * Schema Comment: a (somehow, weak) known person
399: */
400: public Person[] getAllKnows() {
401: return (Person[]) getAll(KNOWS, Person.class);
402: }
403:
404: }
|