public static <T extends RDFNode> ExtendedIterator<Statement> listProperties(Resource s, Property p, Class<T> clazz) { ExtendedIterator<Statement> result = listProperties(s, p) .filterKeep(stmt -> canAsProperty(stmt, clazz)); return result; }
public static <T> ExtendedIterator<Statement> listLiteralProperties(Resource s, Property p, Class<T> clazz) { ExtendedIterator<Statement> result = listProperties(s, p) .filterKeep(stmt -> canAsLiteral(stmt, clazz)); return result; }
public static <T extends Resource> ExtendedIterator<Statement> listReverseProperties(RDFNode s, Property p, Class<T> clazz) { ExtendedIterator<Statement> result = listReverseProperties(s, p) .filterKeep(stmt -> isReverseProperty(stmt, clazz)); return result; }
public static <T> ExtendedIterator<Statement> listProperties(Resource s, Property p, NodeMapper<T> nodeMapper) { ExtendedIterator<Statement> result = listProperties(s, p) .filterKeep(stmt -> canAsProperty(stmt, nodeMapper::canMap)); return result; }
for (Iterator<Statement> i = m.listStatements( start, null, (RDFNode) null ).filterKeep( onPath ); i.hasNext(); ) { bfs.add( new Path().append( i.next() ) ); for (Iterator<Statement> i = terminus.listProperties().filterKeep( onPath ); i.hasNext(); ) { Statement link = i.next();
for (Iterator<Statement> i = m.listStatements( start, null, (RDFNode) null ).filterKeep( onPath ); i.hasNext(); ) { bfs.add( new Path().append( i.next() ) ); for (Iterator<Statement> i = terminus.listProperties().filterKeep( onPath ); i.hasNext(); ) { Statement link = i.next();
@Override public StmtIterator listStatements( final Selector selector ) { StmtIterator sts = IteratorFactory.asStmtIterator( findTriplesFrom( selector ), this ); return selector.isSimple() ? sts : new StmtIteratorImpl( sts .filterKeep ( selector ) ) ; }
@Override public StmtIterator listStatements( final Selector selector ) { StmtIterator sts = IteratorFactory.asStmtIterator( findTriplesFrom( selector ), this ); return selector.isSimple() ? sts : new StmtIteratorImpl( sts .filterKeep ( selector ) ) ; }
protected ExtendedIterator<Statement> getStatementIterator(final Action perm) { return holder.getBaseItem().listProperties() .filterKeep(new ContainerFilter()) .filterKeep(new PermStatementFilter(perm, this)); }
protected ExtendedIterator<Statement> getStatementIterator( final Set<Action> perm) { return holder.getBaseItem().listProperties() .filterKeep(new ContainerFilter()) .filterKeep(new PermStatementFilter(perm, this)); }
/** * Determine whether this resource has any values for a given property. * * @param p * The property sought. * @return true if and only if this resource has at least one value for the * property. * @throws ReadDeniedException * @throws AuthenticationRequiredException */ @Override public boolean hasProperty(final Property p) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final ExtendedIterator<Statement> iter = holder.getBaseItem().listProperties(p) .filterKeep(new PermStatementFilter(Action.Read, this)); try { return iter.hasNext(); } finally { iter.close(); } }
/** * Test if this resource has a given property with a given value. * * @param p * The property sought. * @param o * The value of the property sought. * @return true if and only if this resource has property p with value o. * @throws ReadDeniedException * @throws AuthenticationRequiredException */ @Override public boolean hasProperty(final Property p, final RDFNode o) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final ExtendedIterator<Statement> iter = holder.getBaseItem().getModel().listStatements(this, p, o) .filterKeep(new PermStatementFilter(Action.Read, this)); try { return iter.hasNext(); } finally { iter.close(); } }
/** * Test if this resource has a given property with a given value. * * @param p * The property sought. * @param o * The value of the property sought. * @return true if and only if this resource has property p with value o. * @throws ReadDeniedException * @throws AuthenticationRequiredException */ @Override public boolean hasProperty(final Property p, final String o) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final ExtendedIterator<Statement> iter = holder.getBaseItem().getModel().listStatements(this, p, o) .filterKeep(new PermStatementFilter(Action.Read, this)); try { return iter.hasNext(); } finally { iter.close(); } }
ExtendedIterator<Statement> datastmts = data.listStatements().filterKeep(new Predicate<Statement>(){ @Override public boolean apply(Statement o) { ExtendedIterator<Statement> graphstmts = graph.listStatements().filterKeep(new Predicate<Statement>(){ @Override public boolean apply(Statement o) {
@Override public SecuredStatement getProperty(Property p, String lang) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final ExtendedIterator<Statement> iter = holder.getBaseItem().listProperties(p, lang) .filterKeep(new PermStatementFilter(Action.Read, this)); try { if (iter.hasNext()) { return org.apache.jena.permissions.model.impl.SecuredStatementImpl.getInstance(getModel(), iter.next()); } else { return null; } } finally { iter.close(); } }
@Override public SecuredStatement getRequiredProperty(Property p, String lang) throws PropertyNotFoundException, ReadDeniedException, AuthenticationRequiredException { checkRead(); final ExtendedIterator<Statement> iter = holder.getBaseItem().listProperties(p, lang) .filterKeep(new PermStatementFilter(Action.Read, this)); try { if (iter.hasNext()) { return org.apache.jena.permissions.model.impl.SecuredStatementImpl.getInstance(getModel(), iter.next()); } else { throw new PropertyNotFoundException(p); } } finally { iter.close(); } }
/** * Answer some statement (this, p, O) in the associated securedModel. If * there are several such statements, any one of them may be returned. If no * such statements exist, null is returned - in this is differs from * getRequiredProperty. * * @param p * the property sought * @return a statement (this, p, O), or null if no such statements exist * here * @throws ReadDeniedException * @throws AuthenticationRequiredException */ @Override public SecuredStatement getProperty(final Property p) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final ExtendedIterator<Statement> iter = holder.getBaseItem().listProperties(p) .filterKeep(new PermStatementFilter(Action.Read, this)); try { if (iter.hasNext()) { return org.apache.jena.permissions.model.impl.SecuredStatementImpl.getInstance(getModel(), iter.next()); } else { return null; } } finally { iter.close(); } }
/** * Test if this resource has a given property with a given value. * * @param p * The property sought. * @param o * The value of the property sought. * @param l * The language of the property sought. * @return true if and only if this resource has property p with value o. * @throws ReadDeniedException * @throws AuthenticationRequiredException */ @Override public boolean hasProperty(final Property p, final String o, final String l) throws ReadDeniedException, AuthenticationRequiredException { checkRead(); final Literal ll = holder.getBaseItem().getModel().createLiteral(o, l); final ExtendedIterator<Statement> iter = holder.getBaseItem().getModel().listStatements(this, p, ll) .filterKeep(new PermStatementFilter(Action.Read, this)); try { return iter.hasNext(); } finally { iter.close(); } }
checkRead(); final ExtendedIterator<Statement> iter = holder.getBaseItem().listProperties(p) .filterKeep(new PermStatementFilter(Action.Read, this)); try { if (iter.hasNext()) {
public static void assertPropertyValues(final Model model, final Property pred, final Model inferences) { final Predicate<Statement> predFilter = stmt -> stmt.getPredicate().equals(pred); for (final StmtIterator i = inferences.listStatements(); i.hasNext();) { final Statement statement = i.nextStatement(); assertEquals(pred, statement.getPredicate()); assertTrue(statement + " not inferred", model.contains(statement)); } assertIteratorValues(model.listStatements(null, pred, (RDFNode) null), inferences.listStatements()); final Set<Resource> testedSubj = new HashSet<>(); final Set<RDFNode> testedObj = new HashSet<>(); for (final StmtIterator i = inferences.listStatements(); i.hasNext();) { final Statement statement = i.nextStatement(); final Resource subj = statement.getSubject(); final RDFNode obj = statement.getObject(); if (testedSubj.add(subj)) { assertIteratorValues(model.listStatements(subj, pred, (RDFNode) null), inferences.listStatements(subj, pred, (RDFNode) null)); assertIteratorValues(model.listStatements(subj, null, (RDFNode) null).filterKeep(predFilter), inferences.listStatements(subj, null, (RDFNode) null).filterKeep(predFilter)); } if (testedObj.add(obj)) { assertIteratorValues(model.listStatements(null, pred, obj), inferences.listStatements(null, pred, obj)); assertIteratorValues(model.listStatements(null, null, obj).filterKeep(predFilter), inferences.listStatements(null, null, obj).filterKeep(predFilter)); } } }