Examples of Triple


Examples of org.atomojo.sparql.Triple

      List<Triple> triples = select.getWhereClause().getClauses();
      pivot = null;
      entryPivot = false;
      feedPivot = false;
      unsatisfiable = false;
      Triple lastBind = null;
      for (Triple t : triples) {
         Ref subject = t.getSubject();
         Ref predicate = t.getPredicate();
         Ref object = t.getObject();
         if (subject instanceof VariableRef && predicate instanceof TermRef && object instanceof NilRef) {
            String name = ((VariableRef)subject).getName();
            if (name.equals(var)) {
               URI term = ((TermRef)predicate).getTerm();
               if (term.equals(ENTRY_TERM)) {
                  entryPivot = true;
               } else if (term.equals(FEED_TERM)) {
                  feedPivot = true;
               } else if (pivot==null) {
                  pivot = t;
                  pivotTerm = term;
                  log.info("Pivoting on "+pivot);
                  pivotValue = pivot.getObject() instanceof LiteralRef ? ((LiteralRef)pivot.getObject()).getValue() : Nil.getInstance();
               }
            } else {
               unsatisfiable = true;
            }
         } else if (subject instanceof TermRef) {
            // should be ok (e.g. find a specific entry/feed)
            log.info("Unsatisfiable triple "+t);
            unsatisfiable = true;
         } else if (subject instanceof VariableRef && predicate instanceof TermRef && object instanceof LiteralRef) {
            // ok
            // limit to var now
            String name = ((VariableRef)subject).getName();
            if (!name.equals(var)) {
               log.info("Unsatisfiable triple "+t);
               unsatisfiable = true;
            } else if (pivot==null) {
               pivot = t;
               pivotTerm = ((TermRef)predicate).getTerm();
               log.info("Pivoting on "+pivot);
               pivotValue = pivot.getObject() instanceof LiteralRef ? ((LiteralRef)pivot.getObject()).getValue() : Nil.getInstance();
            }
         } else if (subject instanceof VariableRef && predicate instanceof TermRef && object instanceof VariableRef) {
            // ok
            // limit to var now
            String name = ((VariableRef)subject).getName();
            if (!name.equals(var)) {
               log.info("Unsatisfiable triple "+t);
               unsatisfiable = true;
            } else {
               lastBind = t;
            }
         } else {
            // unsatisfiable
            log.info("Unsatisfiable triple "+t);
            unsatisfiable = true;
         }
      }
      if (entryPivot && feedPivot) {
         log.info("Entry and feed predicates on same variable is unsatisfiable.");
         unsatisfiable = true;
      }
      if (!unsatisfiable && pivot==null) {
         pivot = lastBind;
         pivotTerm = ((TermRef)lastBind.getPredicate()).getTerm();
         log.info("Pivoting on "+pivot);
         pivotValue = pivot.getObject() instanceof LiteralRef ? ((LiteralRef)pivot.getObject()).getValue() : Nil.getInstance();
      }
   }
View Full Code Here

Examples of org.biojava.ontology.Triple

            Term subT = resolveTerm(subject, onto);
            Term objT = resolveTerm(object, onto);
            Term relT = resolveTerm(predicate, onto);

            Triple trip = resolveTriple(subT, objT, relT, onto);
            trip = trip==null?null:trip; // prevent unused field error
          } catch (StringIndexOutOfBoundsException e) {
            throw new IOException("Could not parse line: " + line);
          }
        }
View Full Code Here

Examples of org.dbpedia2sql.model.Triple

  public void start() throws IOException {
    countPerIndex = new int[inputs.size()];

    /* Fill the heap with one element from each input */
    for (int i = 0; i < inputs.size(); i++) {
      Triple data = inputs.get(i).nextTriple();
      if (data == null) {
        System.out.println("EOF ON " + inputs.get(i));
        continue; // One of the input is empty
      }
      heap.add(new HeapEntry(inputs.get(i), data, i));
View Full Code Here

Examples of org.dbpedia2sql.model.Triple

   
    HeapEntry root = heap.remove();
//    System.out.println("TOOK FROM " + root.input + " LINE=" + countPerIndex[root.index]++ + " -> " + root.data.getSubject());
   
    /* Replace the root with a new element from the same stream */
    Triple newTriple = root.input.nextTriple();
    if (newTriple != null) {
//      System.out.println("  GOT replacement: " + newTriple.getSubject());
      heap.add(new HeapEntry(root.input, newTriple, root.index));
    } else {
      System.out.println("EOF ON " + root.input);
View Full Code Here

Examples of org.dbpedia2sql.model.Triple

  public static void main(String[] args) throws Exception {
    TriplesReader tr = new TriplesReader("/home/clement/osm/dbpedia/props_en.nt.gz");

    while (true) {
      Triple t = tr.nextTriple();
      if (t == null) return;
      System.out.println(t.toString());
    }
  }
View Full Code Here

Examples of org.drools.core.util.Triple

        }
        return false;
    }

    public Object get(Object key) {
        Triple t = store.get( propertyKey( key ) );
        return t == null ? null : t.getValue();
    }
View Full Code Here

Examples of org.jrdf.graph.Triple

    }

    public MoleculeImpl(MoleculeComparator newComparator, Molecule... childMolecules) {
        this(newComparator);
        for (Molecule molecule : childMolecules) {
            Triple headTriple = molecule.getHeadTriple();
            SortedSet<Molecule> submolecules = new TreeSet<Molecule>(moleculeComparator);
            submolecules.add(molecule);
            ((MoleculeImpl) molecule).isTopLevel = false;
            subMolecules.put(headTriple, submolecules);
        }
View Full Code Here

Examples of org.wymiwyg.rdf.graphs.Triple

                  Graph deNaturalized = deNaturalize(graphFromModel);
                  if (deNaturalized.size() > 1) {
                    throw new RuntimeException(
                        "nt-molecules should be of size 1");
                  }
                  Triple triple = deNaturalized.iterator()
                      .next();
                  Node subject = triple.getSubject();
                  if (!(subject instanceof GroundedNode)) {
                    subject = NonTerminalMolecule.GROUNDED_NODE;
                  }
                  Node object = triple.getObject();
                  if (!(object instanceof GroundedNode)) {
                    object = NonTerminalMolecule.GROUNDED_NODE;
                  }
                  SimpleGraph result = new SimpleGraph();
                  result.add(new TripleImpl(subject, triple
                      .getPredicate(), object));
                  result.markFinalized();
                  return result;
                }
View Full Code Here

Examples of org.wymiwyg.rdf.graphs.Triple

            downloadAttemptNode = triple.getSubject();
            break;
          }
        }
        for (Iterator<Triple> iter = oldWorkingGraph.iterator(); iter.hasNext();) {
          Triple triple = iter.next();
          //x.equals(null) should return false, making the first condition obsolete
          if ((downloadAttemptNode == null) || !triple.getSubject().equals(downloadAttemptNode)) {
            newWorkingGraph.add(triple);
          }
        }
        newWorkingGraph.addAll(logEntryGraph);
        newWorkingGraph.markFinalized();
View Full Code Here

Examples of org.wymiwyg.rdf.graphs.Triple

    FunctionallyGroundedNodeImpl result = new FunctionallyGroundedNodeImpl();
    Node afgn = new NodeImpl();
    SimpleNonTerminalMolecule molecule = new SimpleNonTerminalMolecule(afgn);
    String uriString = node.getURIRef();
    LiteralNode uriLit = new TypedLiteralNodeImpl(uriString, anyURIDataType);
    Triple triple = new TripleImpl(afgn, nameProp, uriLit);
    molecule.add(triple);
    molecule.markFinalized();
    result.addMolecule(molecule);
    result.markFinalized();
    result.notifyAllFinalized();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.