Package com.hp.hpl.jena.graph

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


        return PathLib.pathToTriples(pathBlock) ;
    }

    protected Op compileElementGraph(ElementNamedGraph eltGraph)
    {
        Node graphNode = eltGraph.getGraphNameNode() ;
        Op sub = compileElement(eltGraph.getElement()) ;
        return new OpGraph(graphNode, sub) ;
    }
View Full Code Here


        return new OpGraph(graphNode, sub) ;
    }

    protected Op compileElementService(ElementService eltService)
    {
        Node serviceNode = eltService.getServiceNode() ;
        Op sub = compileElement(eltService.getElement()) ;
        return new OpService(serviceNode, sub, eltService, eltService.getSilent()) ;
    }
View Full Code Here

        return new OpService(serviceNode, sub, eltService, eltService.getSilent()) ;
    }
   
    private Op compileElementFetch(ElementFetch elt)
    {
        Node serviceNode = elt.getFetchNode() ;
       
        // Probe to see if enabled.
        OpExtBuilder builder = OpExtRegistry.builder("fetch") ;
        if ( builder == null )
        {
View Full Code Here

   
    /** Decode a node - pref use fetchDecode */
    public static Node decode(ByteBuffer bb)
    {
        bb.position(0) ;
        Node n = nodec.decode(bb, null) ;
        return n ;
    }
View Full Code Here

        if ( ! NodeId.isConcrete(p) )
            throw new InternalErrorException("Invalid id for predicate: "+fmt(s,p,o)) ;
        if ( ! NodeId.isConcrete(o) )
            throw new InternalErrorException("Invalid id for object: "+fmt(s,p,o)) ;
       
        Node sNode = nodeTable.getNodeForNodeId(s) ;
        if ( sNode == null )
            throw new InternalErrorException("Invalid id node for subject (null node): "+fmt(s,p,o)) ;

        Node pNode = nodeTable.getNodeForNodeId(p) ;
        if ( pNode == null )
        {
            nodeTable.getNodeForNodeId(p) ;
            throw new InternalErrorException("Invalid id node for predicate (null node): "+fmt(s,p,o)) ;
        }
       
        Node oNode = nodeTable.getNodeForNodeId(o) ;
        if ( oNode == null )
            throw new InternalErrorException("Invalid id node for object (null node): "+fmt(s,p,o)) ;
       
        return new Triple(sNode, pNode, oNode) ;
    }
View Full Code Here

        return quad(nodeTable, tuple.get(0), tuple.get(1), tuple.get(2), tuple.get(3)) ;
    }
   
    private static Quad quad(NodeTable nodeTable, NodeId g, NodeId s, NodeId p, NodeId o)
    {
        Node gNode = nodeTable.getNodeForNodeId(g) ;
        Node sNode = nodeTable.getNodeForNodeId(s) ;
        Node pNode = nodeTable.getNodeForNodeId(p) ;
        Node oNode = nodeTable.getNodeForNodeId(o) ;
        return new Quad(gNode, sNode, pNode, oNode) ;
    }
View Full Code Here

        String oldURI = old.getURI() ;
        if ( oldURI != null && oldURI.equals(uri) )
        {
            return old ;
        }
        Node resAsNode = old.asNode() ;
        Model model = old.getModel() ;
        Graph graph = model.getGraph() ;
        Graph rawGraph = graph instanceof InfGraph ? ((InfGraph) graph).getRawGraph() : graph ;
        Resource newRes = model.createResource(uri) ;
        Node newResAsNode = newRes.asNode() ;
        
       
        boolean changeOccured = false ;
        List<Triple> triples = new ArrayList<Triple>(WINDOW_SIZE) ;
       
        // An optimization to prevent concatenating the two find() operations together every time through the outer loop
        boolean onFirstIterator = true;

        // It's possible there are triples (old wossname old) that are in triples twice. It doesn't matter.
        ExtendedIterator<Triple> it = rawGraph.find(resAsNode, Node.ANY, Node.ANY) ;
        try
        {
            if ( !it.hasNext() )
            {
                it.close() ;
                onFirstIterator = false ;
                it = rawGraph.find(Node.ANY, Node.ANY, resAsNode) ;
            }
            changeOccured = it.hasNext() ;

            while ( it.hasNext() )
            {
                int count = 0 ;
                while ( it.hasNext() && count < WINDOW_SIZE )
                {
                    triples.add(it.next()) ;
                    count++ ;
                }

                it.close() ;
               
                // Iterate over the triples collection twice (this may be more efficient than interleaving deletes and adds)
                for ( Triple t : triples )
                {
                    rawGraph.delete(t) ;
                }
               
                for ( Triple t : triples )
                {
                    Node oldS = t.getSubject(), oldO = t.getObject() ;
                    Node newS = oldS.equals(resAsNode) ? newResAsNode : oldS ;
                    Node newO = oldO.equals(resAsNode) ? newResAsNode : oldO ;
                   
                    rawGraph.add(Triple.create(newS, t.getPredicate(), newO));
                }
                triples.clear();
View Full Code Here

    {
        DatasetGraphTDB dsg = getDatasetGraphTDB(ds) ;
        if ( dsg == null )
            return null ;
        NodeTable nodeTable = dsg.getQuadTable().getNodeTupleTable().getNodeTable() ;
        Node node = nodeTable.getNodeForNodeId(nodeId) ;
        return node ;
    }
View Full Code Here

                Var v = vars.get(i) ;
               
                Token token = nextToken() ;
                if ( ! token.hasType(TokenType.MINUS ) )
                {
                    Node n ;
                    // One case; VARS line then *
                    if ( token.hasType(TokenType.STAR ) || ( token.isCtlCode() && token.getCntrlCode() == -1 ) )
                        n = lastLine.get(v) ;
                    else if ( token.hasType(TokenType.BNODE) )
                        n = Node.createAnon(new AnonId(NodeFmtLib.decodeBNodeLabel(token.getImage()))) ;
View Full Code Here

                              dtXSDdayTimeDuration.equals(nv2.getDatatypeURI()) ;
            boolean isYMDur = dtXSDyearMonthDuration.equals(nv1.getDatatypeURI()) &&
                              dtXSDyearMonthDuration.equals(nv2.getDatatypeURI()) ;
            Duration d3 = nv1.getDuration().add(nv2.getDuration()) ;
            String lex = d3.toString() ;
            Node n ;
            if ( isDTDur )
                n = NodeFactory.createLiteralNode(lex, null, dtXSDdayTimeDuration) ;
            else if ( isYMDur )
                n = NodeFactory.createLiteralNode(lex, null, dtXSDyearMonthDuration) ;
            else
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.