You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chemistry.apache.org by je...@apache.org on 2011/03/18 14:04:52 UTC
svn commit: r1082899 -
/chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext
Author: jens
Date: Fri Mar 18 13:04:52 2011
New Revision: 1082899
URL: http://svn.apache.org/viewvc?rev=1082899&view=rev
Log:
add one more section to test failing page
Modified:
chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext
Modified: chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext
URL: http://svn.apache.org/viewvc/chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext?rev=1082899&r1=1082898&r2=1082899&view=diff
==============================================================================
--- chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext (original)
+++ chemistry/site/trunk/content/java/how-to/how-to-process-query.mdtext Fri Mar 18 13:04:52 2011
@@ -80,3 +80,46 @@ Note: There is currently no predefined w
you need to support JOINS you have to build your own walker for this part
as outlined in the previous section.
+## Using QueryObject
+
+The class `QueryObject` provides all the basic functionality for resolving
+types and properties and performs common validation tasks. The `QueryObject`
+processes the `SELECT` and `FROM` parts as well as all property references from
+the `WHERE` part. It maintains a list of Java objects and interface that you
+can use to access the property and type definitions given your current
+position in the statement. For an example refer to the class
+`StoreManagerImpl` of the InMemory Server and method `query()`.
+To be able to use this object `QueryObj` needs to get access to the types contained in your
+repository. For this purpose you need to pass an interface to a `TypeManager`
+as input parameter. The second parameter is your query walker implementing
+`IQueryConditionProcessor`. Your code will typically look like this:
+
+ :::java
+ TypeManager tm = new MyTypeManager(); // implements interface TypeManager
+
+ IQueryConditionProcessor myWalker = new MyWalker();
+ // implements interface IQueryConditionProcessor
+ // or extends AbstractQueryConditionProcessor
+
+ queryObj = new QueryObject(tm, myWalker);
+
+
+`queryObj` then will process the statement and call the interface methods of
+your walker:
+
+ :::java
+ try {
+
+ CmisQueryWalker walker = QueryObject.getWalker(statement);
+ walker.query(queryObj);
+
+ } catch (RecognitionException e) {
+ throw new RuntimeException("Walking of statement failed with RecognitionException error:\n " + e);
+ } catch (Exception e) {
+ throw new RuntimeException("Walking of statement failed with exception:\n " + e);
+ }
+
+
+After this method returns you may for example ask your walker object
+`myWalker` for the generated SQL string.
+