use of nl.knaw.huygens.timbuctoo.rdf.Entity in project timbuctoo by HuygensING.
the class AltLabelTripleProcessor method processRetraction.
@Override
protected void processRetraction(String vreName, String subject, String predicate, String lexicalValue, String typeUri) {
final Entity entity = database.findOrCreateEntity(vreName, subject);
final String propertyName = getLocalName(predicate);
removeFromListProperty(entity, propertyName, lexicalValue);
}
use of nl.knaw.huygens.timbuctoo.rdf.Entity in project timbuctoo by HuygensING.
the class ArchetypeTripleProcessor method processRetraction.
@Override
protected void processRetraction(String vreName, String subject, String predicate, String object) {
Collection collection = database.findOrCreateCollection(vreName, subject, getLocalName(subject));
// collection must have an archetype
Collection previousArchetype = collection.getArchetype().get();
Optional<Collection> archetypeCollectionOptional = database.findArchetypeCollection(getLocalName(object));
if (!archetypeCollectionOptional.isPresent()) {
return;
}
// FIXME: assert that triple's archetype is equal to current archetype
Collection defaultArchetype = database.getConcepts();
// The concepts archetype does not have a URI, so we use an empty string of the original uri of the archetype
collection.setArchetype(defaultArchetype, "");
Set<Entity> entities = database.findEntitiesByCollection(collection);
entities.forEach(entity -> entity.moveToOtherArchetype(previousArchetype, defaultArchetype));
}
use of nl.knaw.huygens.timbuctoo.rdf.Entity in project timbuctoo by HuygensING.
the class CollectionMembershipTripleProcessor method processRetraction.
@Override
protected void processRetraction(String vreName, String subject, String predicate, String object) {
Entity entity = database.findOrCreateEntity(vreName, subject);
entity.removeFromCollection(database.findOrCreateCollection(vreName, object, getLocalName(object)));
}
use of nl.knaw.huygens.timbuctoo.rdf.Entity in project timbuctoo by HuygensING.
the class CollectionMembershipTripleProcessor method processAssertion.
@Override
protected void processAssertion(String vreName, String subject, String predicate, String object) {
Entity entity = database.findOrCreateEntity(vreName, subject);
if (entity.isInKnownCollection()) {
rdfImportSession.getErrorReporter().multipleRdfTypes(subject, object);
} else {
Collection newCollection = database.findOrCreateCollection(vreName, object, getLocalName(object));
Collection defaultCollection = database.getDefaultCollection(vreName);
entity.moveToNewCollection(defaultCollection, newCollection);
}
}
use of nl.knaw.huygens.timbuctoo.rdf.Entity in project timbuctoo by HuygensING.
the class TinkerPopOperationsTest method getEntityReturnsANullPidWhenTheEntityDoesNotContainOne.
@Test
public void getEntityReturnsANullPidWhenTheEntityDoesNotContainOne() throws Exception {
Vres vres = createConfiguration();
Collection collection = vres.getCollection("testthings").get();
UUID id = UUID.randomUUID();
TinkerPopGraphManager graphManager = newGraph().withVertex(v -> v.withTimId(id.toString()).withType("thing").withVre("test").withProperty("isLatest", true).withProperty("rev", 1)).wrap();
TinkerPopOperations instance = forGraphWrapperAndMappings(graphManager, vres);
ReadEntity entity = instance.getEntity(id, null, collection, (readEntity, vertex) -> {
}, (graphTraversalSource, vre, vertex, relationRef) -> {
});
assertThat(entity.getPid(), is(nullValue()));
}
Aggregations