1 package olr.om;
2
3 import java.sql.Connection;
4 import java.sql.SQLException;
5 import java.util.ArrayList;
6 import java.util.LinkedList;
7 import java.util.List;
8
9 import olr.om.map.RdfStatementMapBuilder;
10
11 import org.apache.torque.NoRowsException;
12 import org.apache.torque.TooManyRowsException;
13 import org.apache.torque.Torque;
14 import org.apache.torque.TorqueException;
15 import org.apache.torque.map.MapBuilder;
16 import org.apache.torque.map.TableMap;
17 import org.apache.torque.om.ObjectKey;
18 import org.apache.torque.om.SimpleKey;
19 import org.apache.torque.util.BasePeer;
20 import org.apache.torque.util.Criteria;
21
22 import com.workingdogs.village.DataSetException;
23 import com.workingdogs.village.QueryDataSet;
24 import com.workingdogs.village.Record;
25
26
27
28
29
30
31
32 /***
33 * This class was autogenerated by Torque on:
34 *
35 * [Tue Jul 13 14:47:47 CEST 2004]
36 *
37 */
38 public abstract class BaseRdfStatementPeer
39 extends BasePeer
40 {
41
42 /*** the default database name for this class */
43 public static final String DATABASE_NAME = "default";
44
45 /*** the table name for this class */
46 public static final String TABLE_NAME = "rdf_statement";
47
48 /***
49 * @return the map builder for this peer
50 * @throws TorqueException Any exceptions caught during processing will be
51 * rethrown wrapped into a TorqueException.
52 */
53 public static MapBuilder getMapBuilder()
54 throws TorqueException
55 {
56 return getMapBuilder(RdfStatementMapBuilder.CLASS_NAME);
57 }
58
59 /*** the column name for the ID field */
60 public static final String ID;
61 /*** the column name for the SUBJECT field */
62 public static final String SUBJECT;
63 /*** the column name for the PREDICATE field */
64 public static final String PREDICATE;
65 /*** the column name for the OBJ_RESOURCE field */
66 public static final String OBJ_RESOURCE;
67 /*** the column name for the OBJ_LITERAL field */
68 public static final String OBJ_LITERAL;
69 /*** the column name for the RES field */
70 public static final String RES;
71 /*** the column name for the USR field */
72 public static final String USR;
73 /*** the column name for the ISPUBLIC field */
74 public static final String ISPUBLIC;
75 /*** the column name for the MODIFIED field */
76 public static final String MODIFIED;
77 /*** the column name for the GARBAGE field */
78 public static final String GARBAGE;
79
80 static
81 {
82 ID = "rdf_statement.ID";
83 SUBJECT = "rdf_statement.SUBJECT";
84 PREDICATE = "rdf_statement.PREDICATE";
85 OBJ_RESOURCE = "rdf_statement.OBJ_RESOURCE";
86 OBJ_LITERAL = "rdf_statement.OBJ_LITERAL";
87 RES = "rdf_statement.RES";
88 USR = "rdf_statement.USR";
89 ISPUBLIC = "rdf_statement.ISPUBLIC";
90 MODIFIED = "rdf_statement.MODIFIED";
91 GARBAGE = "rdf_statement.GARBAGE";
92 if (Torque.isInit())
93 {
94 try
95 {
96 getMapBuilder(RdfStatementMapBuilder.CLASS_NAME);
97 }
98 catch (Exception e)
99 {
100 log.error("Could not initialize Peer", e);
101 }
102 }
103 else
104 {
105 Torque.registerMapBuilder(RdfStatementMapBuilder.CLASS_NAME);
106 }
107 }
108
109 /*** number of columns for this peer */
110 public static final int numColumns = 10;
111
112 /*** A class that can be returned by this peer. */
113 protected static final String CLASSNAME_DEFAULT =
114 "olr.om.RdfStatement";
115
116 /*** A class that can be returned by this peer. */
117 protected static final Class CLASS_DEFAULT = initClass(CLASSNAME_DEFAULT);
118
119 /***
120 * Class object initialization method.
121 *
122 * @param className name of the class to initialize
123 * @return the initialized class
124 */
125 private static Class initClass(String className)
126 {
127 Class c = null;
128 try
129 {
130 c = Class.forName(className);
131 }
132 catch (Throwable t)
133 {
134 log.error("A FATAL ERROR has occurred which should not "
135 + "have happened under any circumstance. Please notify "
136 + "the Torque developers <torque-dev@db.apache.org> "
137 + "and give as many details as possible (including the error "
138 + "stack trace).", t);
139
140
141 if (t instanceof Error)
142 {
143 throw (Error) t.fillInStackTrace();
144 }
145 }
146 return c;
147 }
148
149 /***
150 * Get the list of objects for a ResultSet. Please not that your
151 * resultset MUST return columns in the right order. You can use
152 * getFieldNames() in BaseObject to get the correct sequence.
153 *
154 * @param results the ResultSet
155 * @return the list of objects
156 * @throws TorqueException Any exceptions caught during processing will be
157 * rethrown wrapped into a TorqueException.
158 */
159 public static List resultSet2Objects(java.sql.ResultSet results)
160 throws TorqueException
161 {
162 try
163 {
164 QueryDataSet qds = null;
165 List rows = null;
166 try
167 {
168 qds = new QueryDataSet(results);
169 rows = getSelectResults(qds);
170 }
171 finally
172 {
173 if (qds != null)
174 {
175 qds.close();
176 }
177 }
178
179 return populateObjects(rows);
180 }
181 catch (SQLException e)
182 {
183 throw new TorqueException(e);
184 }
185 catch (DataSetException e)
186 {
187 throw new TorqueException(e);
188 }
189 }
190
191
192
193 /***
194 * Method to do inserts.
195 *
196 * @param criteria object used to create the INSERT statement.
197 * @throws TorqueException Any exceptions caught during processing will be
198 * rethrown wrapped into a TorqueException.
199 */
200 public static ObjectKey doInsert(Criteria criteria)
201 throws TorqueException
202 {
203 return BaseRdfStatementPeer
204 .doInsert(criteria, (Connection) null);
205 }
206
207 /***
208 * Method to do inserts. This method is to be used during a transaction,
209 * otherwise use the doInsert(Criteria) method. It will take care of
210 * the connection details internally.
211 *
212 * @param criteria object used to create the INSERT statement.
213 * @param con the connection to use
214 * @throws TorqueException Any exceptions caught during processing will be
215 * rethrown wrapped into a TorqueException.
216 */
217 public static ObjectKey doInsert(Criteria criteria, Connection con)
218 throws TorqueException
219 {
220
221
222
223
224 if (criteria.getDbName() == Torque.getDefaultDB())
225 {
226 criteria.setDbName(DATABASE_NAME);
227 }
228 if (con == null)
229 {
230 return BasePeer.doInsert(criteria);
231 }
232 else
233 {
234 return BasePeer.doInsert(criteria, con);
235 }
236 }
237
238 /***
239 * Add all the columns needed to create a new object.
240 *
241 * @param criteria object containing the columns to add.
242 * @throws TorqueException Any exceptions caught during processing will be
243 * rethrown wrapped into a TorqueException.
244 */
245 public static void addSelectColumns(Criteria criteria)
246 throws TorqueException
247 {
248 criteria.addSelectColumn(ID);
249 criteria.addSelectColumn(SUBJECT);
250 criteria.addSelectColumn(PREDICATE);
251 criteria.addSelectColumn(OBJ_RESOURCE);
252 criteria.addSelectColumn(OBJ_LITERAL);
253 criteria.addSelectColumn(RES);
254 criteria.addSelectColumn(USR);
255 criteria.addSelectColumn(ISPUBLIC);
256 criteria.addSelectColumn(MODIFIED);
257 criteria.addSelectColumn(GARBAGE);
258 }
259
260 /***
261 * Create a new object of type cls from a resultset row starting
262 * from a specified offset. This is done so that you can select
263 * other rows than just those needed for this object. You may
264 * for example want to create two objects from the same row.
265 *
266 * @throws TorqueException Any exceptions caught during processing will be
267 * rethrown wrapped into a TorqueException.
268 */
269 public static RdfStatement row2Object(Record row,
270 int offset,
271 Class cls)
272 throws TorqueException
273 {
274 try
275 {
276 RdfStatement obj = (RdfStatement) cls.newInstance();
277 RdfStatementPeer.populateObject(row, offset, obj);
278 obj.setModified(false);
279 obj.setNew(false);
280
281 return obj;
282 }
283 catch (InstantiationException e)
284 {
285 throw new TorqueException(e);
286 }
287 catch (IllegalAccessException e)
288 {
289 throw new TorqueException(e);
290 }
291 }
292
293 /***
294 * Populates an object from a resultset row starting
295 * from a specified offset. This is done so that you can select
296 * other rows than just those needed for this object. You may
297 * for example want to create two objects from the same row.
298 *
299 * @throws TorqueException Any exceptions caught during processing will be
300 * rethrown wrapped into a TorqueException.
301 */
302 public static void populateObject(Record row,
303 int offset,
304 RdfStatement obj)
305 throws TorqueException
306 {
307 try
308 {
309 obj.setId(row.getValue(offset + 0).asInt());
310 obj.setSubject(row.getValue(offset + 1).asInt());
311 obj.setPredicate(row.getValue(offset + 2).asInt());
312 obj.setObjResource(row.getValue(offset + 3).asInt());
313 obj.setObjLiteral(row.getValue(offset + 4).asInt());
314 obj.setRes(row.getValue(offset + 5).asString());
315 obj.setUsr(row.getValue(offset + 6).asInt());
316 obj.setIspublic(row.getValue(offset + 7).asString());
317 obj.setModified(row.getValue(offset + 8).asUtilDate());
318 obj.setGarbage(row.getValue(offset + 9).asLong());
319 }
320 catch (DataSetException e)
321 {
322 throw new TorqueException(e);
323 }
324 }
325
326 /***
327 * Method to do selects.
328 *
329 * @param criteria object used to create the SELECT statement.
330 * @return List of selected Objects
331 * @throws TorqueException Any exceptions caught during processing will be
332 * rethrown wrapped into a TorqueException.
333 */
334 public static List doSelect(Criteria criteria) throws TorqueException
335 {
336 return populateObjects(doSelectVillageRecords(criteria));
337 }
338
339 /***
340 * Method to do selects within a transaction.
341 *
342 * @param criteria object used to create the SELECT statement.
343 * @param con the connection to use
344 * @return List of selected Objects
345 * @throws TorqueException Any exceptions caught during processing will be
346 * rethrown wrapped into a TorqueException.
347 */
348 public static List doSelect(Criteria criteria, Connection con)
349 throws TorqueException
350 {
351 return populateObjects(doSelectVillageRecords(criteria, con));
352 }
353
354 /***
355 * Grabs the raw Village records to be formed into objects.
356 * This method handles connections internally. The Record objects
357 * returned by this method should be considered readonly. Do not
358 * alter the data and call save(), your results may vary, but are
359 * certainly likely to result in hard to track MT bugs.
360 *
361 * @throws TorqueException Any exceptions caught during processing will be
362 * rethrown wrapped into a TorqueException.
363 */
364 public static List doSelectVillageRecords(Criteria criteria)
365 throws TorqueException
366 {
367 return BaseRdfStatementPeer
368 .doSelectVillageRecords(criteria, (Connection) null);
369 }
370
371 /***
372 * Grabs the raw Village records to be formed into objects.
373 * This method should be used for transactions
374 *
375 * @param con the connection to use
376 * @throws TorqueException Any exceptions caught during processing will be
377 * rethrown wrapped into a TorqueException.
378 */
379 public static List doSelectVillageRecords(Criteria criteria, Connection con)
380 throws TorqueException
381 {
382 if (criteria.getSelectColumns().size() == 0)
383 {
384 addSelectColumns(criteria);
385 }
386
387
388
389
390
391 if (criteria.getDbName() == Torque.getDefaultDB())
392 {
393 criteria.setDbName(DATABASE_NAME);
394 }
395
396
397 if (con == null)
398 {
399 return BasePeer.doSelect(criteria);
400 }
401 else
402 {
403 return BasePeer.doSelect(criteria, con);
404 }
405 }
406
407 /***
408 * The returned List will contain objects of the default type or
409 * objects that inherit from the default.
410 *
411 * @throws TorqueException Any exceptions caught during processing will be
412 * rethrown wrapped into a TorqueException.
413 */
414 public static List populateObjects(List records)
415 throws TorqueException
416 {
417 List results = new ArrayList(records.size());
418
419
420 for (int i = 0; i < records.size(); i++)
421 {
422 Record row = (Record) records.get(i);
423 results.add(RdfStatementPeer.row2Object(row, 1,
424 RdfStatementPeer.getOMClass()));
425 }
426 return results;
427 }
428
429
430 /***
431 * The class that the Peer will make instances of.
432 * If the BO is abstract then you must implement this method
433 * in the BO.
434 *
435 * @throws TorqueException Any exceptions caught during processing will be
436 * rethrown wrapped into a TorqueException.
437 */
438 public static Class getOMClass()
439 throws TorqueException
440 {
441 return CLASS_DEFAULT;
442 }
443
444 /***
445 * Method to do updates.
446 *
447 * @param criteria object containing data that is used to create the UPDATE
448 * statement.
449 * @throws TorqueException Any exceptions caught during processing will be
450 * rethrown wrapped into a TorqueException.
451 */
452 public static void doUpdate(Criteria criteria) throws TorqueException
453 {
454 BaseRdfStatementPeer
455 .doUpdate(criteria, (Connection) null);
456 }
457
458 /***
459 * Method to do updates. This method is to be used during a transaction,
460 * otherwise use the doUpdate(Criteria) method. It will take care of
461 * the connection details internally.
462 *
463 * @param criteria object containing data that is used to create the UPDATE
464 * statement.
465 * @param con the connection to use
466 * @throws TorqueException Any exceptions caught during processing will be
467 * rethrown wrapped into a TorqueException.
468 */
469 public static void doUpdate(Criteria criteria, Connection con)
470 throws TorqueException
471 {
472 Criteria selectCriteria = new Criteria(DATABASE_NAME, 2);
473 selectCriteria.put(ID, criteria.remove(ID));
474
475
476
477
478 if (criteria.getDbName() == Torque.getDefaultDB())
479 {
480 criteria.setDbName(DATABASE_NAME);
481 }
482 if (con == null)
483 {
484 BasePeer.doUpdate(selectCriteria, criteria);
485 }
486 else
487 {
488 BasePeer.doUpdate(selectCriteria, criteria, con);
489 }
490 }
491
492 /***
493 * Method to do deletes.
494 *
495 * @param criteria object containing data that is used DELETE from database.
496 * @throws TorqueException Any exceptions caught during processing will be
497 * rethrown wrapped into a TorqueException.
498 */
499 public static void doDelete(Criteria criteria) throws TorqueException
500 {
501 BaseRdfStatementPeer
502 .doDelete(criteria, (Connection) null);
503 }
504
505 /***
506 * Method to do deletes. This method is to be used during a transaction,
507 * otherwise use the doDelete(Criteria) method. It will take care of
508 * the connection details internally.
509 *
510 * @param criteria object containing data that is used DELETE from database.
511 * @param con the connection to use
512 * @throws TorqueException Any exceptions caught during processing will be
513 * rethrown wrapped into a TorqueException.
514 */
515 public static void doDelete(Criteria criteria, Connection con)
516 throws TorqueException
517 {
518
519
520
521
522 if (criteria.getDbName() == Torque.getDefaultDB())
523 {
524 criteria.setDbName(DATABASE_NAME);
525 }
526 if (con == null)
527 {
528 BasePeer.doDelete(criteria);
529 }
530 else
531 {
532 BasePeer.doDelete(criteria, con);
533 }
534 }
535
536 /***
537 * Method to do selects
538 *
539 * @throws TorqueException Any exceptions caught during processing will be
540 * rethrown wrapped into a TorqueException.
541 */
542 public static List doSelect(RdfStatement obj) throws TorqueException
543 {
544 return doSelect(buildCriteria(obj));
545 }
546
547 /***
548 * Method to do inserts
549 *
550 * @throws TorqueException Any exceptions caught during processing will be
551 * rethrown wrapped into a TorqueException.
552 */
553 public static void doInsert(RdfStatement obj) throws TorqueException
554 {
555 obj.setPrimaryKey(doInsert(buildCriteria(obj)));
556 obj.setNew(false);
557 obj.setModified(false);
558 }
559
560 /***
561 * @param obj the data object to update in the database.
562 * @throws TorqueException Any exceptions caught during processing will be
563 * rethrown wrapped into a TorqueException.
564 */
565 public static void doUpdate(RdfStatement obj) throws TorqueException
566 {
567 doUpdate(buildCriteria(obj));
568 obj.setModified(false);
569 }
570
571 /***
572 * @param obj the data object to delete in the database.
573 * @throws TorqueException Any exceptions caught during processing will be
574 * rethrown wrapped into a TorqueException.
575 */
576 public static void doDelete(RdfStatement obj) throws TorqueException
577 {
578 doDelete(buildCriteria(obj));
579 }
580
581 /***
582 * Method to do inserts. This method is to be used during a transaction,
583 * otherwise use the doInsert(RdfStatement) method. It will take
584 * care of the connection details internally.
585 *
586 * @param obj the data object to insert into the database.
587 * @param con the connection to use
588 * @throws TorqueException Any exceptions caught during processing will be
589 * rethrown wrapped into a TorqueException.
590 */
591 public static void doInsert(RdfStatement obj, Connection con)
592 throws TorqueException
593 {
594 obj.setPrimaryKey(doInsert(buildCriteria(obj), con));
595 obj.setNew(false);
596 obj.setModified(false);
597 }
598
599 /***
600 * Method to do update. This method is to be used during a transaction,
601 * otherwise use the doUpdate(RdfStatement) method. It will take
602 * care of the connection details internally.
603 *
604 * @param obj the data object to update in the database.
605 * @param con the connection to use
606 * @throws TorqueException Any exceptions caught during processing will be
607 * rethrown wrapped into a TorqueException.
608 */
609 public static void doUpdate(RdfStatement obj, Connection con)
610 throws TorqueException
611 {
612 doUpdate(buildCriteria(obj), con);
613 obj.setModified(false);
614 }
615
616 /***
617 * Method to delete. This method is to be used during a transaction,
618 * otherwise use the doDelete(RdfStatement) method. It will take
619 * care of the connection details internally.
620 *
621 * @param obj the data object to delete in the database.
622 * @param con the connection to use
623 * @throws TorqueException Any exceptions caught during processing will be
624 * rethrown wrapped into a TorqueException.
625 */
626 public static void doDelete(RdfStatement obj, Connection con)
627 throws TorqueException
628 {
629 doDelete(buildCriteria(obj), con);
630 }
631
632 /***
633 * Method to do deletes.
634 *
635 * @param pk ObjectKey that is used DELETE from database.
636 * @throws TorqueException Any exceptions caught during processing will be
637 * rethrown wrapped into a TorqueException.
638 */
639 public static void doDelete(ObjectKey pk) throws TorqueException
640 {
641 BaseRdfStatementPeer
642 .doDelete(pk, (Connection) null);
643 }
644
645 /***
646 * Method to delete. This method is to be used during a transaction,
647 * otherwise use the doDelete(ObjectKey) method. It will take
648 * care of the connection details internally.
649 *
650 * @param pk the primary key for the object to delete in the database.
651 * @param con the connection to use
652 * @throws TorqueException Any exceptions caught during processing will be
653 * rethrown wrapped into a TorqueException.
654 */
655 public static void doDelete(ObjectKey pk, Connection con)
656 throws TorqueException
657 {
658 doDelete(buildCriteria(pk), con);
659 }
660
661 /*** Build a Criteria object from an ObjectKey */
662 public static Criteria buildCriteria( ObjectKey pk )
663 {
664 Criteria criteria = new Criteria();
665 criteria.add(ID, pk);
666 return criteria;
667 }
668
669 /*** Build a Criteria object from the data object for this peer */
670 public static Criteria buildCriteria( RdfStatement obj )
671 {
672 Criteria criteria = new Criteria(DATABASE_NAME);
673 if (!obj.isNew())
674 criteria.add(ID, obj.getId());
675 criteria.add(SUBJECT, obj.getSubject());
676 criteria.add(PREDICATE, obj.getPredicate());
677 criteria.add(OBJ_RESOURCE, obj.getObjResource());
678 criteria.add(OBJ_LITERAL, obj.getObjLiteral());
679 criteria.add(RES, obj.getRes());
680 criteria.add(USR, obj.getUsr());
681 criteria.add(ISPUBLIC, obj.getIspublic());
682 criteria.add(MODIFIED, obj.getModified());
683 criteria.add(GARBAGE, obj.getGarbage());
684 return criteria;
685 }
686
687
688 /***
689 * Retrieve a single object by pk
690 *
691 * @param pk the primary key
692 * @throws TorqueException Any exceptions caught during processing will be
693 * rethrown wrapped into a TorqueException.
694 * @throws NoRowsException Primary key was not found in database.
695 * @throws TooManyRowsException Primary key was not found in database.
696 */
697 public static RdfStatement retrieveByPK(int pk)
698 throws TorqueException, NoRowsException, TooManyRowsException
699 {
700 return retrieveByPK(SimpleKey.keyFor(pk));
701 }
702
703 /***
704 * Retrieve a single object by pk
705 *
706 * @param pk the primary key
707 * @throws TorqueException Any exceptions caught during processing will be
708 * rethrown wrapped into a TorqueException.
709 * @throws NoRowsException Primary key was not found in database.
710 * @throws TooManyRowsException Primary key was not found in database.
711 */
712 public static RdfStatement retrieveByPK(ObjectKey pk)
713 throws TorqueException, NoRowsException, TooManyRowsException
714 {
715 Connection db = null;
716 RdfStatement retVal = null;
717 try
718 {
719 db = Torque.getConnection(DATABASE_NAME);
720 retVal = retrieveByPK(pk, db);
721 }
722 finally
723 {
724 Torque.closeConnection(db);
725 }
726 return(retVal);
727 }
728
729 /***
730 * Retrieve a single object by pk
731 *
732 * @param pk the primary key
733 * @param con the connection to use
734 * @throws TorqueException Any exceptions caught during processing will be
735 * rethrown wrapped into a TorqueException.
736 * @throws NoRowsException Primary key was not found in database.
737 * @throws TooManyRowsException Primary key was not found in database.
738 */
739 public static RdfStatement retrieveByPK(ObjectKey pk, Connection con)
740 throws TorqueException, NoRowsException, TooManyRowsException
741 {
742 Criteria criteria = buildCriteria(pk);
743 List v = doSelect(criteria, con);
744 if (v.size() == 0)
745 {
746 throw new NoRowsException("Failed to select a row.");
747 }
748 else if (v.size() > 1)
749 {
750 throw new TooManyRowsException("Failed to select only one row.");
751 }
752 else
753 {
754 return (RdfStatement)v.get(0);
755 }
756 }
757
758 /***
759 * Retrieve a multiple objects by pk
760 *
761 * @param pks List of primary keys
762 * @throws TorqueException Any exceptions caught during processing will be
763 * rethrown wrapped into a TorqueException.
764 */
765 public static List retrieveByPKs(List pks)
766 throws TorqueException
767 {
768 Connection db = null;
769 List retVal = null;
770 try
771 {
772 db = Torque.getConnection(DATABASE_NAME);
773 retVal = retrieveByPKs(pks, db);
774 }
775 finally
776 {
777 Torque.closeConnection(db);
778 }
779 return(retVal);
780 }
781
782 /***
783 * Retrieve a multiple objects by pk
784 *
785 * @param pks List of primary keys
786 * @param dbcon the connection to use
787 * @throws TorqueException Any exceptions caught during processing will be
788 * rethrown wrapped into a TorqueException.
789 */
790 public static List retrieveByPKs( List pks, Connection dbcon )
791 throws TorqueException
792 {
793 List objs = null;
794 if (pks == null || pks.size() == 0)
795 {
796 objs = new LinkedList();
797 }
798 else
799 {
800 Criteria criteria = new Criteria();
801 criteria.addIn( ID, pks );
802 objs = doSelect(criteria, dbcon);
803 }
804 return objs;
805 }
806
807
808
809
810
811
812
813
814
815
816 /***
817 * selects a collection of RdfStatement objects pre-filled with their
818 * RdfUser objects.
819 *
820 * This method is protected by default in order to keep the public
821 * api reasonable. You can provide public methods for those you
822 * actually need in RdfStatementPeer.
823 *
824 * @throws TorqueException Any exceptions caught during processing will be
825 * rethrown wrapped into a TorqueException.
826 */
827 protected static List doSelectJoinRdfUser(Criteria c)
828 throws TorqueException
829 {
830
831
832
833 if (c.getDbName() == Torque.getDefaultDB())
834 {
835 c.setDbName(DATABASE_NAME);
836 }
837
838 RdfStatementPeer.addSelectColumns(c);
839 int offset = numColumns + 1;
840 RdfUserPeer.addSelectColumns(c);
841
842
843 c.addJoin(RdfStatementPeer.USR,
844 RdfUserPeer.ID);
845
846
847
848 List rows = BasePeer.doSelect(c);
849 List results = new ArrayList();
850
851 for (int i = 0; i < rows.size(); i++)
852 {
853 Record row = (Record) rows.get(i);
854
855 Class omClass = RdfStatementPeer.getOMClass();
856 RdfStatement obj1 = (RdfStatement) RdfStatementPeer
857 .row2Object(row, 1, omClass);
858 omClass = RdfUserPeer.getOMClass();
859 RdfUser obj2 = (RdfUser)RdfUserPeer
860 .row2Object(row, offset, omClass);
861
862 boolean newObject = true;
863 for (int j = 0; j < results.size(); j++)
864 {
865 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
866 RdfUser temp_obj2 = (RdfUser)temp_obj1.getRdfUser();
867 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
868 {
869 newObject = false;
870 temp_obj2.addRdfStatement(obj1);
871 break;
872 }
873 }
874 if (newObject)
875 {
876 obj2.initRdfStatements();
877 obj2.addRdfStatement(obj1);
878 }
879 results.add(obj1);
880 }
881 return results;
882 }
883
884
885
886
887 /***
888 * selects a collection of RdfStatement objects pre-filled with their
889 * RdfResource objects.
890 *
891 * This method is protected by default in order to keep the public
892 * api reasonable. You can provide public methods for those you
893 * actually need in RdfStatementPeer.
894 *
895 * @throws TorqueException Any exceptions caught during processing will be
896 * rethrown wrapped into a TorqueException.
897 */
898 protected static List doSelectJoinRdfResourceRelatedByPredicate(Criteria c)
899 throws TorqueException
900 {
901
902
903
904 if (c.getDbName() == Torque.getDefaultDB())
905 {
906 c.setDbName(DATABASE_NAME);
907 }
908
909 RdfStatementPeer.addSelectColumns(c);
910 int offset = numColumns + 1;
911 RdfResourcePeer.addSelectColumns(c);
912
913
914 c.addJoin(RdfStatementPeer.PREDICATE,
915 RdfResourcePeer.ID);
916
917
918
919 List rows = BasePeer.doSelect(c);
920 List results = new ArrayList();
921
922 for (int i = 0; i < rows.size(); i++)
923 {
924 Record row = (Record) rows.get(i);
925
926 Class omClass = RdfStatementPeer.getOMClass();
927 RdfStatement obj1 = (RdfStatement) RdfStatementPeer
928 .row2Object(row, 1, omClass);
929 omClass = RdfResourcePeer.getOMClass();
930 RdfResource obj2 = (RdfResource)RdfResourcePeer
931 .row2Object(row, offset, omClass);
932
933 boolean newObject = true;
934 for (int j = 0; j < results.size(); j++)
935 {
936 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
937 RdfResource temp_obj2 = (RdfResource)temp_obj1.getRdfResourceRelatedByPredicate();
938 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
939 {
940 newObject = false;
941 temp_obj2.addRdfStatementRelatedByPredicate(obj1);
942 break;
943 }
944 }
945 if (newObject)
946 {
947 obj2.initRdfStatementsRelatedByPredicate();
948 obj2.addRdfStatementRelatedByPredicate(obj1);
949 }
950 results.add(obj1);
951 }
952 return results;
953 }
954
955
956
957
958 /***
959 * selects a collection of RdfStatement objects pre-filled with their
960 * RdfResource objects.
961 *
962 * This method is protected by default in order to keep the public
963 * api reasonable. You can provide public methods for those you
964 * actually need in RdfStatementPeer.
965 *
966 * @throws TorqueException Any exceptions caught during processing will be
967 * rethrown wrapped into a TorqueException.
968 */
969 protected static List doSelectJoinRdfResourceRelatedByObjResource(Criteria c)
970 throws TorqueException
971 {
972
973
974
975 if (c.getDbName() == Torque.getDefaultDB())
976 {
977 c.setDbName(DATABASE_NAME);
978 }
979
980 RdfStatementPeer.addSelectColumns(c);
981 int offset = numColumns + 1;
982 RdfResourcePeer.addSelectColumns(c);
983
984
985 c.addJoin(RdfStatementPeer.OBJ_RESOURCE,
986 RdfResourcePeer.ID);
987
988
989
990 List rows = BasePeer.doSelect(c);
991 List results = new ArrayList();
992
993 for (int i = 0; i < rows.size(); i++)
994 {
995 Record row = (Record) rows.get(i);
996
997 Class omClass = RdfStatementPeer.getOMClass();
998 RdfStatement obj1 = (RdfStatement) RdfStatementPeer
999 .row2Object(row, 1, omClass);
1000 omClass = RdfResourcePeer.getOMClass();
1001 RdfResource obj2 = (RdfResource)RdfResourcePeer
1002 .row2Object(row, offset, omClass);
1003
1004 boolean newObject = true;
1005 for (int j = 0; j < results.size(); j++)
1006 {
1007 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1008 RdfResource temp_obj2 = (RdfResource)temp_obj1.getRdfResourceRelatedByObjResource();
1009 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1010 {
1011 newObject = false;
1012 temp_obj2.addRdfStatementRelatedByObjResource(obj1);
1013 break;
1014 }
1015 }
1016 if (newObject)
1017 {
1018 obj2.initRdfStatementsRelatedByObjResource();
1019 obj2.addRdfStatementRelatedByObjResource(obj1);
1020 }
1021 results.add(obj1);
1022 }
1023 return results;
1024 }
1025
1026
1027
1028
1029 /***
1030 * selects a collection of RdfStatement objects pre-filled with their
1031 * RdfResource objects.
1032 *
1033 * This method is protected by default in order to keep the public
1034 * api reasonable. You can provide public methods for those you
1035 * actually need in RdfStatementPeer.
1036 *
1037 * @throws TorqueException Any exceptions caught during processing will be
1038 * rethrown wrapped into a TorqueException.
1039 */
1040 protected static List doSelectJoinRdfResourceRelatedBySubject(Criteria c)
1041 throws TorqueException
1042 {
1043
1044
1045
1046 if (c.getDbName() == Torque.getDefaultDB())
1047 {
1048 c.setDbName(DATABASE_NAME);
1049 }
1050
1051 RdfStatementPeer.addSelectColumns(c);
1052 int offset = numColumns + 1;
1053 RdfResourcePeer.addSelectColumns(c);
1054
1055
1056 c.addJoin(RdfStatementPeer.SUBJECT,
1057 RdfResourcePeer.ID);
1058
1059
1060
1061 List rows = BasePeer.doSelect(c);
1062 List results = new ArrayList();
1063
1064 for (int i = 0; i < rows.size(); i++)
1065 {
1066 Record row = (Record) rows.get(i);
1067
1068 Class omClass = RdfStatementPeer.getOMClass();
1069 RdfStatement obj1 = (RdfStatement) RdfStatementPeer
1070 .row2Object(row, 1, omClass);
1071 omClass = RdfResourcePeer.getOMClass();
1072 RdfResource obj2 = (RdfResource)RdfResourcePeer
1073 .row2Object(row, offset, omClass);
1074
1075 boolean newObject = true;
1076 for (int j = 0; j < results.size(); j++)
1077 {
1078 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1079 RdfResource temp_obj2 = (RdfResource)temp_obj1.getRdfResourceRelatedBySubject();
1080 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1081 {
1082 newObject = false;
1083 temp_obj2.addRdfStatementRelatedBySubject(obj1);
1084 break;
1085 }
1086 }
1087 if (newObject)
1088 {
1089 obj2.initRdfStatementsRelatedBySubject();
1090 obj2.addRdfStatementRelatedBySubject(obj1);
1091 }
1092 results.add(obj1);
1093 }
1094 return results;
1095 }
1096
1097
1098
1099
1100 /***
1101 * selects a collection of RdfStatement objects pre-filled with their
1102 * RdfLiteral objects.
1103 *
1104 * This method is protected by default in order to keep the public
1105 * api reasonable. You can provide public methods for those you
1106 * actually need in RdfStatementPeer.
1107 *
1108 * @throws TorqueException Any exceptions caught during processing will be
1109 * rethrown wrapped into a TorqueException.
1110 */
1111 protected static List doSelectJoinRdfLiteral(Criteria c)
1112 throws TorqueException
1113 {
1114
1115
1116
1117 if (c.getDbName() == Torque.getDefaultDB())
1118 {
1119 c.setDbName(DATABASE_NAME);
1120 }
1121
1122 RdfStatementPeer.addSelectColumns(c);
1123 int offset = numColumns + 1;
1124 RdfLiteralPeer.addSelectColumns(c);
1125
1126
1127 c.addJoin(RdfStatementPeer.OBJ_LITERAL,
1128 RdfLiteralPeer.ID);
1129
1130
1131
1132 List rows = BasePeer.doSelect(c);
1133 List results = new ArrayList();
1134
1135 for (int i = 0; i < rows.size(); i++)
1136 {
1137 Record row = (Record) rows.get(i);
1138
1139 Class omClass = RdfStatementPeer.getOMClass();
1140 RdfStatement obj1 = (RdfStatement) RdfStatementPeer
1141 .row2Object(row, 1, omClass);
1142 omClass = RdfLiteralPeer.getOMClass();
1143 RdfLiteral obj2 = (RdfLiteral)RdfLiteralPeer
1144 .row2Object(row, offset, omClass);
1145
1146 boolean newObject = true;
1147 for (int j = 0; j < results.size(); j++)
1148 {
1149 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1150 RdfLiteral temp_obj2 = (RdfLiteral)temp_obj1.getRdfLiteral();
1151 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1152 {
1153 newObject = false;
1154 temp_obj2.addRdfStatement(obj1);
1155 break;
1156 }
1157 }
1158 if (newObject)
1159 {
1160 obj2.initRdfStatements();
1161 obj2.addRdfStatement(obj1);
1162 }
1163 results.add(obj1);
1164 }
1165 return results;
1166 }
1167
1168
1169
1170
1171
1172
1173
1174
1175 /***
1176 * selects a collection of RdfStatement objects pre-filled with
1177 * all related objects.
1178 *
1179 * This method is protected by default in order to keep the public
1180 * api reasonable. You can provide public methods for those you
1181 * actually need in RdfStatementPeer.
1182 *
1183 * @throws TorqueException Any exceptions caught during processing will be
1184 * rethrown wrapped into a TorqueException.
1185 */
1186 protected static List doSelectJoinAllExceptRdfUser(Criteria c)
1187 throws TorqueException
1188 {
1189
1190
1191
1192 if (c.getDbName() == Torque.getDefaultDB())
1193 {
1194 c.setDbName(DATABASE_NAME);
1195 }
1196
1197 addSelectColumns(c);
1198 int offset2 = numColumns + 1;
1199
1200
1201 RdfResourcePeer.addSelectColumns(c);
1202 int offset3 = offset2 + RdfResourcePeer.numColumns;
1203
1204 RdfResourcePeer.addSelectColumns(c);
1205 int offset4 = offset3 + RdfResourcePeer.numColumns;
1206
1207 RdfResourcePeer.addSelectColumns(c);
1208 int offset5 = offset4 + RdfResourcePeer.numColumns;
1209
1210 RdfLiteralPeer.addSelectColumns(c);
1211 int offset6 = offset5 + RdfLiteralPeer.numColumns;
1212
1213 List rows = BasePeer.doSelect(c);
1214 List results = new ArrayList();
1215
1216 for (int i = 0; i < rows.size(); i++)
1217 {
1218 Record row = (Record)rows.get(i);
1219
1220 Class omClass = RdfStatementPeer.getOMClass();
1221 RdfStatement obj1 = (RdfStatement)RdfStatementPeer
1222 .row2Object(row, 1, omClass);
1223
1224
1225
1226
1227
1228 omClass = RdfResourcePeer.getOMClass();
1229 RdfResource obj2 = (RdfResource)RdfResourcePeer
1230 .row2Object( row, offset2, omClass);
1231
1232 boolean newObject = true;
1233 for (int j = 0; j < results.size(); j++)
1234 {
1235 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1236 RdfResource temp_obj2 = (RdfResource)temp_obj1.getRdfResourceRelatedByPredicate();
1237 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1238 {
1239 newObject = false;
1240 temp_obj2.addRdfStatementRelatedByPredicate(obj1);
1241 break;
1242 }
1243 }
1244 if (newObject)
1245 {
1246 obj2.initRdfStatementsRelatedByPredicate();
1247 obj2.addRdfStatementRelatedByPredicate(obj1);
1248 }
1249
1250
1251
1252
1253 omClass = RdfResourcePeer.getOMClass();
1254 RdfResource obj3 = (RdfResource)RdfResourcePeer
1255 .row2Object( row, offset3, omClass);
1256
1257 newObject = true;
1258 for (int j = 0; j < results.size(); j++)
1259 {
1260 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1261 RdfResource temp_obj3 = (RdfResource)temp_obj1.getRdfResourceRelatedByObjResource();
1262 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1263 {
1264 newObject = false;
1265 temp_obj3.addRdfStatementRelatedByObjResource(obj1);
1266 break;
1267 }
1268 }
1269 if (newObject)
1270 {
1271 obj3.initRdfStatementsRelatedByObjResource();
1272 obj3.addRdfStatementRelatedByObjResource(obj1);
1273 }
1274
1275
1276
1277
1278 omClass = RdfResourcePeer.getOMClass();
1279 RdfResource obj4 = (RdfResource)RdfResourcePeer
1280 .row2Object( row, offset4, omClass);
1281
1282 newObject = true;
1283 for (int j = 0; j < results.size(); j++)
1284 {
1285 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1286 RdfResource temp_obj4 = (RdfResource)temp_obj1.getRdfResourceRelatedBySubject();
1287 if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1288 {
1289 newObject = false;
1290 temp_obj4.addRdfStatementRelatedBySubject(obj1);
1291 break;
1292 }
1293 }
1294 if (newObject)
1295 {
1296 obj4.initRdfStatementsRelatedBySubject();
1297 obj4.addRdfStatementRelatedBySubject(obj1);
1298 }
1299
1300
1301
1302
1303 omClass = RdfLiteralPeer.getOMClass();
1304 RdfLiteral obj5 = (RdfLiteral)RdfLiteralPeer
1305 .row2Object( row, offset5, omClass);
1306
1307 newObject = true;
1308 for (int j = 0; j < results.size(); j++)
1309 {
1310 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1311 RdfLiteral temp_obj5 = (RdfLiteral)temp_obj1.getRdfLiteral();
1312 if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1313 {
1314 newObject = false;
1315 temp_obj5.addRdfStatement(obj1);
1316 break;
1317 }
1318 }
1319 if (newObject)
1320 {
1321 obj5.initRdfStatements();
1322 obj5.addRdfStatement(obj1);
1323 }
1324 results.add(obj1);
1325 }
1326 return results;
1327 }
1328
1329
1330
1331
1332
1333 /***
1334 * selects a collection of RdfStatement objects pre-filled with
1335 * all related objects.
1336 *
1337 * This method is protected by default in order to keep the public
1338 * api reasonable. You can provide public methods for those you
1339 * actually need in RdfStatementPeer.
1340 *
1341 * @throws TorqueException Any exceptions caught during processing will be
1342 * rethrown wrapped into a TorqueException.
1343 */
1344 protected static List doSelectJoinAllExceptRdfResourceRelatedByPredicate(Criteria c)
1345 throws TorqueException
1346 {
1347
1348
1349
1350 if (c.getDbName() == Torque.getDefaultDB())
1351 {
1352 c.setDbName(DATABASE_NAME);
1353 }
1354
1355 addSelectColumns(c);
1356 int offset2 = numColumns + 1;
1357
1358 RdfUserPeer.addSelectColumns(c);
1359 int offset3 = offset2 + RdfUserPeer.numColumns;
1360
1361
1362
1363
1364 RdfLiteralPeer.addSelectColumns(c);
1365 int offset4 = offset3 + RdfLiteralPeer.numColumns;
1366
1367 List rows = BasePeer.doSelect(c);
1368 List results = new ArrayList();
1369
1370 for (int i = 0; i < rows.size(); i++)
1371 {
1372 Record row = (Record)rows.get(i);
1373
1374 Class omClass = RdfStatementPeer.getOMClass();
1375 RdfStatement obj1 = (RdfStatement)RdfStatementPeer
1376 .row2Object(row, 1, omClass);
1377
1378
1379
1380
1381 omClass = RdfUserPeer.getOMClass();
1382 RdfUser obj2 = (RdfUser)RdfUserPeer
1383 .row2Object( row, offset2, omClass);
1384
1385 boolean newObject = true;
1386 for (int j = 0; j < results.size(); j++)
1387 {
1388 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1389 RdfUser temp_obj2 = (RdfUser)temp_obj1.getRdfUser();
1390 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1391 {
1392 newObject = false;
1393 temp_obj2.addRdfStatement(obj1);
1394 break;
1395 }
1396 }
1397 if (newObject)
1398 {
1399 obj2.initRdfStatements();
1400 obj2.addRdfStatement(obj1);
1401 }
1402
1403
1404
1405
1406
1407
1408
1409 omClass = RdfLiteralPeer.getOMClass();
1410 RdfLiteral obj3 = (RdfLiteral)RdfLiteralPeer
1411 .row2Object( row, offset3, omClass);
1412
1413 newObject = true;
1414 for (int j = 0; j < results.size(); j++)
1415 {
1416 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1417 RdfLiteral temp_obj3 = (RdfLiteral)temp_obj1.getRdfLiteral();
1418 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1419 {
1420 newObject = false;
1421 temp_obj3.addRdfStatement(obj1);
1422 break;
1423 }
1424 }
1425 if (newObject)
1426 {
1427 obj3.initRdfStatements();
1428 obj3.addRdfStatement(obj1);
1429 }
1430 results.add(obj1);
1431 }
1432 return results;
1433 }
1434
1435
1436
1437
1438
1439 /***
1440 * selects a collection of RdfStatement objects pre-filled with
1441 * all related objects.
1442 *
1443 * This method is protected by default in order to keep the public
1444 * api reasonable. You can provide public methods for those you
1445 * actually need in RdfStatementPeer.
1446 *
1447 * @throws TorqueException Any exceptions caught during processing will be
1448 * rethrown wrapped into a TorqueException.
1449 */
1450 protected static List doSelectJoinAllExceptRdfResourceRelatedByObjResource(Criteria c)
1451 throws TorqueException
1452 {
1453
1454
1455
1456 if (c.getDbName() == Torque.getDefaultDB())
1457 {
1458 c.setDbName(DATABASE_NAME);
1459 }
1460
1461 addSelectColumns(c);
1462 int offset2 = numColumns + 1;
1463
1464 RdfUserPeer.addSelectColumns(c);
1465 int offset3 = offset2 + RdfUserPeer.numColumns;
1466
1467
1468
1469
1470 RdfLiteralPeer.addSelectColumns(c);
1471 int offset4 = offset3 + RdfLiteralPeer.numColumns;
1472
1473 List rows = BasePeer.doSelect(c);
1474 List results = new ArrayList();
1475
1476 for (int i = 0; i < rows.size(); i++)
1477 {
1478 Record row = (Record)rows.get(i);
1479
1480 Class omClass = RdfStatementPeer.getOMClass();
1481 RdfStatement obj1 = (RdfStatement)RdfStatementPeer
1482 .row2Object(row, 1, omClass);
1483
1484
1485
1486
1487 omClass = RdfUserPeer.getOMClass();
1488 RdfUser obj2 = (RdfUser)RdfUserPeer
1489 .row2Object( row, offset2, omClass);
1490
1491 boolean newObject = true;
1492 for (int j = 0; j < results.size(); j++)
1493 {
1494 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1495 RdfUser temp_obj2 = (RdfUser)temp_obj1.getRdfUser();
1496 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1497 {
1498 newObject = false;
1499 temp_obj2.addRdfStatement(obj1);
1500 break;
1501 }
1502 }
1503 if (newObject)
1504 {
1505 obj2.initRdfStatements();
1506 obj2.addRdfStatement(obj1);
1507 }
1508
1509
1510
1511
1512
1513
1514
1515 omClass = RdfLiteralPeer.getOMClass();
1516 RdfLiteral obj3 = (RdfLiteral)RdfLiteralPeer
1517 .row2Object( row, offset3, omClass);
1518
1519 newObject = true;
1520 for (int j = 0; j < results.size(); j++)
1521 {
1522 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1523 RdfLiteral temp_obj3 = (RdfLiteral)temp_obj1.getRdfLiteral();
1524 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1525 {
1526 newObject = false;
1527 temp_obj3.addRdfStatement(obj1);
1528 break;
1529 }
1530 }
1531 if (newObject)
1532 {
1533 obj3.initRdfStatements();
1534 obj3.addRdfStatement(obj1);
1535 }
1536 results.add(obj1);
1537 }
1538 return results;
1539 }
1540
1541
1542
1543
1544
1545 /***
1546 * selects a collection of RdfStatement objects pre-filled with
1547 * all related objects.
1548 *
1549 * This method is protected by default in order to keep the public
1550 * api reasonable. You can provide public methods for those you
1551 * actually need in RdfStatementPeer.
1552 *
1553 * @throws TorqueException Any exceptions caught during processing will be
1554 * rethrown wrapped into a TorqueException.
1555 */
1556 protected static List doSelectJoinAllExceptRdfResourceRelatedBySubject(Criteria c)
1557 throws TorqueException
1558 {
1559
1560
1561
1562 if (c.getDbName() == Torque.getDefaultDB())
1563 {
1564 c.setDbName(DATABASE_NAME);
1565 }
1566
1567 addSelectColumns(c);
1568 int offset2 = numColumns + 1;
1569
1570 RdfUserPeer.addSelectColumns(c);
1571 int offset3 = offset2 + RdfUserPeer.numColumns;
1572
1573
1574
1575
1576 RdfLiteralPeer.addSelectColumns(c);
1577 int offset4 = offset3 + RdfLiteralPeer.numColumns;
1578
1579 List rows = BasePeer.doSelect(c);
1580 List results = new ArrayList();
1581
1582 for (int i = 0; i < rows.size(); i++)
1583 {
1584 Record row = (Record)rows.get(i);
1585
1586 Class omClass = RdfStatementPeer.getOMClass();
1587 RdfStatement obj1 = (RdfStatement)RdfStatementPeer
1588 .row2Object(row, 1, omClass);
1589
1590
1591
1592
1593 omClass = RdfUserPeer.getOMClass();
1594 RdfUser obj2 = (RdfUser)RdfUserPeer
1595 .row2Object( row, offset2, omClass);
1596
1597 boolean newObject = true;
1598 for (int j = 0; j < results.size(); j++)
1599 {
1600 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1601 RdfUser temp_obj2 = (RdfUser)temp_obj1.getRdfUser();
1602 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1603 {
1604 newObject = false;
1605 temp_obj2.addRdfStatement(obj1);
1606 break;
1607 }
1608 }
1609 if (newObject)
1610 {
1611 obj2.initRdfStatements();
1612 obj2.addRdfStatement(obj1);
1613 }
1614
1615
1616
1617
1618
1619
1620
1621 omClass = RdfLiteralPeer.getOMClass();
1622 RdfLiteral obj3 = (RdfLiteral)RdfLiteralPeer
1623 .row2Object( row, offset3, omClass);
1624
1625 newObject = true;
1626 for (int j = 0; j < results.size(); j++)
1627 {
1628 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1629 RdfLiteral temp_obj3 = (RdfLiteral)temp_obj1.getRdfLiteral();
1630 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1631 {
1632 newObject = false;
1633 temp_obj3.addRdfStatement(obj1);
1634 break;
1635 }
1636 }
1637 if (newObject)
1638 {
1639 obj3.initRdfStatements();
1640 obj3.addRdfStatement(obj1);
1641 }
1642 results.add(obj1);
1643 }
1644 return results;
1645 }
1646
1647
1648
1649
1650
1651 /***
1652 * selects a collection of RdfStatement objects pre-filled with
1653 * all related objects.
1654 *
1655 * This method is protected by default in order to keep the public
1656 * api reasonable. You can provide public methods for those you
1657 * actually need in RdfStatementPeer.
1658 *
1659 * @throws TorqueException Any exceptions caught during processing will be
1660 * rethrown wrapped into a TorqueException.
1661 */
1662 protected static List doSelectJoinAllExceptRdfLiteral(Criteria c)
1663 throws TorqueException
1664 {
1665
1666
1667
1668 if (c.getDbName() == Torque.getDefaultDB())
1669 {
1670 c.setDbName(DATABASE_NAME);
1671 }
1672
1673 addSelectColumns(c);
1674 int offset2 = numColumns + 1;
1675
1676 RdfUserPeer.addSelectColumns(c);
1677 int offset3 = offset2 + RdfUserPeer.numColumns;
1678
1679 RdfResourcePeer.addSelectColumns(c);
1680 int offset4 = offset3 + RdfResourcePeer.numColumns;
1681
1682 RdfResourcePeer.addSelectColumns(c);
1683 int offset5 = offset4 + RdfResourcePeer.numColumns;
1684
1685 RdfResourcePeer.addSelectColumns(c);
1686 int offset6 = offset5 + RdfResourcePeer.numColumns;
1687
1688
1689 List rows = BasePeer.doSelect(c);
1690 List results = new ArrayList();
1691
1692 for (int i = 0; i < rows.size(); i++)
1693 {
1694 Record row = (Record)rows.get(i);
1695
1696 Class omClass = RdfStatementPeer.getOMClass();
1697 RdfStatement obj1 = (RdfStatement)RdfStatementPeer
1698 .row2Object(row, 1, omClass);
1699
1700
1701
1702
1703 omClass = RdfUserPeer.getOMClass();
1704 RdfUser obj2 = (RdfUser)RdfUserPeer
1705 .row2Object( row, offset2, omClass);
1706
1707 boolean newObject = true;
1708 for (int j = 0; j < results.size(); j++)
1709 {
1710 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1711 RdfUser temp_obj2 = (RdfUser)temp_obj1.getRdfUser();
1712 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
1713 {
1714 newObject = false;
1715 temp_obj2.addRdfStatement(obj1);
1716 break;
1717 }
1718 }
1719 if (newObject)
1720 {
1721 obj2.initRdfStatements();
1722 obj2.addRdfStatement(obj1);
1723 }
1724
1725
1726
1727
1728 omClass = RdfResourcePeer.getOMClass();
1729 RdfResource obj3 = (RdfResource)RdfResourcePeer
1730 .row2Object( row, offset3, omClass);
1731
1732 newObject = true;
1733 for (int j = 0; j < results.size(); j++)
1734 {
1735 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1736 RdfResource temp_obj3 = (RdfResource)temp_obj1.getRdfResourceRelatedByPredicate();
1737 if (temp_obj3.getPrimaryKey().equals(obj3.getPrimaryKey()))
1738 {
1739 newObject = false;
1740 temp_obj3.addRdfStatementRelatedByPredicate(obj1);
1741 break;
1742 }
1743 }
1744 if (newObject)
1745 {
1746 obj3.initRdfStatementsRelatedByPredicate();
1747 obj3.addRdfStatementRelatedByPredicate(obj1);
1748 }
1749
1750
1751
1752
1753 omClass = RdfResourcePeer.getOMClass();
1754 RdfResource obj4 = (RdfResource)RdfResourcePeer
1755 .row2Object( row, offset4, omClass);
1756
1757 newObject = true;
1758 for (int j = 0; j < results.size(); j++)
1759 {
1760 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1761 RdfResource temp_obj4 = (RdfResource)temp_obj1.getRdfResourceRelatedByObjResource();
1762 if (temp_obj4.getPrimaryKey().equals(obj4.getPrimaryKey()))
1763 {
1764 newObject = false;
1765 temp_obj4.addRdfStatementRelatedByObjResource(obj1);
1766 break;
1767 }
1768 }
1769 if (newObject)
1770 {
1771 obj4.initRdfStatementsRelatedByObjResource();
1772 obj4.addRdfStatementRelatedByObjResource(obj1);
1773 }
1774
1775
1776
1777
1778 omClass = RdfResourcePeer.getOMClass();
1779 RdfResource obj5 = (RdfResource)RdfResourcePeer
1780 .row2Object( row, offset5, omClass);
1781
1782 newObject = true;
1783 for (int j = 0; j < results.size(); j++)
1784 {
1785 RdfStatement temp_obj1 = (RdfStatement)results.get(j);
1786 RdfResource temp_obj5 = (RdfResource)temp_obj1.getRdfResourceRelatedBySubject();
1787 if (temp_obj5.getPrimaryKey().equals(obj5.getPrimaryKey()))
1788 {
1789 newObject = false;
1790 temp_obj5.addRdfStatementRelatedBySubject(obj1);
1791 break;
1792 }
1793 }
1794 if (newObject)
1795 {
1796 obj5.initRdfStatementsRelatedBySubject();
1797 obj5.addRdfStatementRelatedBySubject(obj1);
1798 }
1799
1800 results.add(obj1);
1801 }
1802 return results;
1803 }
1804
1805
1806 /***
1807 * Returns the TableMap related to this peer. This method is not
1808 * needed for general use but a specific application could have a need.
1809 *
1810 * @throws TorqueException Any exceptions caught during processing will be
1811 * rethrown wrapped into a TorqueException.
1812 */
1813 protected static TableMap getTableMap()
1814 throws TorqueException
1815 {
1816 return Torque.getDatabaseMap(DATABASE_NAME).getTable(TABLE_NAME);
1817 }
1818 }