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);
}
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));
}
Aggregations