congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
TriplePattern.getObject
Code IndexAdd Tabnine to your IDE (free)

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

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

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 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

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

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

int score = scoreNodeBoundness(clause.getSubject(), env) * 3 +
       scoreNodeBoundness(clause.getPredicate(), env) * 2 +
       scoreNodeBoundness(clause.getObject(), env) * 3;
if (score > bestscore) {
  bestscore = score;
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

emitBodyPut(goal.getSubject(), 0, false);
emitBodyPut(goal.getPredicate(), 1, false);
emitBodyPut(goal.getObject(), 2, false);
List<RuleClauseCode> predicateCode = store.codeFor(goal);
if (predicateCode == null || predicateCode.size() == 0) {
    } else {
      if (store.isIndexedPredicate(goal.getPredicate()) && goal.getObject().isVariable()) {
        code[p++] = CALL_PREDICATE_INDEX;
      } else {
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: 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

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

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

Node gObj = goal.getObject();
Node hObj = head.getObject();
if (Functor.isFunctor(gObj)) {
  Functor gFunctor = (Functor)gObj.getLiteralValue();
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

envFrame.pVars[0] = argVars[0] = standardize(goal.getSubject(), mappedVars);
envFrame.pVars[1] = argVars[1] = standardize(goal.getPredicate(), mappedVars);
envFrame.pVars[2] = argVars[2] = standardize(goal.getObject(), mappedVars);
if (engine.getDerivationLogging()) {
  ((EnvironmentFrameWithDerivation)envFrame).initDerivationRecord(argVars);
com.hp.hpl.jena.reasonerTriplePatterngetObject

Javadoc

Returns the object.

Popular methods of TriplePattern

  • <init>
    Constructor - builds a pattern from a standard triple match. Node that any filter part of the triple
  • getPredicate
    Returns the predicate.
  • 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
  • getExternalFilesDir (Context)
  • notifyDataSetChanged (ArrayAdapter)
  • startActivity (Activity)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Top 25 Plugins for Webstorm
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