Tabnine Logo
TriplePattern.getPredicate
Code IndexAdd Tabnine to your IDE (free)

How to use
getPredicate
method
in
com.hp.hpl.jena.reasoner.TriplePattern

Best Java code snippets using com.hp.hpl.jena.reasoner.TriplePattern.getPredicate (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew ArrayList()
  • Codota Iconnew LinkedList()
  • Smart code suggestions by Tabnine
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Return true if the given goal is tabled, currently this is true if the
 * predicate is a tabled predicate or the predicate is a wildcard and some
 * tabled predictes exist.
 */
public boolean isTabled(TriplePattern goal) {
  return isTabled(goal.getPredicate());
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Return an ordered list of RuleClauseCode objects to implement the given 
 * query pattern. This may use indexing to narrow the rule set more that the predicate-only case. 
 * @param goal the triple pattern that makes up the query
 */
public List<RuleClauseCode> codeFor(TriplePattern goal) {
  List<RuleClauseCode> allRules = codeFor(goal.getPredicate());
  if (allRules == null) {
    return allRules;
  }
  Map<Node, List<RuleClauseCode>> indexedCodeTable = indexPredicateToCodeMap.get(goal.getPredicate());
  if (indexedCodeTable != null) {
    List<RuleClauseCode> indexedCode = indexedCodeTable.get(goal.getObject());
    if (indexedCode != null) {
      return indexedCode;
    }
  }
  return allRules;
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Return a Finder instance appropriate for the given query.
 */
public Finder getFinder(TriplePattern pattern, Finder continuation) {
  if (!isPrepared) prepare();
  Node predicate = pattern.getPredicate();
  if (predicate.isVariable()) {
    // Want everything in the cache, the tbox and the continuation
    return FinderUtil.cascade(subPropertyCache, subClassCache, continuation);
  } else if (subPropertyAliases.contains(predicate)) {
    return subPropertyCache;
  } else if (subClassAliases.contains(predicate)) {
    return subClassCache;
  } else {
    return continuation;
  }
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Return a list of rules that match the given goal pattern
 * @param goal the goal being matched
 */
public List<Rule> rulesFor(TriplePattern goal) {
  List<Rule> rules = new ArrayList<Rule>();
  if (goal.getPredicate().isVariable()) {
    checkAll(goalMap.values().iterator(), goal, rules);
  } else {
    checkAll(goalMap.getAll(goal.getPredicate()), goal, rules);
    checkAll(goalMap.getAll(Node.ANY), goal, rules);
  }
  return rules;
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Return true if the given pattern occurs somewhere in the find sequence.
 */
@Override
public boolean contains(TriplePattern pattern) {
  return graph.contains(pattern.getSubject(), pattern.getPredicate(), pattern.getObject());
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

  /** 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);
      }
    } else if (term instanceof Functor) {
      Node[] args = ((Functor)term).getArgs();
      for (int i = 0; i < args.length; i++) {
        result.add(args[i]);
      }
    }
    return result;
  }
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/** 
 * emit the code for the head clause
 */
void emitHead(TriplePattern head) {
  if (permanentVars.size() > 0) {
    code[p++] = ALLOCATE;
    code[p++] = (byte)permanentVars.size();
  }
  emitHeadGet(head.getSubject(), 0);
  emitHeadGet(head.getPredicate(), 1);
  emitHeadGet(head.getObject(), 2);
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * 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;
  }
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Return a simplified print string for a TriplePattern
 */
public static String print(TriplePattern triple) {
  if (triple == null) return "(null)";
  return "(" + print(triple.getSubject()) + " " +
         print(triple.getPredicate()) + " " +
         print(triple.getObject()) + ")";
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Return a dereferenced copy of a triple.
 */
public static Triple deref(TriplePattern t) {
  if (t == null) return null;
  return new Triple(deref(t.getSubject()), deref(t.getPredicate()), deref(t.getObject()));
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Bind the variables in a goal pattern using the binding environment, to
 * generate a more specialized goal
 * @param goal the TriplePattern to be instantiated
 * @return a TriplePattern obtained from the goal by substituting current bindinds
 */
public TriplePattern partInstantiate(TriplePattern goal) {
  return new TriplePattern(
      getGroundVersion(goal.getSubject()),
      getGroundVersion(goal.getPredicate()),
      getGroundVersion(goal.getObject())
  );
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Scan the rules for any axioms and insert those
 */
protected void findAndProcessAxioms() {
  BFRuleContext context = new BFRuleContext(infGraph);
  for (Iterator<Rule> i = rules.iterator(); i.hasNext(); ) {
    Rule r = i.next();
    if (r.bodyLength() == 0) {
      // An axiom
      for (int j = 0; j < r.headLength(); j++) {
        Object head = r.getHeadElement(j);
        if (head instanceof TriplePattern) {
          TriplePattern h = (TriplePattern) head;
          Triple t = new Triple(h.getSubject(), h.getPredicate(), h.getObject());
          context.addTriple(t);
          infGraph.getDeductionsGraph().add(t);
        }
      }
    }
  }
  addSet(context);
  processedAxioms = true;
}
  
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * 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);
  }
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Find all the variables in a TriplePattern.
 */
private int findVars(TriplePattern t, int maxIn) {
  int max = maxIn;
  max = maxVarIndex(t.getSubject(), max);
  max = maxVarIndex(t.getPredicate(), max);
  Node obj = t.getObject();
  if (obj instanceof Node_RuleVariable) {
    max = maxVarIndex(obj, max);
  } else if (Functor.isFunctor(obj)) {
    max = findVars((Functor)obj.getLiteralValue(), max);
  }
  return max;
}
  
origin: net.sourceforge.owlapi/pellet-jena-ignazio1977

@Override
public ExtendedIterator<Triple> findWithContinuation(TriplePattern pattern, Finder finder) {
  prepare();
  Node subject = pattern.getSubject();
  Node predicate = pattern.getPredicate();
  Node object = pattern.getObject();
  ExtendedIterator<Triple> i = GraphQueryHandler.findTriple( kb, this, subject, predicate, object );
  // always look at asserted triples at the end
  if( finder != null ) {
    TriplePattern tp = new TriplePattern( subject, predicate, object );
    i = i.andThen( finder.find( tp ) );
  }
  // make sure we don't have duplicates
  return UniqueExtendedIterator.create( i );
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Extended find interface used in situations where the implementator
 * may or may not be able to answer the complete query. 
 * <p>
 * In this case any query on the direct or closed predicates will
 * be assumed complete, any other query will pass on to the continuation.</p>
 * @param pattern a TriplePattern to be matched against the data
 * @param continuation either a Finder or a normal Graph which
 * will be asked for additional match results if the implementor
 * may not have completely satisfied the query.
 */
@Override
public ExtendedIterator<Triple> findWithContinuation(TriplePattern pattern, Finder continuation) {
  Node p = pattern.getPredicate();
  
  if (p.isVariable()) {
    // wildcard predicate so return merge of cache and continuation
    return find(pattern).andThen(continuation.find(pattern));
  } else if (p.equals(directPredicate) || p.equals(closedPredicate)) {
    // Satisfy entire query from the cache
    return find(pattern);
  } else {
    // No matching triples in this cache so just search the continuation
    return continuation.find(pattern);
  }
  
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Test if a TriplePattern matches a Triple in the given binding
 * environment. If it does then the binding environment is modified
 * the reflect any additional bindings.
 * @return true if the pattern matches the triple
 */
public static boolean match(TriplePattern pattern, Triple triple, BindingStack env) {
  env.push();
  boolean matchOK = match(pattern.getPredicate(), triple.getPredicate(), env)
          && match(pattern.getObject(), triple.getObject(), env)
          && match(pattern.getSubject(), triple.getSubject(), env);
  if (matchOK) {
    env.commit();
    return true;
  } else {
    env.unwind();
    return false;
  }
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Instantiate a triple pattern against the current environment.
 * This version handles unbound varibles by turning them into bNodes.
 * @param clause the triple pattern to match
 * @param env the current binding environment
 * @return a new, instantiated triple
 */
@Override
public Triple instantiate(TriplePattern pattern) {
  Node s = getGroundVersion(pattern.getSubject());
  if (s.isVariable()) s = NodeFactory.createAnon();
  Node p = getGroundVersion(pattern.getPredicate());
  if (p.isVariable()) p = NodeFactory.createAnon();
  Node o = getGroundVersion(pattern.getObject());
  if (o.isVariable()) o = NodeFactory.createAnon();
  return new Triple(s, p, o);
}

origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Instantiate a triple pattern against the current environment.
 * This version handles unbound varibles by turning them into bNodes.
 * @param clause the triple pattern to match
 * @param env the current binding environment
 * @return a new, instantiated triple
 */
@Override
public Triple instantiate(TriplePattern pattern) {
  Node s = getGroundVersion(pattern.getSubject());
  if (s.isVariable()) s = NodeFactory.createAnon();
  Node p = getGroundVersion(pattern.getPredicate());
  if (p.isVariable()) p = NodeFactory.createAnon();
  Node o = getGroundVersion(pattern.getObject());
  if (o.isVariable()) o = NodeFactory.createAnon();
  return new Triple(s, p, o);
}
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

/**
 * Instantiate a triple pattern against the current environment.
 * This version handles unbound varibles by turning them into bNodes.
 * @param clause the triple pattern to match
 * @param env the current binding environment
 * @return a new, instantiated triple
 */
@Override
public Triple instantiate(TriplePattern pattern) {
  Node s = getGroundVersion(pattern.getSubject());
  if (s.isVariable()) s = NodeFactory.createAnon();
  Node p = getGroundVersion(pattern.getPredicate());
  if (p.isVariable()) p = NodeFactory.createAnon();
  Node o = getGroundVersion(pattern.getObject());
  if (o.isVariable()) o = NodeFactory.createAnon();
  return new Triple(s, p, o);
}

com.hp.hpl.jena.reasonerTriplePatterngetPredicate

Javadoc

Returns the predicate.

Popular methods of TriplePattern

  • <init>
    Constructor - builds a pattern from a standard triple match. Node that any filter part of the triple
  • getObject
    Returns the object.
  • getSubject
    Returns the subject.
  • asTriple
    Return the triple pattern as a triple
  • asTripleMatch
    Return the triple pattern as a triple match
  • compatibleWith
    Compare two patterns for compatibility - i.e. potentially unifiable. Two patterns are "compatible" i
  • isGround
    Test if the pattern is ground, contains no variables.
  • nodeEqual
    Helper - equality override on nodes
  • normalize
    Convert any null wildcards to Node_RuleVariable wildcards.
  • simplePrintString
    Simplified printable name for a triple
  • toMatch
    Convert any Node_RuleVariable wildcards to null. This loses the variable named but is used when conv
  • variantOf
    Test if a pattern is just a variant of this pattern. I.e. it is the same up to variable renaming. Th
  • toMatch,
  • variantOf

Popular in Java

  • Making http requests using okhttp
  • compareTo (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Collections (java.util)
    This class consists exclusively of static methods that operate on or return collections. It contains
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Collectors (java.util.stream)
  • Top 12 Jupyter Notebook Extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now