Search in sources :

Example 1 with PropertyFactory

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

the class RdfImportSession method updateImportSession.

public static RdfImportSession updateImportSession(String vreName, DataStoreOperations dataStoreOperations, EntityFinisherHelper entityFinisherHelper) {
    LogRdfImportErrorReporter errorReporter = new LogRdfImportErrorReporter();
    Vre vre = dataStoreOperations.ensureVreExists(vreName);
    if (vre.getCollectionForTypeName(CreateCollection.defaultCollection(vreName).getEntityTypeName(vre)) == null) {
        dataStoreOperations.addCollectionToVre(vre, CreateCollection.defaultCollection(vre.getVreName()));
        dataStoreOperations.addPredicateValueTypeVertexToVre(vre);
    }
    Vre reloadedVre = dataStoreOperations.loadVres().getVre(vre.getVreName());
    return new RdfImportSession(dataStoreOperations, reloadedVre, errorReporter, new PropertyFactory(errorReporter), entityFinisherHelper);
}
Also used : PropertyFactory(nl.knaw.huygens.timbuctoo.core.rdf.PropertyFactory) Vre(nl.knaw.huygens.timbuctoo.model.vre.Vre)

Example 2 with PropertyFactory

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

the class RdfImportSessionTest method closeCreatesPropertyDescriptionsForEachPredicate.

@Test
public void closeCreatesPropertyDescriptionsForEachPredicate() {
    List<PredicateInUse> predicates = Lists.newArrayList();
    given(dataStoreOperations.getPredicatesFor(any(Collection.class))).willReturn(predicates);
    PropertyFactory propertyFactory = mock(PropertyFactory.class);
    ArrayList<CreateProperty> createProperties = Lists.newArrayList();
    given(propertyFactory.fromPredicates(predicates)).willReturn(createProperties);
    RdfImportSession instance = rdfImportSessionWithPropertyFactory(VRE_NAME, dataStoreOperations, propertyFactory);
    instance.commit();
    instance.close();
    verify(propertyFactory).fromPredicates(predicates);
    verify(dataStoreOperations).addPropertiesToCollection(any(Collection.class), eq(createProperties));
}
Also used : CreateProperty(nl.knaw.huygens.timbuctoo.core.dto.rdf.CreateProperty) RdfImportSessionStubs.rdfImportSessionWithPropertyFactory(nl.knaw.huygens.timbuctoo.core.RdfImportSessionStubs.rdfImportSessionWithPropertyFactory) PropertyFactory(nl.knaw.huygens.timbuctoo.core.rdf.PropertyFactory) CreateCollection(nl.knaw.huygens.timbuctoo.core.dto.CreateCollection) Collection(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection) PredicateInUse(nl.knaw.huygens.timbuctoo.core.dto.rdf.PredicateInUse) Test(org.junit.Test)

Aggregations

PropertyFactory (nl.knaw.huygens.timbuctoo.core.rdf.PropertyFactory)2 RdfImportSessionStubs.rdfImportSessionWithPropertyFactory (nl.knaw.huygens.timbuctoo.core.RdfImportSessionStubs.rdfImportSessionWithPropertyFactory)1 CreateCollection (nl.knaw.huygens.timbuctoo.core.dto.CreateCollection)1 Collection (nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection)1 CreateProperty (nl.knaw.huygens.timbuctoo.core.dto.rdf.CreateProperty)1 PredicateInUse (nl.knaw.huygens.timbuctoo.core.dto.rdf.PredicateInUse)1 Vre (nl.knaw.huygens.timbuctoo.model.vre.Vre)1 Test (org.junit.Test)1