Package com.hp.hpl.jena.graph

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


            case LITERAL_DT :
            {
                if ( pmap == null && getSubToken().hasType(TokenType.PREFIXED_NAME) )
                    // Must be able to resolve the datattype else we can't find it's datatype.
                    throw new RiotException("Invalid token: "+this) ;
                Node n = getSubToken().asNode(pmap);
                if ( ! n.isURI() )
                    throw new RiotException("Invalid token: "+this) ;
                RDFDatatype dt = TypeMapper.getInstance().getSafeTypeByName(n.getURI()) ;
                return Node.createLiteral(tokenImage, null, dt;
            }
            case LITERAL_LANG : return Node.createLiteral(tokenImage, tokenImage2, null;
            case STRING:
            case STRING1:
View Full Code Here


    //                    if ( s.equalsIgnoreCase("false") ) return new Token(BOOLEAN, s) ;
    //                }
                    // Not a recognized form.
                    // Has datatype.
                   
                    Node dt = Node.createURI(datatype) ;
                    Token subToken = tokenForNode(dt) ;
                    return new Token(LITERAL_DT, s, subToken) ;
                }
   
                if ( lang != null && lang.length()>0)
View Full Code Here

    QueryHandler queryHandler = graph.queryHandler() ;
    ExtendedIterator<Node> subjects = queryHandler.subjectsFor(Node.ANY, Node.ANY) ;
    try {
      Map<Node, Set<Node>> predicates = new HashMap<Node, Set<Node>>() ;
      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()) ;
View Full Code Here

//    }
   
    @Override
    public Node createTypedLiteral(String lexical, RDFDatatype datatype, long line, long col)
    {
        Node n = Node.createLiteral(lexical, null, datatype;
        CheckerLiterals.checkLiteral(lexical, datatype, errorHandler, line, col) ;
        return n ;
    }
View Full Code Here

    }

    @Override
    public Node createLangLiteral(String lexical, String langTag, long line, long col)
    {
        Node n = Node.createLiteral(lexical, langTag, null;
        CheckerLiterals.checkLiteral(lexical, langTag, errorHandler, line, col) ;
        return n ;
    }
View Full Code Here

public class UnderstandNodeMemoryBehavior {

    @Test
    public void identicallyNamedNodesAreNotSameObject() {
        Node uriA=Node.createURI("http://slashdot.org/");
        Node uriB=Node.createURI("http://slashdot.org/");
        assertTrue(uriA.equals(uriB));
        assertTrue(uriA!=uriB);
    }
View Full Code Here

    }

    @Test
    public void theEconomizerChangesThat() {
        Economizer<Node> e=new CacheEconomizer<Node>();
        Node uriA=e.economize(Node.createURI("http://slashdot.org/"));
        Node uriB=e.economize(Node.createURI("http://slashdot.org/"));
        assertTrue(uriA==uriB);
    }
View Full Code Here

    }

    @Test
    public void theEconomizerDoesntSquashOtherNodes() {
        Economizer<Node> e=new CacheEconomizer<Node>();
        Node uriA=e.economize(Node.createURI("http://slashdot.org/1"));
        Node uriB=e.economize(Node.createURI("http://slashdot.org/2"));
        assertTrue(uriA!=uriB);
    }
View Full Code Here

        assertTrue(uriA!=uriB);
    }

    @Test
    public void economizingTriplesEconomizesTheNodes() {
        Node s1a=Node.createURI("http://example.com/s1");
        Node s1b=Node.createURI("http://example.com/s1");
        Node p1a=Node.createURI("http://example.com/p1");
        Node p1b=Node.createURI("http://example.com/p1");
        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);
View Full Code Here

import com.hp.hpl.jena.sparql.util.NodeFactory;

public class TestWritableNode {
    @Test
    public void serializeAndDeserializeURI() throws IOException {
        Node n1=Node.createURI("http://example.com/ZZZ");
        assertEquals("http://example.com/ZZZ",n1.getURI());
       
        WritableNode wn1=new WritableNode(n1);
        WritableNode wn2=new WritableNode(null);

        roundtrip(wn1, wn2);
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.graph.Node

Copyright © 2018 www.massapicom. 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.