Package com.hp.hpl.jena.graph

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


       
    }
   
    @Test
    public void serializeAndDeserializeInteger() throws IOException {
        Node n1=NodeFactory.intToNode(77641);
        assertEquals(XSDDatatype.XSDinteger,n1.getLiteralDatatype());
        WritableNode wn1=new WritableNode(n1);
        WritableNode wn2=new WritableNode(null);

        roundtrip(wn1, wn2);
        assertEquals(XSDDatatype.XSDinteger,wn2.getNode().getLiteralDatatype());
View Full Code Here


        assertEquals(77641,wn2.getNode().getLiteralValue());
    }
   
    @Test
    public void serializeAndDeserializeStringWithLanguage() throws IOException {
        Node n1=Node.createLiteral("kore wa okane desu", "jp", false);

        WritableNode wn1=new WritableNode(n1);
        WritableNode wn2=new WritableNode(null);

        roundtrip(wn1, wn2);
View Full Code Here

        assertEquals("jp", wn2.getNode().getLiteralLanguage());
    }
   
    @Test
    public void serializeAndDeserializeStringWithoutLanguage() throws IOException {
        Node n1=Node.createLiteral("jjshsbn7");
        WritableNode wn1=new WritableNode(n1);
        WritableNode wn2=new WritableNode(null);

        roundtrip(wn1, wn2);
        assertEquals("jjshsbn7",wn2.getNode().getLiteralValue());
View Full Code Here

    @Test
    public void testXRI() throws ParseException {
        NodeParser n=new NodeParser(new StringReader("<http://ookaboo.com/>"));
        n.parse();
        Node node=n.getNodeValue();
        assert(null!=node);
        assert(node instanceof Node_URI);
        assertEquals("http://ookaboo.com/",node.getURI());
    }
View Full Code Here

    @Test
    public void testInt() throws ParseException {
        NodeParser n=new NodeParser(new StringReader("55"));
        n.parse();
        Node node=n.getNodeValue();
        assert(null!=node);
        assert(node.isLiteral());
        assertEquals(XSDDatatype.XSDinteger,node.getLiteralDatatype());
        assertEquals(55,node.getLiteralValue());
    }
View Full Code Here

    @Test
    public void serializeAndDeserialize100_000CharString() throws IOException {
        String bigString= repeat("TEN DIGITS", 10000);
        assertEquals((int) Math.pow(10,5),bigString.length());
        Node n1=Node.createLiteral(bigString);
        WritableNode wn1=new WritableNode(n1);
        WritableNode wn2=new WritableNode(null);

        roundtrip(wn1, wn2);
        assertEquals(bigString,wn2.getNode().getLiteralValue());
View Full Code Here

import static com.ontology2.bakemono.jena.TestWritableNode.roundtrip;

public class TestWritableTriple {
    @Test
    public void canRoundtripALinkTriple() throws IOException {
        Node s=Node.createURI("http://example.com/A1");
        Node p=Node.createURI("http://example.com/B2");
        Node o=Node.createURI("http://example.com/C3");
       
        Triple source=new Triple(s,p,o);
        WritableTriple wt1=new WritableTriple(source);
        WritableTriple wt2=new WritableTriple(null);
       
View Full Code Here

import com.hp.hpl.jena.rdf.model.ModelFactory;

public class JenaNodeTester {
    @Test
    public void testParenthesis() {
        Node n=Node.createURI("http://theyknow.whatiswhat.com/text(withParens)");
        String uri=n.toString();
        assertEquals("http://theyknow.whatiswhat.com/text(withParens)",uri);
    }
View Full Code Here

        assertEquals("http://theyknow.whatiswhat.com/text(withParens)",uri);
    }

    @Test
    public void testAngleBracket() {
        Node n=Node.createURI("http://theyknow.whatiswhat.com/text<withAngleBrackets>");
        String uri=n.toString();
        assertEquals("http://theyknow.whatiswhat.com/text<withAngleBrackets>",uri);
    }
View Full Code Here

            String rawPredicate = nodePreprocessor.apply(row3.getPredicate());
            String rawObject = nodePreprocessor.apply(row3.getObject());
           
            Node_URI subject=(Node_URI) nodeParser.get(rawSubject);
            Node_URI predicate=(Node_URI) nodeParser.get(rawPredicate);
            Node object=nodeParser.get(rawObject);
           
            Triple realTriple=new Triple(subject,predicate,object);
            writableTriple = new WritableTriple(realTriple);
        } catch(Throwable e) {
            String factString=row3.getSubject()+"\t"+row3.getPredicate()+"\t"+row3.getSubject()+"\t.";
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.