Search in sources :

Example 6 with Collection

use of nl.knaw.huygens.timbuctoo.rdf.Collection in project timbuctoo by HuygensING.

the class ArchetypeTripleProcessor method processAssertion.

@Override
protected void processAssertion(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;
    }
    Collection archetypeCollection = archetypeCollectionOptional.get();
    collection.setArchetype(archetypeCollection, object);
    Set<Entity> entities = database.findEntitiesByCollection(collection);
    entities.forEach(entity -> entity.moveToOtherArchetype(previousArchetype, archetypeCollection));
}
Also used : Entity(nl.knaw.huygens.timbuctoo.rdf.Entity) Collection(nl.knaw.huygens.timbuctoo.rdf.Collection)

Aggregations

Collection (nl.knaw.huygens.timbuctoo.rdf.Collection)6 Entity (nl.knaw.huygens.timbuctoo.rdf.Entity)6 RdfImportSession (nl.knaw.huygens.timbuctoo.core.RdfImportSession)3 Database (nl.knaw.huygens.timbuctoo.rdf.Database)3 Test (org.junit.Test)3 RdfImportErrorReporter (nl.knaw.huygens.timbuctoo.core.RdfImportErrorReporter)1 InOrder (org.mockito.InOrder)1