use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class DatasetTest method unknownResourceURL.
@Test(expected = IOException.class)
public void unknownResourceURL() throws IOException, URISyntaxException {
URL resource = getClass().getResource("archive.zip");
File archive = new File(resource.toURI());
assertThat(archive.exists(), is(true));
URI parentDir = archive.getParentFile().toURI();
Dataset dataset = new DatasetImpl("some/namespace", parentDir, inStream -> inStream);
assertThat(dataset.retrieve(URI.create("archivezz.zip")), is(notNullValue()));
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class NodeFactoryNeo4j method createInteraction.
@Override
public Interaction createInteraction(Study study) throws NodeFactoryException {
InteractionNode interactionNode;
Node node = graphDb.createNode();
StudyNode studyNode = getOrCreateStudy(study);
interactionNode = new InteractionNode(node);
interactionNode.createRelationshipTo(studyNode, RelTypes.DERIVED_FROM);
Dataset dataset = getOrCreateDatasetNoTx(study.getOriginatingDataset());
if (dataset instanceof DatasetNode) {
interactionNode.createRelationshipTo(dataset, RelTypes.ACCESSED_AT);
}
return interactionNode;
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class NodeFactoryNeo4j method createStudyNode.
private StudyNode createStudyNode(Study study, Node node) {
StudyNode studyNode;
studyNode = new StudyNode(node, study.getTitle());
studyNode.setCitation(study.getCitation());
studyNode.setDOI(study.getDOI());
if (study.getDOI() != null) {
String doiString = study.getDOI().toString();
createExternalIdRelationIfExists(node, doiString, RelTypes.HAS_DOI);
}
String externalId = getExternalIdOrDOI(study);
studyNode.setExternalId(externalId);
createExternalIdRelationIfExists(node, externalId, RelTypes.HAS_EXTERNAL_ID);
Dataset dataset = getOrCreateDatasetNoTx(study.getOriginatingDataset());
if (dataset instanceof DatasetNode) {
studyNode.createRelationshipTo(dataset, RelTypes.IN_DATASET);
}
studyNode.getUnderlyingNode().setProperty(StudyConstant.TITLE_IN_NAMESPACE, getIdInNamespace(study));
return studyNode;
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class NodeFactoryNeo4j3 method getOrCreateDatasetNoTx.
@Override
protected Dataset getOrCreateDatasetNoTx(Dataset originatingDataset) {
Dataset datasetCreated = null;
if (originatingDataset != null && StringUtils.isNotBlank(originatingDataset.getNamespace())) {
Node node = getGraphDb().findNode(NodeLabel.Dataset, DatasetConstant.NAMESPACE, originatingDataset.getNamespace());
Node datasetNode = node == null ? createDatasetNode(originatingDataset) : node;
datasetCreated = new DatasetNode(datasetNode);
}
return datasetCreated;
}
use of org.globalbioticinteractions.dataset.Dataset in project eol-globi-data by jhpoelen.
the class ExporterAssociationsBase method addStudyInfo.
protected void addStudyInfo(StudyNode study, Map<String, String> properties) {
final Dataset originatingDataset = study.getOriginatingDataset();
properties.put(EOLDictionary.SOURCE, originatingDataset == null ? study.getCitation() : originatingDataset.getCitation());
properties.put(EOLDictionary.REFERENCE_ID, "globi:ref:" + study.getNodeID());
}
Aggregations