Package com.hp.hpl.jena.sparql.sse

Examples of com.hp.hpl.jena.sparql.sse.ItemList


            return ;
        }
        if ( !item.isList() || item.getList().size() != 2 )
            BuilderLib.broken(item, "Not a var or var/expression pair") ;

        ItemList list = item.getList() ;

        if ( list.size() == 1 )
        {
            Var v = BuilderNode.buildVar(list.car()) ;
            varExprList.add(v) ;
            return ;
        }
       
        if ( list.size() != 2 )
            BuilderLib.broken(list, "Not a var or var/expression pair") ;
        Var var = BuilderNode.buildVar(list.get(0)) ;
        Expr expr = BuilderExpr.buildExpr(list.get(1)) ;
        varExprList.add(var, expr)
    }
View Full Code Here


    {
        Expr expr = null ;
   
        if ( item.isList() )
        {
            ItemList list = item.getList() ;
           
            if ( list.size() == 0 )
                BuilderLib.broken(item, "Empty list for expression") ;
           
            Item head = list.get(0) ;
           
            if ( head.isNode() )
            {
                if ( head.getNode().isVariable() && list.size() == 1 )
                {
                    // The case of (?z)
                    return new ExprVar(Var.alloc(head.getNode())) ;
                }
                return buildFunctionCall(list) ;
            }
            else if ( head.isList() )
                BuilderLib.broken(item, "Head is a list") ;
            else if ( head.isSymbol() )
            {
                if ( item.isTagged(Tags.tagExpr) )
                {
                    BuilderLib.checkLength(2, list, "Wrong length: "+item.shortString()) ;
                    item = list.get(1) ;
                    return buildItem(item) ;
                }
               
                return buildKnownFunction(list) ;               
            }
View Full Code Here

    static abstract class BuildAggCommon implements Build
    {
        @Override
        public final Expr make(ItemList list)
        {
            ItemList x = list.cdr();    // drop "sum"
            boolean distinct = startsWithDistinct(x) ;
            if ( distinct )
                x = x.cdr();
            BuilderLib.checkLength(1, x, "Broken syntax: "+list.shortString()) ;
            // (sum ?var)
            Expr expr = buildExpr(x.get(0)) ;
            return make(distinct, expr) ;
        }
View Full Code Here

        {
            if ( ! item.isTagged(Tags.tagGraph) )
                BuilderLib.broken(item, "Expected (graph ...) as elements of a dataset") ;
           
            Node name = null ;
            ItemList graphContent = item.getList().cdr();

            if ( !graphContent.isEmpty() && graphContent.car().isNode() )
            {
                name = graphContent.car().getNode();
                graphContent = graphContent.cdr() ;
            }
           
            Graph g ;
            if ( name == null )
            {
View Full Code Here

    }
   
    @Override
    public void listStart(int line, int column)
    {
        ItemList list = new ItemList(line, column) ;
        pushList(list) ;
        setCurrentItem(Item.createList(list)) ;
    }
View Full Code Here

    }

    @Override
    public void listFinish(int line, int column)
    {
        ItemList list = popList() ;
        Item item = Item.createList(list) ;
        listAdd(item) ;
    }
View Full Code Here

            return ;
        }
       
        if ( item != null )
        {
            ItemList list = currentList() ;
            list.add(item) ;
        }
        setCurrentItem(item) ;
    }
View Full Code Here

    }
   
    private static Item format(Map<Node, Integer> predicates, Map<Node, Integer> types, long count)
    {
        Item stats = Item.createList() ;
        ItemList statsList = stats.getList() ;
        statsList.add("stats") ;

        Item meta = createTagged(StatsMatcher.META) ;
        addPair(meta.getList(), "timestamp", NodeFactoryExtra.nowAsDateTime()) ;
        addPair(meta.getList(), "run@",  Utils.nowAsString()) ;
        if ( count >= 0 )
            addPair(meta.getList(), StatsMatcher.COUNT, NodeFactoryExtra.intToNode((int)count)) ;
        statsList.add(meta) ;
       
        for ( Entry<Node, Integer> entry : types.entrySet() )
        {
            Node type = entry.getKey() ;
            addTypeTriple(statsList, type, NodeFactoryExtra.intToNode(entry.getValue()) ) ;
View Full Code Here

        return stats ;
    }

    private static void addTypeTriple(ItemList statsList, Node type, Node intCount)
    {
        ItemList triple = new ItemList() ;
        triple.add("VAR") ;
        triple.add(NodeConst.nodeRDFType) ;
        triple.add(type) ;
        addPair(statsList, Item.createList(triple), Item.createNode(intCount)) ;
    }
View Full Code Here

    {
        if ( ! item.isTagged(Tags.tagBGP) )
            BuilderLib.broken(item, "Not a basic graph pattern") ;
        if ( ! item.isList() )
            BuilderLib.broken(item, "Not a list for a basic graph pattern") ;
        ItemList list = item.getList() ;
        return buildBGP(list) ;
       
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.sparql.sse.ItemList

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.