use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForTSVTest method importFewLines.
@Test
public void importFewLines() throws StudyImporterException {
Dataset dataset = getDataset(new TreeMap<URI, String>() {
{
put(URI.create("/interactions.tsv"), firstFewLinesTSV);
}
});
DatasetImporterForTSV importer = new DatasetImporterForTSV(null, nodeFactory);
importer.setDataset(dataset);
importStudy(importer);
assertExists("Leptoconchus incycloseris");
assertExists("Sandalolitha dentata");
assertStudyTitles("someRepodoi:10.1007/s13127-011-0039-1");
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForTSVTest method importFewLinesTSV.
@Test
public void importFewLinesTSV() throws StudyImporterException {
Dataset dataset = getDataset(new TreeMap<URI, String>() {
{
put(URI.create("/interactions.tsv"), firstFewLinesTSV);
}
});
DatasetImporterForTSV importer = new DatasetImporterForTSV(null, nodeFactory);
importer.setDataset(dataset);
importStudy(importer);
assertExists("Leptoconchus incycloseris");
assertExists("Sandalolitha dentata");
assertStudyTitles("someRepodoi:10.1007/s13127-011-0039-1");
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForINaturalistTest method setup.
@Before
public void setup() throws DatasetRegistryException {
Dataset dataset = datasetFor("globalbioticinteractions/inaturalist");
ParserFactory parserFactory = new ParserFactoryForDataset(dataset);
importer = new DatasetImporterForINaturalist(parserFactory, nodeFactory);
importer.setDataset(dataset);
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class NodeFactoryFactoryTransactingOnDatasetNeo4j3 method create.
@Override
public NodeFactory create(GraphDatabaseService service) {
GraphDatabaseService graphService = graphServiceFactory.getGraphService();
try (Transaction tx = graphService.beginTx()) {
NodeFactory nodeFactory = new NodeFactoryNeo4j3(graphService) {
final AtomicReference<Transaction> tx = new AtomicReference<>();
final AtomicBoolean closing = new AtomicBoolean(false);
@Override
public Dataset getOrCreateDataset(Dataset dataset) {
if (closing.get()) {
throw new IllegalStateException("cannot create a dataset on closing node factory");
} else {
Transaction transaction = tx.get();
if (transaction != null) {
transaction.success();
transaction.close();
}
tx.set(graphServiceFactory.getGraphService().beginTx());
}
return super.getOrCreateDataset(dataset);
}
@Override
public void close() {
closing.set(true);
Transaction lastTx = tx.getAndSet(null);
if (lastTx != null) {
lastTx.success();
lastTx.close();
}
}
};
tx.success();
return nodeFactory;
}
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetImporterForHurlbertTest method doImport.
public DatasetImporter doImport(final String namespace) throws StudyImporterException {
DatasetImporter importer = new DatasetImporterForHurlbert(null, nodeFactory);
Dataset dataset = new DatasetImpl(namespace, URI.create("some:uri"), inStream -> inStream) {
@Override
public InputStream retrieve(URI name) {
return DatasetImporterForHurlbertTest.getResource();
}
};
importer.setDataset(dataset);
importStudy(importer);
return importer;
}
Aggregations