Skip to content
Snippets Groups Projects
Commit 1e0a43e6 authored by Mike Lynch's avatar Mike Lynch
Browse files

Started a branch for my mods

parent 220ff979
No related merge requests found
......@@ -48,14 +48,18 @@ TO fetch them:
### Add all the examples to an OCFL repository
To make all the example from calcyte:
- `make all REPO_PATH=~/working/ocfl-demo/repo SRC_PATH=~/working/ocfl-test-data/src`
- `make all REPO_PATH=~/working/ocfl-demos/repo SRC_PATH=~/working/ocfl-demos/src`
This will:
- Generate RO-Crates for all the examples at `~/working/calcyte.js/test_data/`
- Create an OCFL repository at `~/working/ocfl-demo/repo` if it does not already exist
- Create an OCFL repository at `~/working/ocfl-demos/repo` if it does not already exist
- Deposit all the example RO-Crates into the repository
- Generate an index file
### To build the OCFL repository without running Calcyte
make index REPO_PATH=~/working/ocfl-demos/repo SRC_PATH=~/working/ocfl-demos/src
## TODO
......@@ -63,10 +67,6 @@ This will:
### Port legacy datasets from the UTS Research Data Repository
h
### Run with data downloaded from Research Data Australia
### Add in sample data from Omeka (Farms to freeways and Dharmae)
......
......@@ -3,7 +3,7 @@
const path = require('path');
const fs = require('fs-extra');
const ocfl = require("ocfl");
console.log(ocfl);
const hasha = require('hasha');
const OCFLRepository = require('ocfl').Repository;
var argv = require('yargs').argv;
var Utils = require("ro-crate").Utils
......@@ -11,11 +11,15 @@ var ROCrate = require('ro-crate').ROCrate;
var utils = new Utils();
const URL_HASH_ALGORITHM = 'md5';
// This is an asynchronous library so you need to call using await, or use promises
async function main() {
// OCFL repo - exsists?
// OCFL repo - exists?
const repoPath = argv.repo ? argv.repo : "ocfl_demo";
// Make or open a database
// Get or open an OCFL repo
......@@ -43,11 +47,12 @@ async function main() {
var dataset = crate.getRootDataset()
console.log(dataset['@id'], dataset['description'], p);
var newItem = {
"@id": dataset["@id"],
name: utils.asArray(dataset.name)[0],
description: utils.asArray(dataset.description)[0],
datePublished: utils.asArray(dataset.name)[0],
path: object.path
"@id": dataset["@id"],
uri_id: hasha(dataset["@id"], { algorithm: URL_HASH_ALGORITHM }),
name: utils.asArray(dataset.name)[0],
description: utils.asArray(dataset.description)[0],
datePublished: utils.asArray(dataset.name)[0],
path: path.relative(repoPath, object.path)
}
index.push(newItem);
......
......@@ -30,5 +30,3 @@ pull:
cd $(SRC_PATH)
wget -r -np -nH --cut-dirs=3 https://data.research.uts.edu.au/examples/ro-crate/examples/src/
cd -
......@@ -8,14 +8,16 @@
},
"repository": {
"type": "git",
"url": "TBA"
"url": "https://code.research.uts.edu.au/eresearch/ocfl-demos"
},
"author": "UTS eResearch Staff",
"license": "GPL-3.0",
"dependencies": {
"fs-extra": "^8.1.0",
"hasha": "^5.0.0",
"ocfl": "^1.0.3",
"ro-crate": "^1.0.1",
"yargs": "^13.3.0"
"yargs": "^13.3.0",
"solr-catalog": "^1.0.1"
}
}
......@@ -36,5 +36,7 @@ async function main() {
}
}
}
main();
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment