private TripleConsumerAdapter(final Property property, final Individual<?, ?> individual, final DataSetHelperImpl.TripleConsumer consumer) { this.predicate = property.predicate(); this.individual = individual; this.consumer = consumer; }
@Override public void visitLiteral(Literal<?> value) { if(!property.hasLiteralValue(value)) { log.addRemovedValue(property,value); } } @Override
@Override public boolean hasIdentifiedIndividual(Object id) { return this.property.hasIdentifiedIndividual(id); }
public static ValidationConstraint<Property> readOnlyProperty(Property property) { checkNotNull(property,PROPERTY_CANNOT_BE_NULL); return new ReadOnlyPropertyValidationConstraint(property.individual().id(), property.predicate(), property.values()); }
private final boolean mustBeAnalyzed(Property property) { return this.predicate.equals(property.predicate()) && (this.individualId==null || this.individualId.equals(property.individual().id())); }
@Override public Collection<? extends Value> values() { return this.property.values(); }
individual.property(DynamicResourceUpdater.REFRESHED_ON).numberOfValues(),greaterThanOrEqualTo(1)); assertThat( individual.property(DynamicResourceResolver.SNAPSHOT_ENDPOINT).hasLiteralValue(Literals.newLiteral(ENDPOINT)),equalTo(true)); assertThat( individual.property(DynamicResourceResolver.SNAPSHOT_RESOLUTION).hasLiteralValue(Literals.of("OK")),equalTo(true));
@Override public Individual<?, ?> individual() { return this.property.individual(); }
@Override public void accept(ValueVisitor visitor) { this.property.accept(visitor); }
@Override public int numberOfValues() { return this.property.numberOfValues(); }
public static ValidationConstraint<Property> mandatoryPropertyValues(Property property) { checkNotNull(property,INDIVIDUAL_IDENTIFIER_CANNOT_BE_NULL); return new MandatoryPropertyValuesValidationConstraint(property.individual().id(), property.predicate(), property.values()); }
public static boolean hasValue(Value value, Property property) { return hasValue(value,property.values()); }
protected static boolean sameIndividual(Property one, Property another) { return one.individual().id().equals(another.individual().id()); }
void generateTriples(Individual<?,?> individual) { Object id = individual.id(); if(!visitedIndividuals.contains(id)) { Resource<?> resource = toResource(individual); if(resource==null) { // Could not resolve resource, so skip processing return; } visitedIndividuals.add(id); for(Property property:individual) { property.accept(new TripleGenerator(resource,property)); } } }
@Override public URI predicate() { return this.property.predicate(); }
@Override public boolean hasLiteralValue(Literal<?> value) { return this.property.hasLiteralValue(value); }
static boolean hasIdentifiedIndividual(Property property, Object id) { return hasValue(new IndividualReferenceMatcher(id),property.values()); }
@Override public void visitIndividual(Individual<?, ?> value) { if(!property.hasIdentifiedIndividual(value.id())) { log.addRemovedValue(property,value); } } };
private TripleGenerator(Resource<?> resource, Property property) { this.subject = resource; this.predicate = property.predicate(); }
@Override public void visitLiteral(Literal<?> value) { assertThat(originalProp.hasLiteralValue(value),equalTo(true)); } @Override