Examples of QueryElement


Examples of org.apache.oodt.xmlquery.QueryElement

    throws IOException, ServletException {
    // Find if the query should be targeted to specific handlers.
    Set ids = new HashSet();
    if (query.getFromElementSet() != null) {
      for (Iterator i = query.getFromElementSet().iterator(); i.hasNext();) {
        QueryElement qe = (QueryElement) i.next();
        if ("handler".equals(qe.getRole()) && qe.getValue() != null)
          ids.add(qe.getValue());
      }
    }
   
    res.setContentType("text/xml");                 // XML, comin' at ya
    res.getWriter().println("<?xml version='1.0' encoding='UTF-8'?>");     // UTF-8 no less.  Boo-ya.
View Full Code Here

Examples of org.apache.oodt.xmlquery.QueryElement

    OFSNMetKeys {

  public static String extractFieldFromQuery(XMLQuery query, String name) {
    for (Iterator<QueryElement> i = query.getWhereElementSet().iterator(); i
        .hasNext();) {
      QueryElement element = i.next();
      if (element.getRole().equals(XMLQUERY_QUERYELEM_ROLE_ELEM)
          && element.getValue().equals(name)) {
        // get the next element and ensure that it is a LITERAL, and
        // return that
        QueryElement litElement = i.next();
        return litElement.getValue();
      }
    }

    return null;
  }
View Full Code Here

Examples of org.apache.oodt.xmlquery.QueryElement

            return Collections.emptyList();

        List<QueryElement> newSet = new Vector<QueryElement>();

        for (Iterator<QueryElement> i = origSet.iterator(); i.hasNext();) {
            QueryElement elem = i.next();
            if (elem.getRole().equals(XMLQueryHelper.ROLE_ELEMNAME)
                    && !mapping.constantField(elem.getValue())) {
                newSet.add(elem);

            }

        }
View Full Code Here

Examples of org.apache.oodt.xmlquery.QueryElement

            return Collections.emptyList();

        List<QueryElement> newSet = new Vector<QueryElement>();

        for (Iterator<QueryElement> i = origSet.iterator(); i.hasNext();) {
            QueryElement elem = i.next();
            if (elem.getRole().equals(XMLQueryHelper.ROLE_ELEMNAME)
                    && mapping.constantField(elem.getValue())) {
                newSet.add(elem);
            }
        }

        return newSet;
View Full Code Here

Examples of org.apache.oodt.xmlquery.QueryElement

            boolean selectSet) throws Exception {
        // go through each query element: use the mapping fields
        // to translate the names

        for (Iterator<QueryElement> i = elemSet.iterator(); i.hasNext();) {
            QueryElement elem = i.next();
            if (elem.getRole().equals(XMLQueryHelper.ROLE_ELEMNAME)) {
                // do the translation
                String elemValue = elem.getValue();
                MappingField fld = this.mapping.getFieldByName(elemValue);
                // make sure fld is not null
                if (fld == null) {
                    continue;
                }

                // make sure scope is null, or if it's not null, then it's
                // FieldScope.QUERY

                if (fld.getScope() != null
                        && fld.getScope().equals(FieldScope.RETURN)) {
                    // skip
                    continue;
                }

                // check to see if it has a dbname attr, if not, then the name
                // stays
                // the same
                String newFldName = fld.getLocalName();

                elem.setValue(newFldName);

                // now translate the domain vocab if there are translate funcs
                // present and this isn't the select set

                if (!selectSet && fld.getFuncs() != null
                        && fld.getFuncs().size() > 0) {
                    // the next query element should be
                    // XMLQueryHelper.ROLE_LITERAL
                    if (!i.hasNext())
                        break;
                    QueryElement litElem = i.next();
                    if (!litElem.getRole().equals(XMLQueryHelper.ROLE_LITERAL)) {
                        throw new Exception("next query element not "
                                + XMLQueryHelper.ROLE_LITERAL + "! role is "
                                + litElem.getRole() + " instead!");
                    }

                    for (Iterator<MappingFunc> j = fld.getFuncs().iterator(); j
                            .hasNext();) {
                        MappingFunc func = j.next();
                        CDEValue origVal = new CDEValue(fld.getName(),
                                litElem.getValue());
                        CDEValue newVal = func.translate(origVal);
                        litElem.setValue(newVal.getVal());
                    }

                }

            }
View Full Code Here

Examples of org.drools.core.rule.QueryElement

        int[] varIndexesArray = new int[varIndexes.size()];
        for ( int i = 0; i < varIndexesArray.length; i++ ) {
            varIndexesArray[i] = varIndexes.get( i );
        }

        return new QueryElement( pattern,
                                 query.getName(),
                                 arguments.toArray( new Object[arguments.size()] ),
                                 declrsArray,
                                 declrIndexArray,
                                 varIndexesArray,
View Full Code Here

Examples of org.drools.core.rule.QueryElement

        this.workingMemory = new InstrumentedWorkingMemory( 0, this.kBase );
    }

    @Test
    public void testAttach() throws Exception {
        QueryElement queryElement = new QueryElement(null, null, new Object[0], null, null, null, false, false);

        final MockTupleSource source = new MockTupleSource( 12 );

        final QueryElementNode node = new QueryElementNode( 18,
                                                            source,
View Full Code Here

Examples of org.drools.core.rule.QueryElement

    @Test
    @Ignore
    public void test1() {
        Pattern p = new Pattern();
        QueryElement qe = new QueryElement( p,
                                            "queryName1",
                                            new Object[]{Variable.v, "x1", Variable.v, "x3", "x4",Variable.v,"x6",},
                                            new Declaration[0],
                                            new int[0],
                                            new int[] { 0, 2, 5 },
View Full Code Here

Examples of org.drools.core.rule.QueryElement

     */
    public void build(final BuildContext context,
                      final BuildUtils utils,
                      final RuleConditionElement rce) {

        final QueryElement qe = (QueryElement) rce;
        context.pushRuleComponent( qe );
       
        final int currentOffset = context.getCurrentPatternOffset();
       
        qe.getResultPattern().setOffset( currentOffset );
       
        utils.checkUnboundDeclarations( context,
                                        qe.getRequiredDeclarations() );

        context.setTupleSource( (LeftTupleSource) utils.attachNode( context,
                                                                    context.getComponentFactory().getNodeFactoryService().buildQueryElementNode(
                                                                                          context.getNextId(),
                                                                                          context.getTupleSource(),
                                                                                          qe,
                                                                                          context.isTupleMemoryEnabled(),
                                                                                          qe.isOpenQuery(),
                                                                                          context ) ) );
        context.popRuleComponent();
        context.incrementCurrentPatternOffset();
    }
View Full Code Here

Examples of org.drools.core.rule.QueryElement

    @Test
    @Ignore
    public void test1() {
        Pattern p = new Pattern();
        QueryElement qe = new QueryElement( p,
                                            "queryName1",
                                            new Object[]{Variable.v, "x1", Variable.v, "x3", "x4",Variable.v,"x6",},
                                            new Declaration[0],
                                            new int[0],
                                            new int[] { 0, 2, 5 },
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.