Commit 04e057b8 authored by PTSEFTON's avatar PTSEFTON
Browse files

Fixed some tests

parent be745b39
{
"BagIt-Profile-Info":{
"BagIt-Profile-Identifier":"https://raw.githubusercontent.com/UTS-eResearch/datacrate/master/spec/0.2/profile-datacrate-v0.2.json",
"BagIt-Profile-Identifier":"https://raw.githubusercontent.com/UTS-eResearch/datacrate/master/spec/1.0/profile-datacrate-v1.0.json",
"Source-Organization":"University of Technology Sydney",
"Contact-Name":"Peter Sefton",
"External-Description":"BagIt profile for DataCrate research data packages. ",
......
......@@ -334,7 +334,7 @@ module.exports = function() {
catalogs = [new_catalog_file];
fs.writeFileSync(
path.join(dir, new_catalog_file),
fs.readFileSync(path.join(DEFAULTS, catalog_file))
fs.readFileSync(path.join(defaults.defaults_dir, catalog_file))
);
//console.log("New Catalog", new_catalog_file);
//COPY IN A NEW CATALOG
......
......@@ -29,14 +29,15 @@ const ignore_file_regex = new RegExp(
);
const ignore_dir_regex = new RegExp(`(^${html_multi_file_dirs}$)|(^\\.)`);
const BagIt_Profile_Identifier =
"https://raw.githubusercontent.com/UTS-eResearch/datacrate/master/spec/0.3/profile-datacrate-v1.0.json";
"https://raw.githubusercontent.com/UTS-eResearch/datacrate/master/spec/1.0/profile-datacrate-v1.0.json";
const DataCrate_Specification_Identifier =
"https://github.com/UTS-eResearch/datacrate/blob/master/spec/0.3/data_crate_specification_v1.0.md";
"https://github.com/UTS-eResearch/datacrate/blob/master/spec/1.0/data_crate_specification_v1.0.md";
const DataCrate_version = "1.0";
const DataCrate_profile_file = "defaults/profile-datacrate-v" + DataCrate_version + ".json"
const default_context = "defaults/context.json"
const path = require("path")
const DEFAULTS = path.join(__dirname, '../defaults');
const defaults_dir = DEFAULTS;
const context = require(path.join(DEFAULTS, 'context.json'));
// DataCrate specific terms which have inverses
......@@ -67,5 +68,6 @@ module.exports = {
back_links: back_links,
back_back_links: back_back_links,
DataCrate_profile_file: DataCrate_profile_file,
context: context
context: context,
defaults_dir: defaults_dir
};
......@@ -219,7 +219,6 @@ module.exports = function () {
} else {
out_path = path.join(this.out_dir, this.get_html_path(this.root_node["@id"]))
}
shell.mkdir("-p", path.dirname(out_path));
fs.writeFileSync(
out_path,
......
......@@ -30,8 +30,8 @@ function set_up_a_dir(test_dir = default_test_dir) {
return test_dir;
}
describe("Create an Datactite citation", function() {
it("Should create an citation", function(done) {
describe("Create a Datactite citation", function() {
it("Should create a citation", function(done) {
//
set_up_a_dir();
citer = new Datacite();
......
......@@ -98,8 +98,7 @@ describe("JSON-LD helper simple tests", function () {
json_content = JSON.parse(fs.readFileSync(catalog));
const helper3 = new jsonld()
helper3.init(json_content)
assert.equal(helper3.get_uri_for_term("Person"), "http://schema.org/Person")
assert.equal(helper3.get_uri_for_term("Project"), "http://purl.org/cerif/frapo/Project")
//assert.equal(helper3.get_uri_for_term("Person"), "https://schema.org/Person")
helper3.trim_context()
assert.equal(Object.keys(helper3.json_ld["@context"]).length, 29)
......@@ -117,7 +116,7 @@ describe("JSON-LD helper simple tests", function () {
helper.init(json4)
helper.trim_context()
assert.equal(helper.get_uri_for_term("DataDownload"), "http://schema.org/DataDownload");
assert.equal(helper.get_uri_for_term("DataDownload"), "https://schema.org/DataDownload");
done();
......@@ -184,7 +183,7 @@ describe("JSON-LD helper simple tests", function () {
assert.equal(helper.item_by_id["4"]["isPartOf"][0]["@id"], "1")
assert.equal(helper.item_by_id["2"]["@reverse"]["creator"][0]["@id"], "1")
assert.equal(helper.get_uri_for_term("isPartOf", "http://schema.org/isPartOf"))
assert.equal(helper.get_uri_for_term("partOf", "http://schema.org/partOf"))
......
......@@ -24,10 +24,10 @@ const assert = require("assert");
describe("Simple ID", function() {
it("Should create an empty metadata set", function(done) {
var f = new Property();
f.parse("ID", "https://orcid.org/somethign");
f.parse("ID", "https://orcid.org/something");
assert(f.is_id);
assert.equal(f.data[0], "https://orcid.org/somethign");
assert.equal(f.property, "schema:identifier");
assert.equal(f.data[0], "https://orcid.org/something");
assert.equal(f.property_URI, "https://schema.org/identifier");
done();
});
});
......@@ -45,7 +45,7 @@ describe("File Format", function() {
f.links_to,
"http://www.nationalarchives.gov.uk/PRONOM/fmt/43"
);
assert.equal(f.property, "schema:fileFormat");
assert.equal(f.property_URI, "https://schema.org/fileFormat");
done();
});
});
......@@ -55,7 +55,7 @@ describe("Repeating names", function() {
var f = new Property();
f.parse("RELATION:Creator*", "Mike Lake, Peter Sefton, Michael Lynch");
assert(f.is_repeating);
assert.equal(f.property, "schema:creator");
assert.equal(f.property_URI, "https://schema.org/creator");
assert.equal(f.name, "creator");
assert.equal(f.data[0], "Mike Lake");
assert.equal(f.data[1], "Peter Sefton");
......@@ -69,7 +69,7 @@ describe("Escaping HTML", function() {
var f = new Property();
f.parse("RELATION:Creator*", "Mike Lake & Peter Sefton & Michael Lynch");
assert(f.is_repeating);
assert.equal(f.property, "schema:creator");
assert.equal(f.property_URI, "https://schema.org/creator");
assert.equal(f.name, "creator");
assert.equal(f.data[0], "Mike Lake & Peter Sefton & Michael Lynch");
done();
......@@ -97,13 +97,13 @@ describe("Nested", function() {
//console.log("SPILT TEST", "This:http://B;ah.asdsad.asdasd".split(":",2));
assert.equal(f.property, "schema:creator");
assert.equal(f.property_URI, "https://schema.org/creator");
f.parse(
"distribution>TYPE:DataDownload>",
"contentUrl: ./"
);
assert.equal(f.property, "schema:distribution");
assert.equal(f.property_URI, "https://schema.org/distribution");
console.log(f.nested_item_json);
done();
......
{
`{
"@graph": [
{
"Title": "SUSS Repository",
"Description": "Caves data repository",
"ID": "suss_repo",
"schema:hasPart": [
"https://schema.org/hasPart": [
{
"@id": "#6ed61bd4-db23-4902-9fa4-ea1cf85f0540",
"License": "CC-BY",
"@type": "schema:MediaObject",
"@type": "https://schema.org/MediaObject",
"Description": "Illustrator file for Glop Pot"
},
{
"@id": "#e383f498-a0f5-46c7-b813-57fcc09a3fa2",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#a5a64d79-18d4-40e3-b220-31d6066ea07f",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#a4902d91-8a24-4777-af11-dc3fb2dfa954",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#437bf884-002f-4c4d-bb3a-94729e69d023",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#39030787-1ae2-4637-b90e-d63710ae2920",
"License": "",
"@type": "schema:MediaObject",
"@type": "https://schema.org/MediaObject",
"Description": "Directory of scanned sketch sheets"
},
{
"@id": "#6bba0983-a2ce-4da2-8c9b-4e239a4fe05b",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#868d5f90-10ea-4b87-9e27-82dfe836ed52",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#169de668-5265-4938-9088-46559d866614",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#a4272354-5615-4ca2-8586-63e3c0ffbb75",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#7c6916c3-f9de-4438-864a-17add42f7579",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#b16c715b-8259-4611-b19b-a55373884b9c",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#91739efe-1d39-409f-a149-90317e255834",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#f9abf6cd-8c6a-447c-816d-e6c25f8890f8",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#5533095d-887c-4f68-b8bd-809a23fce87a",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#560a5f31-bc91-42c7-ad77-4f0fee9ed3d5",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#398e31d7-6699-4605-888f-ec40f57eabe5",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#e9c00dd0-5e30-4b41-8a5c-7ae0417b2de0",
"License": "",
"@type": "schema:MediaObject",
"@type": "https://schema.org/MediaObject",
"Description": "Directory of scanned data sheets"
},
{
"@id": "#53123b45-6a6f-4c4d-8ecd-d17071560bd6",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#eeb524a2-7572-4cbc-9bfa-b77f3d38c592",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#b3156bbe-df7b-4fc4-973d-59575cd9a320",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#087da45c-a4c5-4f9e-b2b2-74dfe4ace1a5",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#e6751c56-42c7-42bb-9c99-84a36b99845a",
"License": "",
"@type": "schema:MediaObject",
"@type": "https://schema.org/MediaObject",
"Description": "Directory of ASF Grade specifications for Survex software"
},
{
"@id": "#0e45b3b9-cc65-4a1a-8e1f-45fc937d471e",
"License": "CC-BY",
"@type": "schema:MediaObject",
"@type": "https://schema.org/MediaObject",
"Description": "Survex data file for Glop Pot"
},
{
"@id": "#3e334e85-2158-46d6-89bd-7579d38bcb24",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#1e218303-e8b9-4bca-929f-f2d883d42b32",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#589063f6-967f-4da3-a1ad-4a4b62062c69",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
},
{
"@id": "#fc7aa0b4-0ad7-41e3-ba72-8bc3c45d44a3",
"@type": "schema:MediaObject"
"@type": "https://schema.org/MediaObject"
}
],
"@id": "#suss_repo",
......@@ -133,47 +133,46 @@
}
],
"@context": {
"Title": "schema:name",
"ID": "schema:identifier",
"Funder": "schema:funder",
"rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
"geo": "schema:geo",
"Contributor": "schema:contributor",
"vivo": "http://vivoweb.org/ontology/core#",
"Title": "https://schema.org/name",
"ID": "https://schema.org/identifier",
"Funder": "https://schema.org/funder",
"rdf": "https://www.w3.org/1999/02/22-rdf-syntax-ns#",
"geo": "https://schema.org/geo",
"Contributor": "https://schema.org/contributor",
"vivo": "https://vivoweb.org/ontology/core#",
"HasFile": "pcdm:hasFile",
"FamilyName": "schema:familyName",
"Box": "schema:Box",
"License": "schema:license",
"fileFormat": "schema:fileFormat",
"foaf": "http://xmlns.com/foaf/0.1/",
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
"cc": "http://creativecommons.org/ns#",
"Person": "schema:person",
"ContentLocation": "schema:contentLocation",
"rdfa": "http://www.w3.org/ns/rdfa#",
"Identifier": "schema:Identifier",
"Dataset": "schema:Dataset",
"GeoShape": "schema:GeoShape",
"SpatialCoverage": "schema:spatialCoverage",
"Subject": "schema:subject",
"ContactPerson": "schema:accountablePerson",
"Description": "schema:description",
"Email": "schema:email",
"FamilyName": "https://schema.org/familyName",
"Box": "https://schema.org/Box",
"License": "https://schema.org/license",
"fileFormat": "https://schema.org/fileFormat",
"foaf": "https://xmlns.com/foaf/0.1/",
"rdfs": "https://www.w3.org/2000/01/rdf-schema#",
"cc": "https://creativecommons.org/ns#",
"Person": "https://schema.org/person",
"ContentLocation": "https://schema.org/contentLocation",
"rdfa": "https://www.w3.org/ns/rdfa#",
"Identifier": "https://schema.org/Identifier",
"Dataset": "https://schema.org/Dataset",
"GeoShape": "https://schema.org/GeoShape",
"SpatialCoverage": "https://schema.org/spatialCoverage",
"Subject": "https://schema.org/subject",
"ContactPerson": "https://schema.org/accountablePerson",
"Description": "https://schema.org/description",
"Email": "https://schema.org/email",
"Project": "vivo:Project",
"TemporalCoverage": "schema:TemporalCoverage",
"Latitude": "schema:latitude",
"TemporalCoverage": "https://schema.org/TemporalCoverage",
"Latitude": "https://schema.org/latitude",
"Object": "pcdm:object",
"GeoCoordinates": "schema:GeoCoordinates",
"schema": "http://schema.org/",
"Creator": "schema:creator",
"GeoCoordinates": "https://schema.org/GeoCoordinates",
"Creator": "https://schema.org/creator",
"MemberOf": "pcdm:memberOf",
"GivenName": "schema:givenName",
"Keywords": "schema:keywords",
"CreativeWork": "schema:CreativeWork",
"Phone": "schema:telephone",
"Place": "schema:Place",
"Longitude": "schema:longitude",
"dct": "http://purl.org/dc/terms/",
"pcdm": "http://pcdm.org/models#"
"GivenName": "https://schema.org/givenName",
"Keywords": "https://schema.org/keywords",
"CreativeWork": "https://schema.org/CreativeWork",
"Phone": "https://schema.org/telephone",
"Place": "https://schema.org/Place",
"Longitude": "https://schema.org/longitude",
"dct": "https://purl.org/dc/terms/",
"pcdm": "https://pcdm.org/models#"
}
}
\ No newline at end of file
......@@ -5,10 +5,10 @@
"identifier": "https://schema.org/identifier",
"memberOf": "https://schema.org/memberOf",
"name": "https://schema.org/name",
"issn": "https://schema.org/issn",
"affiliation": "https://schema.org/affiliation",
"familyName": "https://schema.org/familyName",
"givenName": "https://schema.org/givenName",
"issn": "https://schema.org/issn",
"contentSize": "https://schema.org/contentSize",
"path": "https://schema.org/contentUrl",
"creator": "https://schema.org/creator",
......@@ -25,10 +25,10 @@
"contactType": "https://schema.org/contactType",
"email": "https://schema.org/email",
"Organization": "https://schema.org/Organization",
"Periodical": "https://schema.org/Periodical",
"Place": "https://schema.org/Place",
"Person": "https://schema.org/Person",
"Periodical": "https://schema.org/Periodical",
"File": "https://schema.org/MediaObject",
"Place": "https://schema.org/Place",
"Dataset": "https://schema.org/Dataset",
"ScholarlyArticle": "https://schema.org/ScholarlyArticle",
"ContactPoint": "https://schema.org/ContactPoint"
......@@ -84,6 +84,10 @@
"identifier": "3",
"name": "Ingham Institute for Applied Medical Research"
},
{
"@id": "3a31ffba-5da0-483c-819c-410328cf7406",
"@type": "Place"
},
{
"@id": "4",
"@type": "Organization",
......@@ -101,12 +105,6 @@
},
"name": "Sydney Medical School, The University of Sydney"
},
{
"@id": "5aecc8bf-142a-4a5e-bf7d-5d8277ed55b5",
"@type": "Periodical",
"issn": "1932-6203",
"name": "PLOS ONE"
},
{
"@id": "6",
"@type": "Organization",
......@@ -127,6 +125,22 @@
},
"name": "School of Medicine and Public Health, The University of Newcastle"
},
{
"@id": "79bf604e-49bc-45ee-8cfd-53b662911d74",
"@type": "Person",
"affiliation": {
"@id": "1"
},
"familyName": "Cook",
"givenName": "Janet",
"name": "Janet Cook"
},
{
"@id": "7d0ba098-7929-431c-bec5-f8f47174f13e",
"@type": "Periodical",
"issn": "1932-6203",
"name": "PLOS ONE"
},
{
"@id": "8",
"@type": "Organization",
......@@ -135,16 +149,6 @@
"memberOf": "The University of Queensland",
"name": "Faculty of Medicine, The University of Queensland"
},
{
"@id": "8758065f-f02c-48d7-870a-77ad78971b5e",
"@type": "Person",
"affiliation": {
"@id": "10"
},
"familyName": "Houltram",
"givenName": "Jennifer",
"name": "Jennifer Houltram"
},
{
"@id": "9",
"@type": "Organization",
......@@ -155,16 +159,6 @@
},
"name": "School of Nursing, Johns Hopkins University"
},
{
"@id": "9944042a-01e9-498d-bf74-1b5c8dfb20bf",
"@type": "Person",
"affiliation": {
"@id": "1"
},
"familyName": "Cook",
"givenName": "Janet",
"name": "Janet Cook"
},
{
"@id": "Data files associated with the IDEAL primary outcome manuscript.docx",
"@type": "File",
......@@ -216,8 +210,14 @@
"name": "Dataset 3"
},
{
"@id": "a978970a-c2f6-4847-abac-c2085d08fdf2",
"@type": "Place"
"@id": "d0784b0a-8910-4cd2-8eab-c7d90a145ab9",
"@type": "Person",
"affiliation": {
"@id": "10"
},
"familyName": "Houltram",
"givenName": "Jennifer",
"name": "Jennifer Houltram"
},
{
"@id": "http://doi.org/10.4225/59/59672c09f4a4b",
......@@ -255,13 +255,13 @@
"@id": "http://nla.gov.au/nla.party-1509834"
},
{
"@id": "9944042a-01e9-498d-bf74-1b5c8dfb20bf"
"@id": "79bf604e-49bc-45ee-8cfd-53b662911d74"
},
{
"@id": "http://orcid.org/0000-0003-4902-0654"
},
{
"@id": "8758065f-f02c-48d7-870a-77ad78971b5e"
"@id": "d0784b0a-8910-4cd2-8eab-c7d90a145ab9"
},
{
"@id": "http://orcid.org/0000-0001-6611-6565"
......@@ -337,13 +337,13 @@
"@id": "http://nla.gov.au/nla.party-1509834"
},
{
"@id": "9944042a-01e9-498d-bf74-1b5c8dfb20bf"
"@id": "79bf604e-49bc-45ee-8cfd-53b662911d74"
},
{
"@id": "http://orcid.org/0000-0003-4902-0654"
},
{
"@id": "8758065f-f02c-48d7-870a-77ad78971b5e"
"@id": "d0784b0a-8910-4cd2-8eab-c7d90a145ab9"
},
{
"@id": "http://orcid.org/0000-0001-6611-6565"
......@@ -355,7 +355,7 @@
"datePublished": "2017",
"identifier": "http://journals.plos.org/plosone/article?id=10.1371/journal.pone.0181020",
"isPartOf": {
"@id": "5aecc8bf-142a-4a5e-bf7d-5d8277ed55b5"
"@id": "7d0ba098-7929-431c-bec5-f8f47174f13e"
},
"name": "Effects of facilitated family case conferencing for advanced dementia: A cluster randomised clinical trial"
},
......
Markdown is supported
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