Codota Logo
TriplePattern.getSubject
Code IndexAdd Codota to your IDE (free)

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

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

  • Common ways to obtain TriplePattern
private void myMethod () {
TriplePattern t =
  • Codota IconNode subject;Node predicate;Node object;new TriplePattern(subject, predicate, object)
  • Smart code suggestions by Codota
}
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

if (body[i] instanceof TriplePattern) {
  TriplePattern clause = (TriplePattern) body[i];
  int score = scoreNodeBoundness(clause.getSubject(), env) * 3 +
         scoreNodeBoundness(clause.getPredicate(), env) * 2 +
         scoreNodeBoundness(clause.getObject(), env) * 3;
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

emitBodyPut(goal.getSubject(), 0, false);
emitBodyPut(goal.getPredicate(), 1, false);
emitBodyPut(goal.getObject(), 2, false);
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[] hEnv = new Node[numRuleVars];
if (!unify(goal.getSubject(), head.getSubject(), gEnv, hEnv)) {
  return null;
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);
origin: org.apache.clerezza.ext/org.apache.jena.jena-core

Node s = pattern.getSubject();
Node p = pattern.getPredicate();
Node o = pattern.getObject();
com.hp.hpl.jena.reasonerTriplePatterngetSubject

Javadoc

Returns the subject.

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.
  • getPredicate
    Returns the predicate.
  • 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

  • Parsing JSON documents to java classes using gson
  • getApplicationContext (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • setContentView (Activity)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now