/** * Creates a {@link Statement}. * @param s subject {@link org.eclipse.rdf4j.model.Resource} * @param p predicate {@link org.eclipse.rdf4j.model.URI} * @param o object {@link org.eclipse.rdf4j.model.Value} * @return valid {@link org.eclipse.rdf4j.model.Statement} */ public static Statement triple(Resource s, org.eclipse.rdf4j.model.IRI p, Value o) { return valueFactory.createStatement(s, p, o); }
/** * Creates a {@link Statement}. * @param s subject. * @param p predicate. * @param o object. * @param g quad resource * @return a statement instance. */ public static Statement quad(Resource s, org.eclipse.rdf4j.model.IRI p, Value o, Resource g) { return valueFactory.createStatement(s, p, o, g); }
/** * Creates a new {@link Statement} object with the supplied components. */ protected Statement createStatement(Resource subj, IRI pred, Value obj, Resource context) throws RDFParseException { try { return valueFactory.createStatement(subj, pred, obj, context); } catch (Exception e) { reportFatalError(e); return null; // required by compiler } }
private void reportStatement(Resource subject, IRI predicate, Value object) throws RDFHandlerException { rdfHandler.handleStatement(vf.createStatement(subject, predicate, object)); }
protected void addTriple(Resource subject, IRI predicate, Value object) { try { handler.handleStatement(valueFactory.createStatement(subject, predicate, object)); } catch(RDFHandlerException e) { // TODO: provide standard way to handle exceptions inside of triple sinks throw new RuntimeException(e); } }
public void writeTripleValueObject(Resource subject, IRI predicate, Value object) throws RDFHandlerException { this.tripleCount++; this.writer.handleStatement(factory.createStatement(subject, predicate, object)); }
private void reportStatement(Resource subject, IRI predicate, Value object) throws RDFHandlerException { rdfHandler.handleStatement(vf.createStatement(subject, predicate, object)); }
/** * Creates a new {@link Statement} object with the supplied components. */ protected Statement createStatement(Resource subj, IRI pred, Value obj, Resource context) throws RDFParseException { try { return valueFactory.createStatement(subj, pred, obj, context); } catch (Exception e) { reportFatalError(e); return null; // required by compiler } }
protected void addQuad(Resource subject, IRI predicate, Value object, Resource graph) { try { handler.handleStatement(valueFactory.createStatement(subject, predicate, object, graph)); } catch(RDFHandlerException e) { // TODO: provide standard way to handle exceptions inside of triple sinks throw new RuntimeException(e); } }
@Override protected void addWithoutCommit(Resource subject, IRI predicate, Value object, Resource... contexts) throws RepositoryException { ValueFactory f = getValueFactory(); Statement st = f.createStatement(subject, predicate, object); List<Statement> list = new ArrayList<Statement>(1); list.add(st); String sparqlCommand = createInsertDataCommand(list, contexts); sparqlTransaction.append(sparqlCommand); sparqlTransaction.append("; "); }
/** * Creates a statement of type: <code>toValue(s), toValue(p), toValue(o)</code> * * @param s subject. * @param p predicate. * @param o object. * @return a statement instance. */ public static Statement triple(String s, String p, String o) { return valueFactory.createStatement((Resource) toValue(s), (org.eclipse.rdf4j.model.IRI) toValue(p), toValue(o)); }
@Override public void meet(ExtensionElem node) throws RDFHandlerException { listEntry(); handler.handleStatement(valueFactory.createStatement(subject, RDF.TYPE, SP.BIND_CLASS)); Resource var = getVar(node.getName()); handler.handleStatement(valueFactory.createStatement(subject, SP.VARIABLE_PROPERTY, var)); meet(node.getExpr()); }
@Override public void meet(IRIFunction node) throws RDFHandlerException { Resource currentSubj = subject; flushPendingStatement(); handler.handleStatement(valueFactory.createStatement(subject, RDF.TYPE, SP.IRI)); predicate = SP.ARG1_PROPERTY; node.getArg().visit(this); subject = currentSubj; predicate = null; }
@Override public void meet(Bound node) throws RDFHandlerException { Resource currentSubj = subject; flushPendingStatement(); handler.handleStatement(valueFactory.createStatement(subject, RDF.TYPE, SP.BOUND)); predicate = SP.ARG1_PROPERTY; node.getArg().visit(this); subject = currentSubj; predicate = null; }
@Override public Set makeEmptySet() { Model model = makeEmptyModel(); model.add(vf.createStatement(RDF.TYPE, RDF.TYPE, RDF.PROPERTY, createURI("hidden"))); return model.filter(null, null, null, ctx0, ctx1); }
protected Statement convert(Statement st) { if (st.getContext() == null) return getValueFactory().createStatement(st.getSubject(), st.getPredicate(), st.getObject(), removeContexts[0]); return st; } });
protected Statement convert(Statement st) { if (st.getContext() == null) return getValueFactory().createStatement(st.getSubject(), st.getPredicate(), st.getObject(), insertContext); return st; } });
private void visitWhere(TupleExpr where) throws RDFHandlerException { Resource whereBNode = valueFactory.createBNode(); handler.handleStatement(valueFactory.createStatement(subject, SP.WHERE_PROPERTY, whereBNode)); isSubQuery = true; // further projection elements are for // sub-queries ListContext ctx = newList(whereBNode); where.visit(this); endList(ctx); }
private static Statement createStatement(ClassAssertion assertion) { return fact.createStatement(getResource(assertion.getIndividual()), RDF.TYPE, createURI(assertion.getConcept().getIRI().getIRIString())); } }
@Override public void meet(InsertData node) throws RDFHandlerException { Resource dataList = valueFactory.createBNode(); handler.handleStatement(valueFactory.createStatement(subject, SP.DATA_PROPERTY, dataList)); ListContext dataCtx = newList(dataList); renderDataBlock(node.getDataBlock()); endList(dataCtx); }