Examples of Triple


Examples of com.hp.hpl.jena.graph.Triple

    InfGraph graph = context.getGraph();
    Node s = env.getGroundVersion(args[0]);
    Node p = env.getGroundVersion(args[1]);
    Node o = env.getGroundVersion(args[2]);
    try {
      Triple t = Triple.create(s,p,o);
      context.add(t);
      Node a = Node.createAnon();
      Reifier r = graph.getReifier();
      r.reifyAs(a,t);
      env.bind(args[3],a);
View Full Code Here

Examples of com.hp.hpl.jena.graph.Triple

        @Override
        public void visit(OpPropFunc opPropFunc)
        {
            Node s = processPropFuncArg(opPropFunc.getSubjectArgs()) ;
            Node o = processPropFuncArg(opPropFunc.getObjectArgs()) ;
            Triple t = new Triple(s, opPropFunc.getProperty(), o) ;
            currentGroup().addElement(process(t)) ;
        }
View Full Code Here

Examples of com.hp.hpl.jena.graph.Triple

       
        Node oNode = nodeTable.getNodeForNodeId(o) ;
        if ( oNode == null )
            throw new InternalErrorException("Invalid id node for object (null node): "+fmt(s,p,o)) ;
       
        return new Triple(sNode, pNode, oNode) ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.graph.Triple

    public boolean equivalent(OpBGP opBGP)
    {
        BasicPattern bgp = opBGP.getPattern() ;
        if ( bgp.size() != 1 ) return false ;
        Triple t = bgp.get(0) ;
        return triple.equals(t)
    }
View Full Code Here

Examples of com.hp.hpl.jena.graph.Triple

        return new Applyer()
            {
            @Override
            public void applyToTriples( Domain d, Matcher m, StageElement next )
                {
                Triple t = new Triple( pt.S.finder( d ), pt.P.finder( d ), pt.O.finder( d ) );
                if (objects.containsBySameValueAs( t )) next.run( d );
                }   
            };
        }
View Full Code Here

Examples of com.hp.hpl.jena.graph.Triple

        if ( triples == null || triples.size() == 0 )
            return ;
       
        // Do the first triple.
        Iterator<Triple> iter = triples.iterator() ;
        Triple t1 = iter.next() ;

//        int indent = TRIPLES_SUBJECT_COLUMN+TRIPLES_COLUMN_GAP ;
//        // Long subject => same line.  Works for single triple as well.
//        int s1_len = printSubject(t1.getSubject()) ;
//        //int x = out.getCol() ;

        int indent = subjectWidth + TRIPLES_COLUMN_GAP ;
        int s1_len = printSubject(t1.getSubject()) ;

        if ( s1_len > TRIPLES_SUBJECT_LONG )
        {
            // Too long - start a new line.
            out.incIndent(indent) ;
            out.println() ;
        }
        else
        {
            printGap() ;
            out.incIndent(indent) ;
        }

        // Remained of first triple
        printProperty(t1.getPredicate()) ;
        printGap() ;
        printObject(t1.getObject()) ;
       
        // Do the rest
       
        for ; iter.hasNext() ; )
        {
            Triple t = iter.next() ;
            out.println(" ;") ;
            printProperty(t.getPredicate()) ;
            printGap() ;
            printObject(t.getObject()) ;
            continue ;
            // print property list
        }

        // Finish off the block.
View Full Code Here

Examples of com.hp.hpl.jena.graph.Triple

        for ( int i = 1 ; i < list.size() ; i++ )
        {
            Item item = list.get(i) ;
            if ( ! item.isList() )
                BuilderLib.broken(item, "Not a triple structure") ;
            Triple t = BuilderGraph.buildTriple(item.getList()) ;
            triples.add(t) ;
        }
        return triples ;
    }
View Full Code Here

Examples of com.hp.hpl.jena.graph.Triple

      while ( subjects.hasNext() ) {
        Node subject = subjects.next() ;
        ExtendedIterator<Triple> triples = graph.find(subject, Node.ANY, Node.ANY) ;
        try {
          while ( triples.hasNext() ) {
            Triple triple = triples.next() ;
            Node p = triple.getPredicate() ;
            if ( predicates.containsKey(p) ) {
              predicates.get(p).add(triple.getObject()) ;
            } else {
              Set<Node> objects = new HashSet<Node>() ;
              objects.add(triple.getObject()) ;
              predicates.put(p, objects) ;
            }
          }       
        } finally {
          if ( triples != null ) triples.close() ;
View Full Code Here

Examples of com.hp.hpl.jena.graph.Triple

        Node o1a=Node.createLiteral("55",XSDDatatype.XSDint);
        Node o1b=Node.createLiteral("55",XSDDatatype.XSDint);

        assertTrue(o1a!=o1b);

        Triple t1=new Triple(s1a,p1a,o1a);
        Triple t2=new Triple(s1b,p1b,o1b);
        assertTrue(t1!=t2);
        assertEquals(t1,t2);

        Economizer<Triple> e=new TripleEconomizer();

        Triple t3=e.economize(t1);
        Triple t4=e.economize(t2);

        assertTrue(t3.getSubject()==t4.getSubject());
        assertTrue(t3.getObject()==t4.getObject());
        assertTrue(t3.getPredicate()==t4.getPredicate());

        assertTrue(s1a.equals(t3.getSubject()));
        assertTrue(p1a.equals(t3.getPredicate()));
        assertTrue(o1a.equals(t3.getObject()));
View Full Code Here

Examples of com.hp.hpl.jena.graph.Triple

        }
    };
   
    @Test
    public void testABC() {
        assertEquals(0,c.compare(base, new Triple(A,B,C)));
    }
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.