public RuleProcessor(final Ruleset ruleset, @Nullable final Mapper mapper, final boolean dropBNodeTypes, @Nullable final RDFSource staticData, final boolean emitStatic, @Nullable final URI staticContext) { // Setup the handler receiving closure of static data, if any. final List<Statement> staticClosure = new ArrayList<>(); RDFHandler staticSink = RDFHandlers.NIL; if (staticData != null && emitStatic) { staticSink = RDFHandlers.wrap(staticClosure); if (staticContext != null) { final URI uri = staticContext.equals(SESAME.NIL) ? null : staticContext; staticSink = new AbstractRDFHandlerWrapper(staticSink) { @Override public void handleStatement(final Statement stmt) throws RDFHandlerException { super.handleStatement(Statements.VALUE_FACTORY.createStatement( stmt.getSubject(), stmt.getPredicate(), stmt.getObject(), uri)); } }; } } // Build the dynamic rule engine by closing static data and proprocessing rules final RuleEngine engine = preprocess(ruleset, staticData, staticSink); // Setup object this.engine = engine; this.mapper = mapper; this.staticClosure = RDFSources.wrap(staticClosure); this.dropBNodeTypes = dropBNodeTypes; }
@Override public void map(final QuadModel model) throws Exception { final List<Statement> statements = new ArrayList<>(); final RDFSource source = RDFSources.wrap(model); final RDFHandler handler = RDFHandlers.wrap(statements); processor.wrap(source).emit(handler, 1); model.addAll(statements); }
MDC.put("context", docName); filter.filter(document); final RDFSource source = RDFSources.wrap(Runner.this.generator .generate(document, null));
RDFProcessors.smush("http://dbpedia.org/resource/").wrap(RDFSources.wrap(stmts)) .emit(RDFHandlers.wrap(smushedStmts), 1);
: this.statements; if (RDFGenerator.this.normalization) { statements = new ProcessorASNorm("fact:").wrap(RDFSources.wrap(statements));