Skip to content
This repository was archived by the owner on Nov 13, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ target/
.svn/
*.project
*.classpath
*.settings
*.checkstyle
osf-client.json
osf-client-test.json
osf-client-test.json
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import com.squareup.okhttp.Response;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;

import org.dataconservancy.cos.osf.client.model.Node;
import org.dataconservancy.cos.osf.client.model.Registration;
import org.dataconservancy.cos.osf.client.model.User;
import org.dataconservancy.cos.osf.client.retrofit.OsfService;
Expand Down Expand Up @@ -215,7 +217,7 @@ public static void main(final String[] args) {
private void run() throws Exception {
// Prepare the OSF registration and users information
final OsfService osfService = CTX.getBean("osfService", OsfService.class);
final Registration registration = osfService.registration(registrationUrl).execute().body();
final Node registration = osfService.node(registrationUrl).execute().body();

if (registration == null) {
System.err.println("Failed to obtain registration " + registrationUrl + " from endpoint. " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
import org.apache.jena.rdf.model.Resource;
import org.apache.jena.rdf.model.Selector;
import org.apache.jena.rdf.model.Statement;

import org.dataconservancy.cos.osf.client.model.Node;
import org.dataconservancy.cos.osf.client.model.Registration;
import org.dataconservancy.cos.osf.client.model.User;
import org.dataconservancy.cos.rdf.support.AnnotationsProcessor;
Expand Down Expand Up @@ -135,6 +137,15 @@ public Map<String, Individual> add(final Registration registration) {
return processor.process(registration);
}

/** Adds an OSF node to the graph.
*
* @param node OSF node
* @return a {@code Map} containing the URIs and OWL individuals added to the graph
*/
public Map<String, Individual> add(final Node node) {
return processor.process(node);
}

/**
* Adds an OSF {@link User} to the graph.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ private FileInfo contentFromUrl(final String filename, final String contentUrl)
final File outFile;
try {
outFile = new File(temporaryDirectory, filename);
outFile.getParentFile().mkdirs();
IOUtils.copy(contentResolver.resolve(contentUrl), new FileOutputStream(outFile));
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
Expand Down