@Override public boolean contains(Resource subj, IRI pred, Value obj, Resource... contexts) { return model.contains(subj, pred, obj, contexts); }
protected boolean accept(Statement stmt) { return !excluded.contains(stmt); } };
@Override public boolean contains(Resource subj, IRI pred, Value obj, Resource... contexts) { return model.contains(subj, pred, obj, contexts); }
/** * @deprecated since 4.0. Use {@link #contains(Resource, IRI, Value, Resource...)} instead. */ @Deprecated public default boolean contains(Resource subj, URI pred, Value obj, Resource... contexts) { return contains(subj, (IRI)pred, obj, contexts); }
/** * @deprecated since 4.0. Use {@link #contains(Resource, IRI, Value, Resource...)} instead. */ @Deprecated public default boolean contains(Resource subj, URI pred, Value obj, Resource... contexts) { return contains(subj, (IRI)pred, obj, contexts); }
@Override public Set<Type> decide(Model model, Resource resource) { if (model.contains(resource, Rr.parentTriplesMap, null)) { if (model.contains(resource, Carml.multiJoinCondition, null)) { return ImmutableSet.of(CarmlMultiRefObjectMap.class); } else { return ImmutableSet.of(CarmlRefObjectMap.class); } } else if (isMultiObjectMap(model, resource)) { return ImmutableSet.of(CarmlMultiObjectMap.class); } return ImmutableSet.of(CarmlObjectMap.class); }
@Override public Set<Type> decide(Model model, Resource resource) { if (model.contains(resource, Rr.parentTriplesMap, null)) { if (model.contains(resource, Carml.multiJoinCondition, null)) { return ImmutableSet.of(CarmlMultiRefObjectMap.class); } else { return ImmutableSet.of(CarmlRefObjectMap.class); } } else if (isMultiObjectMap(model, resource)) { return ImmutableSet.of(CarmlMultiObjectMap.class); } return ImmutableSet.of(CarmlObjectMap.class); }
public boolean contains(Resource subj, IRI pred, Value obj, Resource... contexts) { return getDelegate().contains(subj, pred, obj, contexts); }
public boolean contains(Resource subj, IRI pred, Value obj, Resource... contexts) { return getDelegate().contains(subj, pred, obj, contexts); }
@Override public boolean contains(Resource s, IRI p, Value o, Resource... c) { if (s == null) { s = subj; } if (p == null) { p = pred; } if (o == null) { o = obj; } if (c != null && c.length == 0) { c = contexts; } if (!accept(s, p, o, c)) { return false; } return model.contains(s, p, o, c); }
@Override public boolean contains(Resource s, IRI p, Value o, Resource... c) { if (s == null) { s = subj; } if (p == null) { p = pred; } if (o == null) { o = obj; } if (c != null && c.length == 0) { c = contexts; } if (!accept(s, p, o, c)) { return false; } return model.contains(s, p, o, c); }
public static boolean isInstanceOf(Model theGraph, Resource theSubject, Resource theType) { return theGraph.contains(SimpleValueFactory.getInstance().createStatement(theSubject, RDF.TYPE, theType)); } }
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"))); } } }
@Override public synchronized void deprecate(Resource subj, IRI pred, Value obj, Resource ctx) { if (approved != null) { approved.remove(subj, pred, obj, ctx); } if (deprecated == null) { deprecated = createEmptyModel(); } deprecated.add(subj, pred, obj, ctx); if (approvedContexts != null && approvedContexts.contains(ctx) && !approved.contains(null, null, null, ctx)) { approvedContexts.remove(ctx); } }
private boolean isStillReferenced(SubjectInContext key) { if (blanks.contains(null, null, key.getSubject(), key.getContext())) { return true; } for (SubjectInContext subj : stack) { Set<Statement> stmts = stmtBySubject.get(subj); if (stmts != null) { for (Statement st : stmts) { if (st.getObject().equals(key.getSubject()) || Objects.equals(st.getContext(), key.getContext())) { return true; } } } } return false; }
private boolean isStillReferenced(SubjectInContext key) { if (blanks.contains(null, null, key.getSubject(), key.getContext())) { return true; } for (SubjectInContext subj : stack) { Set<Statement> stmts = stmtBySubject.get(subj); if (stmts != null) { for (Statement st : stmts) { if (st.getObject().equals(key.getSubject()) || Objects.equals(st.getContext(), key.getContext())) { return true; } } } } return false; }
private static boolean matchModels(Model model1, Model model2) { // Compare statements without blank nodes first, save the rest for later List<Statement> model1BNodes = new ArrayList<Statement>(model1.size()); for (Statement st : model1) { if (isBlank(st.getSubject()) || isBlank(st.getObject()) || isBlank(st.getContext())) { model1BNodes.add(st); } else { if (!model2.contains(st)) { return false; } } } return matchModels(model1BNodes, model2, new HashMap<Resource, Resource>(), 0); }
private static boolean matchModels(Model model1, Model model2) { // Compare statements without blank nodes first, save the rest for later List<Statement> model1BNodes = new ArrayList<>(model1.size()); for (Statement st : model1) { if (isBlank(st.getSubject()) || isBlank(st.getObject()) || isBlank(st.getContext())) { model1BNodes.add(st); } else { if (!model2.contains(st)) { return false; } } } return matchModels(model1BNodes, model2, new HashMap<>(), 0); }