@Override public long size(Resource... contexts) throws RepositoryException { return committed.filter(null, null, null, contexts).size(); }
private IRI getFunctionIRI(Resource execution, Model model) { return Models.objectIRI( model.filter(execution, Rdf.Fno.executes, null) ) .orElseThrow(() -> new RuntimeException( "function execution does not have fno:executes value")); }
@Override protected void removeWithoutCommit(Resource subj, IRI pred, Value obj, Resource... contexts) throws RepositoryException { Model model = committed.filter(subj, pred, obj, contexts); removed.addAll(model); }
private static Optional<Literal> backCompatibilityFilterObjectLiteral(Model graph, Resource subject, IRI predicate) { Optional<Literal> value = Models.objectLiteral(graph.filter(subject, predicate, null)); return value.isPresent() ? value : Models.objectLiteral(graph.filter(subject, BACK_COMPATIBILITY_MAP.get(predicate), null)); } }
@Override public Object extract(Model model, Resource subject) { Model paramValues = model.filter(subject, iri, null); List<Value> values = paramValues.stream() .map(Statement::getObject) .collect(ImmutableCollectors.toImmutableList()); return adapter.apply(values); } };
public static Model getRepositoryConfigModel(Model model, String repositoryID) { Statement idStatement = getIDStatement(model, repositoryID); if (idStatement == null) { // No such config return null; } return model.filter(null, null, null, idStatement.getContext()); }
public static Model getRepositoryConfigModel(Model model, String repositoryID) { Statement idStatement = getIDStatement(model, repositoryID); if (idStatement == null) { // No such config return null; } return model.filter(null, null, null, idStatement.getContext()); }
@Override public Iterator<Statement> iterator() { return getDelegate().filter(subj, pred, obj, contexts).iterator(); }
@Override public int size() { return getDelegate().filter(subj, pred, obj, contexts).size(); }
public void parse(Model model, Resource resource) throws RepositoryConfigException { Models.objectLiteral(model.filter(resource, REPOSITORYTYPE, null)).ifPresent( typeLit -> setType(typeLit.getLabel())); }
@Override public void parse(Model model, Resource resource) throws RepositoryConfigException { Models.objectLiteral(model.filter(resource, REPOSITORYTYPE, null)).ifPresent( typeLit -> setType(typeLit.getLabel())); }
public static Set<String> getRepositoryIDs(Model model) throws RepositoryException { Set<String> idSet = new LinkedHashSet<String>(); model.filter(null, REPOSITORYID, null).forEach(idStatement -> { if (idStatement.getObject() instanceof Literal) { Literal idLiteral = (Literal)idStatement.getObject(); idSet.add(idLiteral.getLabel()); } }); return idSet; }
@Override public RepositoryResult<Statement> getStatements(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) throws RepositoryException { Model model = committed.filter(subj, pred, obj, contexts); CloseableIteration<Statement, RepositoryException> iter; iter = new CloseableIteratorIteration<>(model.iterator()); return new RepositoryResult<>(iter); }
@Override public void parse(Model model, Resource resource) throws RepositoryConfigException { super.parse(model, resource); Models.objectResource(model.filter(resource, DELEGATE, null)).ifPresent( delegate -> setDelegate(create(model, delegate))); } }
@Override public void parse(Model model, Resource resource) throws RepositoryConfigException { super.parse(model, resource); Models.objectResource(model.filter(resource, DELEGATE, null)).ifPresent( delegate -> setDelegate(create(model, delegate))); } }
private void extractClassHierarchy(Model model, Resource classResource) { for (Value object: model.filter(classResource, RDFS.SUBCLASSOF, null).objects()){ if (object instanceof IRI){ db.execute(String.format( "MATCH (p:Class { uri:'%s'}), (c { uri:'%s'}) MERGE (p)-[:SCO]->(c)", classResource.stringValue(), object.stringValue())); } } }
public static RepositoryConfig getRepositoryConfig(Model model, String repositoryID) { Statement idStatement = getIDStatement(model, repositoryID); if (idStatement == null) { // No such config return null; } Resource repositoryNode = idStatement.getSubject(); Resource context = idStatement.getContext(); Model contextGraph = model.filter(null, null, null, context); return RepositoryConfig.create(contextGraph, repositoryNode); }
public static RepositoryConfig getRepositoryConfig(Model model, String repositoryID) { Statement idStatement = getIDStatement(model, repositoryID); if (idStatement == null) { // No such config return null; } Resource repositoryNode = idStatement.getSubject(); Resource context = idStatement.getContext(); Model contextGraph = model.filter(null, null, null, context); return RepositoryConfig.create(contextGraph, repositoryNode); }
@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); }
private void extractPropertyHierarchy(Model model, Resource propResource, IRI propType) { for (Value object: model.filter(propResource, RDFS.SUBPROPERTYOF, null).objects()){ if (object instanceof IRI && (model.contains((IRI)object,RDF.TYPE, OWL.OBJECTPROPERTY) || model.contains((IRI)object,RDF.TYPE, OWL.DATATYPEPROPERTY) || model.contains((IRI)object,RDF.TYPE, RDF.PROPERTY))){ db.execute(String.format( "MATCH (p:%s { uri:'%s'}), (c { uri:'%s'}) MERGE (p)-[:%s]->(c)", getNeoEquivalentForProp(propType), propResource.stringValue(), object.stringValue(), (propType.equals(OWL.DATATYPEPROPERTY)?"SPO":"SRO"))); } } }