001: /*
002: (c) Copyright 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
003: [See end of file]
004: */
005:
006: package com.hp.hpl.jena.db;
007:
008: import com.hp.hpl.jena.db.impl.*;
009: import com.hp.hpl.jena.graph.*;
010: import com.hp.hpl.jena.graph.impl.*;
011: import com.hp.hpl.jena.graph.query.QueryHandler;
012: import com.hp.hpl.jena.shared.*;
013: import com.hp.hpl.jena.util.iterator.*;
014:
015: import java.util.*;
016:
017: /**
018: *
019: * A persistent Graph implementation using a relational database for storage.
020: *
021: * <p>This graph stores data persistently in a relational database.
022: * It supports the full Graph interface and should operate just like
023: * a GraphMem.</p>
024: *
025: * <p>
026: * Internally, each GraphRDB keeps a list of specialized graphs.
027: * For each operation, it works through the list of graphs
028: * attempting to perform the operation on each one.</p>
029: *
030: * <p>
031: * The intention is that each type of specialized graph is
032: * optimized for a different type of triple. For example, one
033: * type of specialied graph might be optimized for storing
034: * triples in a particular ontology. The last specialized
035: * graph in the list is always a generic one that can handle any
036: * valid RDF triple.</p>
037: *
038: * <p>
039: * The order of the specialized graphs is consistent and
040: * immutable after the graph is constructed. This aids
041: * optimization. For example, if a specialized graph
042: * is asked to perform an operatin on a triple, and it knows
043: * that it would have added it if asked, then it can advise the
044: * calling GraphRDB that the operaton is complete even though
045: * it doesn't know anything about other specialized graphs later
046: * in the list.</p>
047: *
048: * @since Jena 2.0
049: *
050: * @author csayers (based in part on GraphMem by bwm).
051: * @version $Revision: 1.49 $
052: */
053: public class GraphRDB extends GraphBase implements Graph {
054:
055: /** The name used for the default graph.
056: */
057: static public final String DEFAULT = "DEFAULT";
058:
059: protected IRDBDriver m_driver = null;
060: protected DBPropGraph m_properties = null;
061: protected DBPrefixMappingImpl m_prefixMapping = null;
062: protected List m_specializedGraphs = null;
063: protected List m_specializedGraphReifiers = null;
064: protected List m_specializedGraphAsserted = null;
065: protected List m_specializedGraphsAll = null;
066: protected Reifier m_reifier = null;
067:
068: protected int m_reificationBehaviour = 0;
069:
070: /**
071: * Optimize all triples representing part or all of a reified statement;
072: * this is the recommended option.
073: *
074: * <p>
075: * This is the best choice in almost every case. It optimizes
076: * all reified triples regardless of how they are added to the graph,
077: * provides a simple interface, and is quite efficient.
078: * </p>
079: *
080: * <p>
081: * With this choice, if you do <code>add(A)</code> then
082: * <code>contains(A)</code> will return true for all A.
083: * </p>
084: *
085: */
086: public static final int OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING = 1;
087:
088: /**
089: * Optimize and hide any triples representing part or all of a reified statement.
090: *
091: * <p>
092: * This optimizes all triples but hides them so they are visible only via the reifier interface.
093: * There is no significant performance advantage in using this option and it is not recommended.
094: * It is included only for compatability with in-memory graphs.
095: * </p>
096: *
097: * <p>
098: * Note that it will also cause unexpected behaviour, for example, if you do:
099: * <code>
100: * add(new Triple( s, RDF.predicate, o))
101: * </code>
102: * then that triple will be hidden and a subsequent call to <code>contains</code>,
103: * <code>find</code>, or <code>size</code> will not show it's presence. The only
104: * way to see that statement is to use <code>Reifier.getHiddenTriples</code>.
105: * </p>
106: *
107: */
108: public static final int OPTIMIZE_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS = 2;
109:
110: /**
111: * Optimize and hide only fully reified statements added via the Reifier interface, use only for backward-compatability with Jena1.
112: *
113: * <p>
114: * This treats triples added through the Reifier interface as distinct from those
115: * added using the normal Graph.add function. Those added via the reifier interface
116: * will be optimized and hidden from view. Those added via Graph.add will not
117: * be optimized and will be visible.
118: * </p>
119: *
120: * <p>
121: * Since many of the techniques for adding triple to Graphs use Graph.add, and
122: * that is never optimized, this is not usually a good choice. It is included
123: * only for backward compability with Jena 1. There is no performance advantage
124: * in using this option.
125: * </p>
126: */
127: public static final int OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS = 3;
128:
129: /**
130: Answer the integer representing the RDB reifier style given the Reifier style.
131: */
132: public static int styleRDB(ReificationStyle style) {
133: if (style == ReificationStyle.Standard)
134: return GraphRDB.OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING;
135: if (style == ReificationStyle.Convenient)
136: return GraphRDB.OPTIMIZE_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS;
137: if (style == ReificationStyle.Minimal)
138: return GraphRDB.OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS;
139: throw new JenaException("unsupported reification style");
140: }
141:
142: /**
143: Answer the reification style corresponding to the DB behaviour integer.
144: */
145: public static ReificationStyle styleRDB(int behaviour) {
146: if (behaviour == OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING)
147: return ReificationStyle.Standard;
148: if (behaviour == OPTIMIZE_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS)
149: return ReificationStyle.Convenient;
150: if (behaviour == OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS)
151: return ReificationStyle.Minimal;
152: throw new JenaException("unsupported reification behaviour");
153: }
154:
155: /**
156: * Construct a new GraphRDB using an unusual reification style.
157: * @param con an open connection to the database
158: * @param graphID is the name of a graph or GraphRDB.DEFAULT
159: * @param requestedProperties a set of default properties.
160: * (May be null, if non-null should be a superset of the properties
161: * obtained by calling ModelRDB.getDefaultModelProperties ).
162: * @param isNew is true if the graph doesn't already exist and
163: * false otherwise. (If unsure, test for existance by using
164: * IDBConnection.containsGraph ).
165: * @deprecated Please use the alternate constructor and choose the desired
166: * reification behaviour.
167: */
168: public GraphRDB(IDBConnection con, String graphID,
169: Graph requestedProperties, boolean isNew) {
170: this (con, graphID, requestedProperties,
171: OPTIMIZE_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS, isNew);
172: }
173:
174: /**
175: * Construct a new GraphRDB
176: * @param con an open connection to the database
177: * @param graphID is the name of a graph or GraphRDB.DEFAULT
178: * @param requestedProperties a set of default properties.
179: * (May be null, if non-null should be a superset of the properties
180: * obtained by calling ModelRDB.getDefaultModelProperties ).
181: * @param reificationBehaviour specifies how this graph should handle reified triples.
182: * The options are OPTIMIZE_ALL_REIFICATIONS_AND_HIDE_NOTHING
183: * (strongly recommended), OPTIMIZE_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS
184: * (included only for full compatability with all the options for in-memory Graphs),
185: * OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS (included only for compatability with older jena1-style usage).
186: *
187: * @param isNew is true if the graph doesn't already exist and
188: * false otherwise. (If unsure, test for existance by using
189: * IDBConnection.containsGraph ).
190: */
191: public GraphRDB(IDBConnection con, String graphID,
192: Graph requestedProperties, int reificationBehaviour,
193: boolean isNew) {
194: super (styleRDB(reificationBehaviour));
195: m_reificationBehaviour = reificationBehaviour;
196:
197: if (graphID == null)
198: graphID = DEFAULT;
199: else if (graphID.equals(DEFAULT))
200: throw new JenaException("The model name \"" + DEFAULT
201: + "\" is reserved.");
202:
203: // Find the driver
204: m_driver = con.getDriver();
205: SpecializedGraph sysGraph = m_driver
206: .getSystemSpecializedGraph(true);
207:
208: // Look for properties for this graphID
209: m_properties = DBPropGraph.findPropGraphByName(sysGraph,
210: graphID);
211:
212: if (m_properties != null) {
213: if (isNew)
214: throw new AlreadyExistsException(graphID);
215: if (requestedProperties != null)
216: throw new RDFRDBException(
217: "Error: attempt to change a graph's properties after it has been used.");
218: m_specializedGraphsAll = m_driver
219: .recreateSpecializedGraphs(m_properties);
220: } else {
221: if (!isNew)
222: throw new DoesNotExistException(graphID);
223: if (requestedProperties == null)
224: throw new RDFRDBException(
225: "Error: requested properties is null");
226:
227: /*
228: m_properties = new DBPropGraph( m_driver.getSystemSpecializedGraph(true), graphID, requestedProperties);
229: DBPropDatabase dbprop = new DBPropDatabase( m_driver.getSystemSpecializedGraph(true));
230: dbprop.addGraph(m_properties);
231: */
232: m_specializedGraphsAll = m_driver.createSpecializedGraphs(
233: graphID, requestedProperties);
234: m_properties = DBPropGraph.findPropGraphByName(sysGraph,
235: graphID);
236: if (m_properties == null)
237: throw new RDFRDBException(
238: "Graph properties not found after creating graph.");
239: }
240:
241: // Keep a list of the specialized graphs that handle reification
242: // (we'll need this later to support getReifier)
243:
244: m_specializedGraphReifiers = new ArrayList();
245: m_specializedGraphAsserted = new ArrayList();
246: Iterator it = m_specializedGraphsAll.iterator();
247: while (it.hasNext()) {
248: Object o = it.next();
249: if (o instanceof SpecializedGraphReifier)
250: m_specializedGraphReifiers.add(o);
251: else
252: m_specializedGraphAsserted.add(o);
253: }
254: m_specializedGraphs = m_specializedGraphsAll;
255: }
256:
257: /**
258: Database graphs do not presently support the equivalence of plain
259: string literals and xsd:string literals (and other typed literals
260: in general).
261:
262: @see com.hp.hpl.jena.graph.Graph#getCapabilities()
263: */
264: public Capabilities getCapabilities() {
265: if (capabilities == null)
266: capabilities = new AllCapabilities() {
267: public boolean handlesLiteralTyping() {
268: return false;
269: }
270: };
271: return capabilities;
272: }
273:
274: /**
275: * Returns the Node for this model in the system properties graph.
276: *
277: * The properties of each GraphRDB (things like how it is stored in
278: * the database) are themelves stored in a system Graph. This function
279: * returns the Node which represents this GraphRDB in the system Graph.
280: *
281: * @since Jena 2.0
282: */
283: public Node getNode() {
284: if (m_properties == null)
285: throw new RDFRDBException(
286: "Error - attempt to call getNode() on a GraphRDB that has already been removed");
287: return m_properties.getNode();
288: }
289:
290: /**
291: * Returns triples that describe this graph in the system properties graph.
292: *
293: * The properties of each GraphRDB (things like how it is stored in
294: * the database) are stored as triples in a system Graph. This function
295: * returns those triples.
296: *
297: * @since Jena 2.0
298: */
299: public ExtendedIterator getPropertyTriples() {
300: if (m_properties == null)
301: throw new RDFRDBException(
302: "Error - attempt to call getPropertyTriples on a GraphRDB that has been removed.");
303: return m_properties.listTriples();
304: }
305:
306: protected boolean isOpen() {
307: return !isClosed();
308: }
309:
310: public boolean isClosed() {
311: return m_specializedGraphs == null;
312: }
313:
314: protected void checkOpen() {
315: if (isClosed())
316: throw new ClosedException("GraphRDB", this );
317: }
318:
319: /* (non-Javadoc)
320: * @see com.hp.hpl.jena.graph.Graph#add(com.hp.hpl.jena.graph.Triple)
321: */
322: public void performAdd(Triple t) {
323: checkOpen();
324: SpecializedGraph.CompletionFlag complete = new SpecializedGraph.CompletionFlag();
325: Iterator it = m_specializedGraphs.iterator();
326: while (it.hasNext()) {
327: SpecializedGraph sg = (SpecializedGraph) it.next();
328: if (sg instanceof SpecializedGraphReifier
329: && m_reificationBehaviour == OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS)
330: continue; // don't let the reifier graphs see partial reifications
331: sg.add(t, complete);
332: if (complete.isDone())
333: return;
334: }
335:
336: throw new JenaException(
337: "Error - GraphRDB.add(Triple) failed to find a suitable store for the triple:"
338: + t.toString());
339:
340: }
341:
342: /** Add a list of triples.
343: *
344: * @param triples List to be added. This is unchanged by the call
345: */
346: public void add(List triples) {
347: checkOpen();
348: ArrayList localTriples = new ArrayList(triples);
349: SpecializedGraph.CompletionFlag complete = new SpecializedGraph.CompletionFlag();
350: Iterator it = m_specializedGraphs.iterator();
351: while (it.hasNext()) {
352: SpecializedGraph sg = (SpecializedGraph) it.next();
353: if (sg instanceof SpecializedGraphReifier
354: && m_reificationBehaviour == OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS)
355: continue; // don't let the reifier graphs see partial reifications
356: sg.add(localTriples, complete);
357: if (complete.isDone())
358: return;
359: }
360:
361: throw new JenaException(
362: "Error - GraphRDB.add(List) failed to find a suitable store for at least one triple:"
363: + triples.get(0).toString());
364:
365: }
366:
367: /* (non-Javadoc)
368: * @see com.hp.hpl.jena.graph.Graph#delete(com.hp.hpl.jena.graph.Triple)
369: */
370: public void performDelete(Triple t) {
371: checkOpen();
372: SpecializedGraph.CompletionFlag complete = new SpecializedGraph.CompletionFlag();
373: Iterator it = m_specializedGraphs.iterator();
374: while (it.hasNext()) {
375: SpecializedGraph sg = (SpecializedGraph) it.next();
376: if (sg instanceof SpecializedGraphReifier
377: && m_reificationBehaviour == OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS)
378: continue; // don't let the reifier graphs see partial reifications
379: sg.delete(t, complete);
380: if (complete.isDone())
381: return;
382: }
383:
384: throw new JenaException(
385: "Error - GraphRDB.delete(Triple) failed to find a suitable store for the triple:"
386: + t.toString());
387:
388: }
389:
390: /** Delete a list of triples.
391: *
392: * @param triples List to be deleted. This is unchanged by the call.
393: */
394: public void delete(List triples) {
395: checkOpen();
396: ArrayList localTriples = new ArrayList(triples);
397: SpecializedGraph.CompletionFlag complete = new SpecializedGraph.CompletionFlag();
398: Iterator it = m_specializedGraphs.iterator();
399: while (it.hasNext()) {
400: SpecializedGraph sg = (SpecializedGraph) it.next();
401: if (sg instanceof SpecializedGraphReifier
402: && m_reificationBehaviour == OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS)
403: continue; // don't let the reifier graphs see partial reifications
404: sg.delete(localTriples, complete);
405: if (complete.isDone())
406: return;
407: }
408:
409: throw new JenaException(
410: "Error - GraphRDB.delete(Triple) failed to find a suitable store for at least one triple:"
411: + triples.get(0).toString());
412:
413: }
414:
415: /* (non-Javadoc)
416: * @see com.hp.hpl.jena.graph.Graph#size()
417: */
418: public int graphBaseSize() {
419: checkOpen();
420: int result = 0;
421: Iterator it = m_specializedGraphs.iterator();
422: while (it.hasNext()) {
423: SpecializedGraph sg = (SpecializedGraph) it.next();
424: if (sg instanceof SpecializedGraphReifier
425: && (m_reificationBehaviour == OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS || m_reificationBehaviour == OPTIMIZE_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS))
426: continue; // don't let the reifier graphs see partial reifications
427: result += sg.tripleCount();
428: }
429: return result;
430: }
431:
432: /* (non-Javadoc)
433: * @see com.hp.hpl.jena.graph.Graph#contains(com.hp.hpl.jena.graph.Triple)
434: */
435: public boolean graphBaseContains(Triple t) {
436: checkOpen();
437: SpecializedGraph.CompletionFlag complete = new SpecializedGraph.CompletionFlag();
438: Iterator it = m_specializedGraphs.iterator();
439: while (it.hasNext()) {
440: SpecializedGraph sg = (SpecializedGraph) it.next();
441: if (sg instanceof SpecializedGraphReifier
442: && (m_reificationBehaviour == OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS || m_reificationBehaviour == OPTIMIZE_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS))
443: continue; // don't let the reifier graphs see partial reifications
444: boolean result = sg.contains(t, complete);
445: if (result == true || complete.isDone() == true)
446: return result;
447: }
448: return false;
449: }
450:
451: /* (non-Javadoc)
452: * @see com.hp.hpl.jena.graph.Graph#find(com.hp.hpl.jena.graph.TripleMatch)
453: */
454: public ExtendedIterator graphBaseFind(TripleMatch m) {
455: checkOpen();
456: ExtendedIterator result = NullIterator.instance;
457: SpecializedGraph.CompletionFlag complete = new SpecializedGraph.CompletionFlag();
458: Iterator it = m_specializedGraphs.iterator();
459: while (it.hasNext()) {
460: SpecializedGraph sg = (SpecializedGraph) it.next();
461: if (sg instanceof SpecializedGraphReifier
462: && (m_reificationBehaviour == OPTIMIZE_AND_HIDE_ONLY_FULL_REIFICATIONS || m_reificationBehaviour == OPTIMIZE_AND_HIDE_FULL_AND_PARTIAL_REIFICATIONS))
463: continue; // don't let the reifier graphs see partial reifications
464: ExtendedIterator partialResult = sg.find(m, complete);
465: result = result.andThen(partialResult);
466: if (complete.isDone())
467: break;
468: }
469: return SimpleEventManager.notifyingRemove(this , result);
470: }
471:
472: public ExtendedIterator reifierTriples(TripleMatch m) {
473: return NullIterator.instance;
474: }
475:
476: public int reifierSize() {
477: return 0;
478: }
479:
480: /* (non-Javadoc)
481: * @see com.hp.hpl.jena.graph.Graph#getBulkUpdateHandler()
482: */
483: public BulkUpdateHandler getBulkUpdateHandler() {
484: return new DBBulkUpdateHandler(this );
485: }
486:
487: /*
488: * (non-Javadoc)
489: * @see com.hp.hpl.jena.graph.Graph#getReifier()
490: */
491: public Reifier getReifier() {
492: if (m_reifier == null)
493: m_reifier = new DBReifier(this , style,
494: m_specializedGraphReifiers,
495: m_specializedGraphReifiers);
496: return m_reifier;
497: }
498:
499: /* (non-Javadoc)
500: * @see com.hp.hpl.jena.graph.Graph#getPrefixMapping()
501: */
502: public PrefixMapping getPrefixMapping() {
503: if (m_prefixMapping == null)
504: m_prefixMapping = new DBPrefixMappingImpl(m_properties);
505: return m_prefixMapping;
506: }
507:
508: /* (non-Javadoc)
509: * @see com.hp.hpl.jena.graph.Graph#getTransactionHandler()
510: */
511: public TransactionHandler getTransactionHandler() {
512: return new DBTransactionHandler(m_driver, this );
513: }
514:
515: /* (non-Javadoc)
516: * @see com.hp.hpl.jena.graph.Graph#close()
517: */
518: public synchronized void close() {
519: if (m_specializedGraphs != null) {
520: Iterator it = m_specializedGraphs.iterator();
521: while (it.hasNext()) {
522: SpecializedGraph sg = (SpecializedGraph) it.next();
523: sg.close();
524: }
525: m_specializedGraphs = null;
526: }
527: }
528:
529: /**
530: * Remove this Graph entirely from the database.
531: *
532: * This operation is unique to GraphRDB - it removes all
533: * mention of this graph from the database - after removing
534: * a graph it is recommended to immediately call close()
535: * (there is no other useful operation that may be
536: * performed, and so no reason to keep the Graph around).
537: */
538: public synchronized void remove() {
539: checkOpen();
540: // First we ask the driver to remove the specialized graphs
541: m_driver.removeSpecializedGraphs(m_properties,
542: m_specializedGraphs);
543: m_properties = null;
544: m_specializedGraphs = null;
545: }
546:
547: /**
548: * Remove all statements from this graph.
549: */
550: public synchronized void clear() {
551: if (m_specializedGraphs != null) {
552: Iterator it = m_specializedGraphs.iterator();
553: while (it.hasNext()) {
554: SpecializedGraph sg = (SpecializedGraph) it.next();
555: sg.clear();
556: }
557: }
558: }
559:
560: /**
561: * Return the connection
562: *
563: * @return IDBConnection for the database on which this graph is stored.
564: * Returns null if the connection has not yet been estabilished.
565: */
566: public IDBConnection getConnection() {
567: if (m_driver == null)
568: return null;
569: return m_driver.getConnection();
570: }
571:
572: /**
573: * Return the reification behavior (GraphRDB) for this graph
574: *
575: * @return integer that defines the reification behavior for this graphRDB.
576: */
577: public int reificationBehavior() {
578: return m_reificationBehaviour;
579: }
580:
581: /**
582: * Return an iterator over the specialized graphs for this graph
583: *
584: * @return Iterator over the list of specialized graphs.
585: */
586: public Iterator getSpecializedGraphs() {
587: return m_specializedGraphs.iterator();
588: }
589:
590: private DBQueryHandler q = null;
591:
592: /* (non-Javadoc)
593: * @see com.hp.hpl.jena.graph.Graph#queryHandler()
594: */
595: public QueryHandler queryHandler() {
596: if (q == null)
597: q = new DBQueryHandler(this );
598: return q;
599: }
600:
601: public DBQueryHandler DBqueryHandler() {
602: if (q == null)
603: queryHandler();
604: return q;
605: }
606:
607: /**
608: * Get the value of DoDuplicateCheck
609: * @return bool boolean
610: */
611: public boolean getDoDuplicateCheck() {
612: return m_driver.getDoDuplicateCheck();
613: }
614:
615: /**
616: * Set the value of DoDuplicateCheck.
617: * @param bool boolean
618: */
619: public void setDoDuplicateCheck(boolean bool) {
620: m_driver.setDoDuplicateCheck(bool);
621: boolean nb = !bool;
622: if (isOpen()) {
623: Iterator it = m_specializedGraphs.iterator();
624: while (it.hasNext()) {
625: SpecializedGraph sg = (SpecializedGraph) it.next();
626: sg.getPSet().setSkipDuplicateCheck(nb);
627: }
628: }
629: }
630:
631: /**
632: * Set the value of DoFastpath.
633: * @param val boolean
634: */
635: public void setDoFastpath(boolean val) {
636: DBqueryHandler().setDoFastpath(val);
637: }
638:
639: /**
640: * Get the value of DoFastpath.
641: * @return boolean
642: */
643: public boolean getDoFastpath() {
644: return DBqueryHandler().getDoFastpath();
645: }
646:
647: /**
648: * Set the value of QueryOnlyAsserted.
649: * @param opt boolean
650: */
651: public void setQueryOnlyAsserted(boolean opt) {
652: if (opt) {
653: m_specializedGraphs = m_specializedGraphAsserted;
654: DBqueryHandler().setQueryOnlyReified(false);
655: } else
656: m_specializedGraphs = m_specializedGraphsAll;
657: DBqueryHandler().setQueryOnlyAsserted(opt);
658: }
659:
660: /**
661: * Get the value of QueryOnlyAsserted.
662: * @return boolean
663: */
664: public boolean getQueryOnlyAsserted() {
665: return DBqueryHandler().getQueryOnlyAsserted();
666: }
667:
668: /**
669: * Set the value of QueryOnlyReified.
670: * @param opt boolean
671: */
672: public void setQueryOnlyReified(boolean opt) {
673: if (opt) {
674: m_specializedGraphs = m_specializedGraphReifiers;
675: DBqueryHandler().setQueryOnlyAsserted(false);
676: } else {
677: m_specializedGraphs = m_specializedGraphsAll;
678: }
679: DBqueryHandler().setQueryOnlyReified(opt);
680: }
681:
682: /**
683: * Get the value of QueryOnlyReified.
684: * @return boolean
685: */
686: public boolean getQueryOnlyReified() {
687: return DBqueryHandler().getQueryOnlyReified();
688: }
689:
690: /**
691: * Set the value of QueryFullReified.
692: * @param opt boolean
693: */
694: public void setQueryFullReified(boolean opt) {
695: DBqueryHandler().setQueryFullReified(opt);
696: }
697:
698: /**
699: * Get the value of QueryFullReified.
700: * @return boolean
701: */
702: public boolean getQueryFullReified() {
703: return DBqueryHandler().getQueryFullReified();
704: }
705:
706: /**
707: * Set the value of DoImplicitJoin.
708: * @param val boolean
709: */
710: public void setDoImplicitJoin(boolean val) {
711: DBqueryHandler().setDoImplicitJoin(val);
712: }
713:
714: }
715:
716: /*
717: * (c) Copyright 2002, 2003, 2004, 2005, 2006, 2007, 2008 Hewlett-Packard Development Company, LP
718: * All rights reserved.
719: *
720: * Redistribution and use in source and binary forms, with or without
721: * modification, are permitted provided that the following conditions
722: * are met:
723: * 1. Redistributions of source code must retain the above copyright
724: * notice, this list of conditions and the following disclaimer.
725: * 2. Redistributions in binary form must reproduce the above copyright
726: * notice, this list of conditions and the following disclaimer in the
727: * documentation and/or other materials provided with the distribution.
728: * 3. The name of the author may not be used to endorse or promote products
729: * derived from this software without specific prior written permission.
730:
731: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
732: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
733: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
734: * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
735: * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
736: * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
737: * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
738: * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
739: * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
740: * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
741: */
|