/** * Return the schema graph, if any, bound into this inference graph. */ @Override public Graph getSchemaGraph() { return fschema.getGraph(); }
/** * Constructor * @param data the raw data file to be augmented with entailments * @param reasoner the engine, with associated tbox data, whose find interface * can be used to extract all entailments from the data. */ public BaseInfGraph(Graph data, Reasoner reasoner) { super( ); this.fdata = new FGraph( data ); this.reasoner = reasoner; }
if (fdata != null) data = fdata.getGraph(); Graph oldDeductions = (fdeductions).getGraph(); oldDeductions.clear(); } else { fdeductions = new FGraph( createDeductionsGraph() ); FGraph finserts = new FGraph(inserts); dataSource = FinderUtil.cascade(fdata, finserts); dataFind = FinderUtil.cascade(dataFind, finserts); Graph rawPreload = ((InfGraph)schemaGraph).getRawGraph(); if (rawPreload != null) { dataFind = FinderUtil.cascade(dataFind, new FGraph(rawPreload));
/** * Internals of findWithContinuation implementation which allows control * over functor filtering. */ private ExtendedIterator<Triple> findWithContinuation(TriplePattern pattern, Finder continuation, boolean filter) { checkOpen(); this.requirePrepared(); ExtendedIterator<Triple> result = null; if (fdata == null) { result = fdeductions.findWithContinuation(pattern, continuation); } else { if (continuation == null) { result = fdata.findWithContinuation(pattern, fdeductions); } else { result = fdata.findWithContinuation(pattern, FinderUtil.cascade(fdeductions, continuation) ); } } if (filter && filterFunctors) { return result.filterDrop(Functor.acceptFilter); } else { return result; } }
if (fdata != null) data = fdata.getGraph(); Graph oldDeductions = (fdeductions).getGraph(); oldDeductions.clear(); } else { fdeductions = new FGraph( createDeductionsGraph() ); FGraph finserts = new FGraph(inserts); dataSource = FinderUtil.cascade(fdata, finserts); dataFind = FinderUtil.cascade(dataFind, finserts); Graph rawPreload = ((InfGraph)schemaGraph).getRawGraph(); if (rawPreload != null) { dataFind = FinderUtil.cascade(dataFind, new FGraph(rawPreload));
/** * Internals of findWithContinuation implementation which allows control * over functor filtering. */ private ExtendedIterator<Triple> findWithContinuation(TriplePattern pattern, Finder continuation, boolean filter) { checkOpen(); this.requirePrepared(); ExtendedIterator<Triple> result = null; if (fdata == null) { result = fdeductions.findWithContinuation(pattern, continuation); } else { if (continuation == null) { result = fdata.findWithContinuation(pattern, fdeductions); } else { result = fdata.findWithContinuation(pattern, FinderUtil.cascade(fdeductions, continuation) ); } } if (filter && filterFunctors) { return result.filterDrop(Functor.acceptFilter); } else { return result; } }
/** * Return the raw RDF data Graph being processed (i.e. the argument * to the Reasonder.bind call that created this InfGraph). */ @Override public Graph getRawGraph() { return fdata.getGraph(); }
/** * Constructor * @param data the raw data file to be augmented with entailments * @param reasoner the engine, with associated tbox data, whose find interface * can be used to extract all entailments from the data. */ public BaseInfGraph(Graph data, Reasoner reasoner) { super( ); this.fdata = new FGraph( data ); this.reasoner = reasoner; }
/** * Return the schema graph, if any, bound into this inference graph. */ @Override public Graph getSchemaGraph() { return fschema.getGraph(); }
/** * Replace the underlying data graph for this inference graph and start any * inferences over again. This is primarily using in setting up ontology imports * processing to allow an imports multiunion graph to be inserted between the * inference graph and the raw data, before processing. * @param data the new raw data graph */ @Override public synchronized void rebind(Graph data) { fdata = new FGraph(data); isPrepared = false; }
/** * Return the raw RDF data Graph being processed (i.e. the argument * to the Reasonder.bind call that created this InfGraph). */ @Override public Graph getRawGraph() { return fdata.getGraph(); }
/** * Replace the underlying data graph for this inference graph and start any * inferences over again. This is primarily using in setting up ontology imports * processing to allow an imports multiunion graph to be inserted between the * inference graph and the raw data, before processing. * @param data the new raw data graph */ @Override public synchronized void rebind(Graph data) { fdata = new FGraph(data); isPrepared = false; }
/** * Create a continuation object which is a cascade of two * continuation objects. * @param first the first Graph/Finder to try * @param second the second Graph/Finder to try */ public static Finder cascade(Finder first, Finder second) { if (first == null || (first instanceof FGraph && ((FGraph)first).getGraph() == null)) return second; if (second == null || (second instanceof FGraph && ((FGraph)second).getGraph() == null)) return first; return new Cascade(first, second); }
/** * Replace the underlying data graph for this inference graph and start any * inferences over again. This is primarily using in setting up ontology imports * processing to allow an imports multiunion graph to be inserted between the * inference graph and the raw data, before processing. * @param data the new raw data graph */ @Override public void rebind(Graph data) { fdata = new FGraph( data ); rebind(); }
/** * Create a continuation object which is a cascade of two * continuation objects. * @param first the first Graph/Finder to try * @param second the second Graph/Finder to try */ public static Finder cascade(Finder first, Finder second) { if (first == null || (first instanceof FGraph && ((FGraph)first).getGraph() == null)) return second; if (second == null || (second instanceof FGraph && ((FGraph)second).getGraph() == null)) return first; return new Cascade(first, second); }
/** * Replace the underlying data graph for this inference graph and start any * inferences over again. This is primarily using in setting up ontology imports * processing to allow an imports multiunion graph to be inserted between the * inference graph and the raw data, before processing. * @param data the new raw data graph */ @Override public void rebind(Graph data) { fdata = new FGraph( data ); rebind(); }
/** Answer true iff this graph is empty. [Used to be in QueryHandler, but moved in here because it's a more primitive operation.] */ @Override public boolean isEmpty() { return fdata.getGraph().isEmpty(); }
/** * Extracts all of the subClass and subProperty declarations from * the given schema/tbox and caches the resultant graphs. * It can only be used once, can't stack up multiple tboxes this way. * This limitation could be lifted - the only difficulty is the need to * reprocess all the earlier tboxes if a new subPropertyOf subPropertyOf * subClassOf is discovered. * @param tbox schema containing the property and class declarations */ @Override public Reasoner bindSchema(Graph tbox) throws ReasonerException { return bindSchema(new FGraph(tbox)); }
/** * Assert a new triple in the deduction graph, bypassing any processing machinery. */ @Override public void silentAdd(Triple t) { fdeductions.getGraph().add(t); }
/** * Extracts all of the subClass and subProperty declarations from * the given schema/tbox and caches the resultant graphs. * It can only be used once, can't stack up multiple tboxes this way. * This limitation could be lifted - the only difficulty is the need to * reprocess all the earlier tboxes if a new subPropertyOf subPropertyOf * subClassOf is discovered. * @param tbox schema containing the property and class declarations */ @Override public Reasoner bindSchema(Graph tbox) throws ReasonerException { return bindSchema(new FGraph(tbox)); }