Package com.hp.hpl.jena.reasoner

Examples of com.hp.hpl.jena.reasoner.TriplePattern


     * This implementation assumes that the underlying findWithContinuation
     * will have also consulted the raw data.
     */
    @Override
    public ExtendedIterator<Triple> graphBaseFind(Node subject, Node property, Node object) {
        return findWithContinuation(new TriplePattern(subject, property, object), null);
    }
View Full Code Here


     * This may different from the normal find operation in the base of hybrid reasoners
     * where we are side-stepping the backward deduction step.
     */
    @Override
    public ExtendedIterator<Triple> findDataMatches(Node subject, Node predicate, Node object) {
        return findWithContinuation(new TriplePattern(subject, predicate, object), null, false);
    }
View Full Code Here

    /**
     * Helper - returns the (singleton) value for the given property on the given
     * root node in the data graph.
     */
    public static Node getPropValue(Node root, Node prop, Finder context) {
        return doGetPropValue(context.find(new TriplePattern(root, prop, null)));
    }
View Full Code Here

       
        /**
         * Return the argument index of the given variable.
         */
        int aIndex(Node n) {
            TriplePattern tp = (TriplePattern)rule.getHeadElement(0);
            if (tp.getSubject() == n) {
                return 0;
            } else if (tp.getPredicate() == n) {
                return 1;
            } else if (tp.getObject() == n) {
                return 2;
            } else {
                return -1;
            }
        }
View Full Code Here

               
        /** Return an list of variables or nodes in a ClauseEntry, in flattened order */
        private List<Node> termVars(ClauseEntry term) {
            List<Node> result = new ArrayList<Node>();
            if (term instanceof TriplePattern) {
                TriplePattern goal = (TriplePattern)term;
                result.add(goal.getSubject());
                result.add(goal.getPredicate());
                Node obj = goal.getObject();
                if (Functor.isFunctor(obj)) {
                    result.add(obj);
                    result.addAll(termVars((Functor)obj.getLiteralValue()));
                } else {
                    result.add(obj);
View Full Code Here

        predicateVar = (p instanceof Node_RuleVariable) ? (Node_RuleVariable) p : null;
        Node o = LPInterpreter.deref(interpreter.argVars[2]);
        objectVar =    (o instanceof Node_RuleVariable) ? (Node_RuleVariable) o : null;
        if (Functor.isFunctor(o)) {
            objectFunctor = (Functor)o.getLiteralValue();
            goal = new TriplePattern(s, p, null);
        } else {
            objectFunctor = null;
            goal = new TriplePattern(s, p, o);
        }
    }
View Full Code Here

        }
    }
   
    /** Instantiate and record a matched subgoal */
    public void noteMatch(TriplePattern pattern, int pc) {
        TriplePattern match = pattern;
        int term = clause.termIndex(pc);  
        if (term >= 0) {                                
            matches[term] = match;
        }
    }
View Full Code Here

    /**
     * Clone a clause, cloning any embedded variables.
     */
    private ClauseEntry cloneClause(ClauseEntry clause, Map<Node_RuleVariable, Node> vmap, BindingEnvironment env) {
        if (clause instanceof TriplePattern) {
            TriplePattern tp = (TriplePattern)clause;
            return new TriplePattern (
                            cloneNode(tp.getSubject(), vmap, env),
                            cloneNode(tp.getPredicate(), vmap, env),
                            cloneNode(tp.getObject(), vmap, env)
                        );
        } else {
            return cloneFunctor((Functor)clause, vmap, env);
        }
    }
View Full Code Here

                    throw new ParserException("Functors not allowed in subject position of pattern", this);
                }
                if (Functor.isFunctor(nodes.get(1))) {
                    throw new ParserException("Functors not allowed in predicate position of pattern", this);
                }
                return new TriplePattern(nodes.get(0), nodes.get(1), nodes.get(2));
            } else if (token.equals("[")) {
                nextToken();
                return doParseRule(true);
            } else {
                String name = nextToken();
View Full Code Here

    public static void translateClause( List<Term> terms, List<AbsRule> backwards, List<Expression> expressions, ClauseEntry c )
        {
        if (c instanceof TriplePattern)
          {
          TriplePattern tp = (TriplePattern) c;
          Item s = AbsRule.toItem( tp.getSubject() );
          Item p = AbsRule.toItem( tp.getPredicate() );
          Item o = AbsRule.toItem( tp.getObject() );
          terms.add( Term.create( s, p, o ) );
          }
        else if (c instanceof Functor)
          {
          Functor f = (Functor) c;
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.reasoner.TriplePattern

Copyright © 2018 www.massapicom. 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.