Package com.hp.hpl.jena.rdf.model

Examples of com.hp.hpl.jena.rdf.model.AnonId


                    {
                        String label = parser.getElementText() ;
                        Node node = null ;
                        //if ( inputGraphLabels.getValue() )
                        if ( inputGraphLabels )
                            node = NodeFactory.createAnon(new AnonId(label)) ;
                        else
                            node = bNodes.asNode(label) ;
                        addBinding(binding, Var.alloc(varName), node) ;
                        break ;
                    }
View Full Code Here


        The strings are "equality groups": the nodes should test equal iff their
        associated strings test equal.
    */
    private Object [][] eqTestCases()
    {
        AnonId id = AnonId.create();
        LiteralLabel L2 = LiteralLabelFactory.create( id.toString(), "", false );

        LiteralLabel LLang1 = LiteralLabelFactory.create( "xyz", "en", null) ;
        LiteralLabel LLang2 = LiteralLabelFactory.create( "xyz", "EN", null) ;

        String U2 = id.toString();
        String N2 = id.toString();
        return new Object [][]
            {
            { Node.ANY, "0" },
            { NodeFactory.createAnon( id ), "1" },
            { NodeFactory.createAnon(), "2" },
View Full Code Here

        test that the label of a Node can be retrieved from that Node in
        a way appropriate to that Node.
    */
    public void testLabels()
        {
        AnonId id = AnonId.create();
        assertEquals( "get URI value", U, NodeFactory.createURI( U ).getURI() );
        assertEquals( "get blank value", id, NodeFactory.createAnon( id ).getBlankNodeId() );
        assertEquals( "get literal value", L, NodeFactory.createLiteral( L ).getLiteral() );
        assertEquals( "get variable name", N, NodeFactory.createVariable( N ).getName() );
        }
View Full Code Here

    public void testCreateAnon()
        {
        String idA = "_xxx", idB = "_yyy";
        Node a = NodeCreateUtils.create( idA ), b = NodeCreateUtils.create( idB );
        assertTrue( "both must be bnodes", a.isBlank() && b.isBlank() );
        assertEquals( new AnonId( idA ), a.getBlankNodeId() );
        assertEquals( new AnonId( idB ), b.getBlankNodeId() );
        }
View Full Code Here

        if (first == '\'' || first == '\"')
            return NodeFactory.createLiteral( newString( pm, first, x ) );
        if (Character.isDigit( first ))
            return NodeFactory.createLiteral( x, "", XSDDatatype.XSDinteger );
        if (first == '_')
            return NodeFactory.createAnon( new AnonId( x ) );
        if (x.equals( "??" ))
            return Node.ANY;
        if (first == '?')
            return NodeFactory.createVariable( x.substring( 1 ) );
        if (first == '&')
View Full Code Here

    {
        // Is it a bNode label? i.e. <_:xyz>
        if ( isBNodeIRI(iri) )
        {
            String s = iri.substring(bNodeLabelStart.length()) ;
            Node n = NodeFactory.createAnon(new AnonId(s)) ;
            return n ;
        }
        return NodeFactory.createURI(iri) ;
    }
View Full Code Here

    {
        mDigest.update(seedBytes) ;
        mDigest.update(labelBytes) ;
        byte[] bytes = mDigest.digest() ;   // resets
        String hexString = Bytes.asHexLC(bytes) ;
        return NodeFactory.createAnon(new AnonId(hexString)) ;
    }
View Full Code Here

    public Node asNode(PrefixMap pmap)
    {
        switch(tokenType)
        {
            // Assumes that bnode labels have been sorted out already.
            case BNODE : return NodeFactory.createAnon(new AnonId(tokenImage)) ;
            case IRI :   return NodeFactory.createURI(tokenImage) ;
            case PREFIXED_NAME :
                if ( pmap == null )
                    return NodeFactory.createURI("urn:prefixed-name:"+tokenImage+":"+tokenImage2) ;
                String x = pmap.expand(tokenImage, tokenImage2) ;
View Full Code Here

   
    @Test
    public void bindingStream_61()
    {
        BindingMap b = BindingFactory.create() ;
        Node bn = NodeFactory.createAnon(new AnonId("unusual")) ;
        b.add(Var.alloc("v"), bn) ;
        testWriteRead(b) ;
    }
View Full Code Here

    @Test public void tokenForNode06()
    { test( "<http://example/bar>", TokenType.PREFIXED_NAME, "ex", "bar", null, null) ; }
   
    @Test public void tokenForNode07()
    { test( com.hp.hpl.jena.graph.NodeFactory.createAnon(new AnonId("abc")), TokenType.BNODE, "abc", null, null, null ) ; }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.rdf.model.AnonId

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.