Package com.hp.jena.rules.ast

Examples of com.hp.jena.rules.ast.Item$WrappedExpr


public class TestItem
    {
    @Test public void testItemFunctorAccessors()
        {
        List<Expr> empty = new ArrayList<Expr>();
        Item functor = Item.createFunctor( "f", empty );
        assertFalse( functor.isURI() );
        assertFalse( functor.isVariable() );
        assertFalse( functor.isLiteral() );
        assertFalse( functor.isBlank() );
        assertFalse( functor.isExplicitBlank() );
        assertTrue( functor.isFunctor() );
        assertFalse( functor.isExpr() );
        assertEquals( "f", functor.getFunctorName() );
        assertSame( empty, functor.getFunctorArgs() );
        }
View Full Code Here


        assertSame( empty, functor.getFunctorArgs() );
        }
   
    @Test public void testItemURIAccessors()
        {
        Item itemURI = Item.createURI( "eh:/x" );
        assertTrue( itemURI.isURI() );
        assertFalse( itemURI.isVariable() );
        assertFalse( itemURI.isLiteral() );
        assertFalse( itemURI.isBlank() );
        assertFalse( itemURI.isExplicitBlank() );
        assertFalse( itemURI.isFunctor() );
        assertFalse( itemURI.isExpr() );
        }
View Full Code Here

        assertFalse( itemURI.isExpr() );
        }

    @Test public void testItemVariableAccessors()
        {
        Item itemVariable = Item.createVariable( "spoo" );
        assertFalse( itemVariable.isURI() );
        assertTrue( itemVariable.isVariable() );
        assertFalse( itemVariable.isLiteral() );
        assertFalse( itemVariable.isBlank() );
        assertFalse( itemVariable.isFunctor() );
        assertFalse( itemVariable.isExpr() );
        assertEquals( "spoo", itemVariable.getVarName() );
        }
View Full Code Here

        assertEquals( "spoo", itemVariable.getVarName() );
        }
   
    @Test public void testPlainItemLiteralAccessors()
        {
        Item itemLiteral = Item.createPlainLiteral( "spoo" );
        testLiteralPredicates( itemLiteral );
        assertEquals( "spoo", itemLiteral.getLiteralSpelling() );
        assertEquals( null, itemLiteral.getLiteralLanguage() );
        assertEquals( null, itemLiteral.getLiteralType() );
        }
View Full Code Here

        assertEquals( null, itemLiteral.getLiteralType() );
        }
   
    @Test public void testTaggedItemLiteralAccessors()
        {
        Item itemLiteral = Item.createTaggedLiteral( "chat", "en-uk" );
        testLiteralPredicates( itemLiteral );
        assertEquals( "chat", itemLiteral.getLiteralSpelling() );       
        assertEquals( "en-uk", itemLiteral.getLiteralLanguage() );
        assertEquals( null, itemLiteral.getLiteralType() );
        }
View Full Code Here

        assertEquals( null, itemLiteral.getLiteralType() );
        }
   
    @Test public void testTypedtemLiteralAccessors()
        {
        Item itemLiteral = Item.createTypedLiteral( "17", "xsd:integer" );
        testLiteralPredicates( itemLiteral );
        assertEquals( "17", itemLiteral.getLiteralSpelling() );       
        assertEquals( null, itemLiteral.getLiteralLanguage() );
        assertEquals( "xsd:integer", itemLiteral.getLiteralType() );
        }
View Full Code Here

        assertFalse( itemLiteral.isExpr() );
        }
   
    @Test public void testBlankNodeAccessors()
        {
        Item itemBlank = Item.createBNode();
        assertFalse( itemBlank.isURI() );
        assertFalse( itemBlank.isVariable() );
        assertFalse( itemBlank.isExplicitBlank() );
        assertTrue( itemBlank.isBlank() );
        assertFalse( itemBlank.isLiteral() );
        assertFalse( itemBlank.isFunctor() );
        assertFalse( itemBlank.isExpr() );
        }
View Full Code Here

        assertFalse( itemBlank.isExpr() );
        }
   
    @Test public void testExplicitBlankNodeAccessors()
        {
        Item itemBlank = Item.createExplicitBNode( "_blank" );
        assertFalse( itemBlank.isURI() );
        assertFalse( itemBlank.isVariable() );
        assertFalse( itemBlank.isBlank() );
        assertTrue( itemBlank.isExplicitBlank() );
        assertFalse( itemBlank.isLiteral() );
        assertFalse( itemBlank.isFunctor() );
        assertFalse( itemBlank.isExpr() );
        }
View Full Code Here

        }
   
    @Test public void testExprAccessors()
        {
        Expr e = new Expr( "f", new ArrayList<Expr>() );
        Item item = Item.createExpr( e );
        assertSame( e, item.getExpr() );
        assertFalse( item.isURI() );
        assertFalse( item.isVariable() );
        assertFalse( item.isBlank() );
        assertFalse( item.isExplicitBlank() );
        assertFalse( item.isLiteral() );
        assertFalse( item.isFunctor() );
        assertTrue( item.isExpr() );
        }
View Full Code Here

        Item.Visitor<Item.Functor> iv = new Item.VisitorBoom<Item.Functor>()
            {
            @Override public Item.Functor visitFunctor( Item.Functor f )
                { return f; }
            };
        Item functor = Item.createFunctor( "someF", new ArrayList<Expr>() );
        Object actual = functor.visit( iv );
        assertSame( functor, actual );
        }
View Full Code Here

TOP

Related Classes of com.hp.jena.rules.ast.Item$WrappedExpr

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.