private static Graph unwrap(Graph graph) { for (;;) { if ( graph instanceof InfGraph ) { graph = ((InfGraph)graph).getRawGraph(); continue; } Graph graph2 = GraphOps.unwrapOne(graph); if ( graph2 == graph ) return graph; graph = graph2; } }
/** Sync a TDB-backed Graph. Do nothing if not TDB-backed. */ public static void sync(Graph graph) { if ( graph == null ) return ; if ( graph instanceof InfGraph ) { InfGraph infGraph = (InfGraph)graph ; sync(infGraph.getRawGraph()) ; return ; } syncObject(graph) ; }
/** * Return the raw RDF model being processed (i.e. the argument * to the Reasoner.bind call that created this InfModel). */ @Override public Model getRawModel() { return new ModelCom(getInfGraph().getRawGraph()); }
/** * Return the raw RDF model being processed (i.e. the argument * to the Reasoner.bind call that created this InfModel). */ @Override public Model getRawModel() { return new ModelCom(getInfGraph().getRawGraph()); }
private static Object calcKey(Graph graph) { if ( graph instanceof GraphView ) // Use the database as the key so that transactions are started once-per-storage. // This the case of a graph from some storage being placed in a general dataset. return ((GraphView)graph).getDataset(); if ( graph instanceof InfGraph ) // InfGraph TransactionHandler passes the graph transaction to the base graph. // This calcKey allows the base graph to be included in the dataset as well as the InfGraph. return calcKey(((InfGraph)graph).getRawGraph()); // These should be handled by their respective graph transaction handler // or the graph is overriding that behaviour for some reason. // if ( graph instanceof GraphWrapper ) // return calcKey(((GraphWrapper)graph).get()); // if ( graph instanceof WrappedGraph ) // return calcKey(((WrappedGraph)graph).getWrapped()); return graph; }
public NodeFormatter(final Model model) { if (model == null) throw new NullPointerException("No model given!"); //_renderer = new ATermAbstractSyntaxRenderer(); _renderer = new ATermManchesterSyntaxRenderer(); _sw = new StringWriter(); _formatter = new PrintWriter(_sw); _renderer.setWriter(_formatter); _qnames = JenaUtils.makeQNameProvider(model); // _formatter.setQNames(_qnames); if (model instanceof InfModel) { final InfGraph graph = (InfGraph) model.getGraph(); _rawModel = ModelFactory.createModelForGraph(graph.getRawGraph()); } else _rawModel = model; }
public NodeFormatter(final Model model) { if (model == null) throw new NullPointerException("No model given!"); //_renderer = new ATermAbstractSyntaxRenderer(); _renderer = new ATermManchesterSyntaxRenderer(); _sw = new StringWriter(); _formatter = new PrintWriter(_sw); _renderer.setWriter(_formatter); _qnames = JenaUtils.makeQNameProvider(model); // _formatter.setQNames(_qnames); if (model instanceof InfModel) { final InfGraph graph = (InfGraph) model.getGraph(); _rawModel = ModelFactory.createModelForGraph(graph.getRawGraph()); } else _rawModel = model; }
public NodeFormatter(final Model model) { if (model == null) throw new NullPointerException("No model given!"); //_renderer = new ATermAbstractSyntaxRenderer(); _renderer = new ATermManchesterSyntaxRenderer(); _sw = new StringWriter(); _formatter = new PrintWriter(_sw); _renderer.setWriter(_formatter); _qnames = JenaUtils.makeQNameProvider(model); // _formatter.setQNames(_qnames); if (model instanceof InfModel) { final InfGraph graph = (InfGraph) model.getGraph(); _rawModel = ModelFactory.createModelForGraph(graph.getRawGraph()); } else _rawModel = model; }
private static void syncGraph(Graph graph) { // "Temporary" hack. Graph ought to implement sync and casade it down. if ( graph instanceof InfGraph ) syncGraph(((InfGraph)graph).getRawGraph()) ; else if ( graph instanceof Polyadic ) // MultiUnion // Only the base graph is updatable. syncGraph(((Polyadic)graph).getBaseGraph()) ; else if ( graph instanceof GraphWrapper ) syncGraph(((GraphWrapper)graph).get()) ; else if ( graph instanceof WrappedGraph ) syncGraph(((WrappedGraph)graph).getWrapped()) ; else syncObject(graph) ; }
public void testInfGraph() { InfGraph ig = getInfGraph(); assertSame( ig.getPrefixMapping(), ig.getRawGraph().getPrefixMapping() ); } }
public void testInfGraph() { InfGraph ig = getInfGraph(); assertSame( ig.getPrefixMapping(), ig.getRawGraph().getPrefixMapping() ); } }
public void testInfGraph() { InfGraph ig = getInfGraph(); assertSame( ig.getPrefixMapping(), ig.getRawGraph().getPrefixMapping() ); } }
public void testInfGraph() { InfGraph ig = getInfGraph(); assertSame( ig.getPrefixMapping(), ig.getRawGraph().getPrefixMapping() ); } }
private void collectLeafGraphs(final Graph graph, final Set<Graph> prevLeaves) { if (graph instanceof Polyadic) { final Polyadic union = (Polyadic) graph; if (union.getBaseGraph() != null) collectLeafGraphs(union.getBaseGraph(), prevLeaves); for (final Graph graph2 : union.getSubGraphs()) collectLeafGraphs(graph2, prevLeaves); } else if (graph instanceof Dyadic) { final Dyadic dyadic = (Dyadic) graph; if (dyadic.getL() instanceof Graph) collectLeafGraphs((Graph) dyadic.getL(), prevLeaves); if (dyadic.getR() instanceof Graph) collectLeafGraphs((Graph) dyadic.getR(), prevLeaves); } else if (graph instanceof InfGraph) collectLeafGraphs(((InfGraph) graph).getRawGraph(), prevLeaves); else if (_leafGraphs.add(graph) && !prevLeaves.contains(graph)) { _changedGraphs.add(graph); graph.getEventManager().register(this); } }
private void collectLeafGraphs(final Graph graph, final Set<Graph> prevLeaves) { if (graph instanceof Polyadic) { final Polyadic union = (Polyadic) graph; if (union.getBaseGraph() != null) collectLeafGraphs(union.getBaseGraph(), prevLeaves); for (final Graph graph2 : union.getSubGraphs()) collectLeafGraphs(graph2, prevLeaves); } else if (graph instanceof Dyadic) { final Dyadic dyadic = (Dyadic) graph; if (dyadic.getL() instanceof Graph) collectLeafGraphs((Graph) dyadic.getL(), prevLeaves); if (dyadic.getR() instanceof Graph) collectLeafGraphs((Graph) dyadic.getR(), prevLeaves); } else if (graph instanceof InfGraph) collectLeafGraphs(((InfGraph) graph).getRawGraph(), prevLeaves); else if (_leafGraphs.add(graph) && !prevLeaves.contains(graph)) { _changedGraphs.add(graph); graph.getEventManager().register(this); } }
private void collectLeafGraphs(final Graph graph, final Set<Graph> prevLeaves) { if (graph instanceof Polyadic) { final Polyadic union = (Polyadic) graph; if (union.getBaseGraph() != null) collectLeafGraphs(union.getBaseGraph(), prevLeaves); for (final Graph graph2 : union.getSubGraphs()) collectLeafGraphs(graph2, prevLeaves); } else if (graph instanceof Dyadic) { final Dyadic dyadic = (Dyadic) graph; if (dyadic.getL() instanceof Graph) collectLeafGraphs((Graph) dyadic.getL(), prevLeaves); if (dyadic.getR() instanceof Graph) collectLeafGraphs((Graph) dyadic.getR(), prevLeaves); } else if (graph instanceof InfGraph) collectLeafGraphs(((InfGraph) graph).getRawGraph(), prevLeaves); else if (_leafGraphs.add(graph) && !prevLeaves.contains(graph)) { _changedGraphs.add(graph); graph.getEventManager().register(this); } }
(MultiUnion) ((InfGraph) getGraph()).getRawGraph();
(MultiUnion) ((InfGraph) getGraph()).getRawGraph();
public void headAction(Node[] args, int length, RuleContext context) { InfGraph inf = context.getGraph(); Graph raw = inf.getRawGraph(); Graph deductions = inf.getDeductionsGraph(); for (int i = 0; i < length; i++) {
public void headAction(Node[] args, int length, RuleContext context) { InfGraph inf = context.getGraph(); Graph raw = inf.getRawGraph(); Graph deductions = inf.getDeductionsGraph(); for (int i = 0; i < length; i++) {