/** * Creates a new BufferedGroupedWriter that wraps the supplied handlers, using the supplied buffer size. * * @param bufferSize * size of the buffer expressed in number of RDF statements * @param handlers * one or more wrapped RDFHandlers */ public BufferedGroupingRDFHandler(int bufferSize, RDFHandler... handlers) { super(handlers); this.bufferSize = bufferSize; this.bufferedStatements = new GraphImpl(); this.contexts = new HashSet<Resource>(); }
public GraphImpl(ValueFactory valueFactory, Collection<? extends Statement> statements) { this(valueFactory); addAll(statements); }
public GraphImpl(ValueFactory valueFactory) { super(); statements = new LinkedList<Statement>(); setValueFactory(valueFactory); }
@Override public Iterator<Statement> match(Resource subj, IRI pred, Value obj, Resource... contexts) { OpenRDFUtil.verifyContextNotNull(contexts); return new PatternIterator(iterator(), subj, pred, obj, contexts); }
public boolean add(Resource subj, IRI pred, Value obj, Resource... contexts) { OpenRDFUtil.verifyContextNotNull(contexts); boolean graphChanged = false; if (contexts.length == 0) { graphChanged = add(valueFactory.createStatement(subj, pred, obj)); } else { for (Resource context : contexts) { graphChanged |= add(valueFactory.createStatement(subj, pred, obj, context)); } } return graphChanged; }
public Iterator<Statement> match(Resource subj, IRI pred, Value obj, Resource... contexts) { OpenRDFUtil.verifyContextNotNull(contexts); return new PatternIterator(iterator(), subj, pred, obj, contexts); }
@Override public boolean add(Resource subj, IRI pred, Value obj, Resource... contexts) { OpenRDFUtil.verifyContextNotNull(contexts); boolean graphChanged = false; if (contexts.length == 0) { graphChanged = add(valueFactory.createStatement(subj, pred, obj)); } else { for (Resource context : contexts) { graphChanged |= add(valueFactory.createStatement(subj, pred, obj, context)); } } return graphChanged; }
/** * Creates a new BufferedGroupedWriter that wraps the supplied handlers, using the supplied buffer size. * * @param bufferSize * size of the buffer expressed in number of RDF statements * @param handlers * one or more wrapped RDFHandlers */ public BufferedGroupingRDFHandler(int bufferSize, RDFHandler... handlers) { super(handlers); this.bufferSize = bufferSize; this.bufferedStatements = new GraphImpl(); this.contexts = new HashSet<Resource>(); }
public GraphImpl(ValueFactory valueFactory) { super(); statements = new LinkedList<>(); setValueFactory(valueFactory); }
public GraphImpl(ValueFactory valueFactory, Collection<? extends Statement> statements) { this(valueFactory); addAll(statements); }
/** * Creates a new BufferedGroupedWriter that wraps the supplied handlers, using the supplied buffer size. * * @param bufferSize * size of the buffer expressed in number of RDF statements * @param handlers * one or more wrapped RDFHandlers */ public BufferedGroupingRDFHandler(int bufferSize, RDFHandler... handlers) { super(handlers); this.bufferSize = bufferSize; this.bufferedStatements = new GraphImpl(); this.contexts = new HashSet<>(); }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); setValueFactory(SimpleValueFactory.getInstance()); }
public static Graph toGraph(TupleQueryResult tqr) throws QueryEvaluationException { Graph graph = new GraphImpl(); DAWGTestResultSetWriter writer = new DAWGTestResultSetWriter(new StatementCollector(graph)); try { writer.startQueryResult(tqr.getBindingNames()); while (tqr.hasNext()) { writer.handleSolution(tqr.next()); } writer.endQueryResult(); } catch (TupleQueryResultHandlerException e) { // No exceptions expected from DAWGTestResultSetWriter or // StatementCollector, foud a bug? throw new RuntimeException(e); } return graph; }
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject(); setValueFactory(SimpleValueFactory.getInstance()); }
public static Graph toGraph(TupleQueryResult tqr) throws QueryEvaluationException { Graph graph = new GraphImpl(); DAWGTestResultSetWriter writer = new DAWGTestResultSetWriter(new StatementCollector(graph)); try { writer.startQueryResult(tqr.getBindingNames()); while (tqr.hasNext()) { writer.handleSolution(tqr.next()); } writer.endQueryResult(); } catch (TupleQueryResultHandlerException e) { // No exceptions expected from DAWGTestResultSetWriter or // StatementCollector, foud a bug? throw new RuntimeException(e); } return graph; }
public static Graph toGraph(TupleQueryResult tqr) throws QueryEvaluationException { Graph graph = new GraphImpl(); DAWGTestResultSetWriter writer = new DAWGTestResultSetWriter(new StatementCollector(graph)); try { writer.startQueryResult(tqr.getBindingNames()); while (tqr.hasNext()) { writer.handleSolution(tqr.next()); } writer.endQueryResult(); } catch (TupleQueryResultHandlerException e) { // No exceptions expected from DAWGTestResultSetWriter or // StatementCollector, foud a bug? throw new RuntimeException(e); } return graph; }