Esempio n. 1
0
 @Override
 protected void startElement() throws AnimoException, IOException {
     String prefix = reader.getPrefix();
     String name = reader.getLocalName();
     if ("ptrn".equals(prefix) && "language".equals(name)) {
         s.push(false);
     } else if ("have".equals(prefix) || "is".equals(prefix) || "ic".equals(prefix)) {
         builder.start(AN._);
             builder._(REF._, name.equals("name") ? "word" : name);
         s.push(true);
     } else {
         Statement s = Statements.relationshipType(prefix);
         if (s != null) {
             if (s instanceof DEF) {
                 builder.start(DEF._, name);
             } else if (s instanceof Instruction) {
                 builder.start(AN._);
                     builder._(REF._, prefix);
                     builder.start(AN._);
                         builder._(REF._, name);
                     builder.end();
             } else {
                 builder.start(s);
                     builder._(REF._, name);
             }
         } else {
             super.startElement();
         }
         this.s.push(true);
     }
 }
Esempio n. 2
0
        private void evalOther(final PFlow pf, final Relationship ref, final QCAVector answered) throws IOException {
        	IndexHits<Relationship> hits = Order._.context(pf.getOPNode());
        	try {
    	        for (Relationship r : hits) {
    	            Statement st = Statements.relationshipType(r);
    	            if (!(st instanceof Predicate)) {
	            		Pipe pipe = Evaluator._.execute(pf.getController(), answered.question(r));
                		QCAVector v;
                		while ((v = pipe.take()) != null) {
                			pf.sendAnswer(v);
                		}
    	            }
    	        }
        	} finally {
        		hits.close();
        	}
        }
Esempio n. 3
0
        private boolean filtering(final PFlow pf, final Relationship ref, final QCAVector answered) throws IOException, InterruptedException {
        	IndexHits<Relationship> hits = Order._.context(pf.getOPNode());
        	try {
    	        for (Relationship r : hits) {
    	            Statement st = Statements.relationshipType(r);
    	            if (st instanceof Predicate) {
	                    if (((Predicate) st).filter(pf, r, ref)) {
	                    	Pipe pipe = Evaluator._.execute(pf.getController(), answered, r.getEndNode());
	                		QCAVector v;
	                		while ((v = pipe.take()) != null) {
	                			pf.sendAnswer(v);
	                		}
	                        return true;
	                    }
    	            }
    	        }
        	} finally {
        		hits.close();
        	}
            return false;
        }