diff --git a/ARCtrl.sln b/ARCtrl.sln index 82ac26ff..e6c5457b 100644 --- a/ARCtrl.sln +++ b/ARCtrl.sln @@ -82,6 +82,10 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ARCtrl.Yaml.Tests", "tests\ EndProject Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ARCtrl.Contract.Tests", "tests\Contract\ARCtrl.Contract.Tests.fsproj", "{D10D12C7-B877-423B-867D-161D99E673C9}" EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ARCtrl.ROCrate", "src\ROCrate\ARCtrl.ROCrate.fsproj", "{658BF141-B4B5-4B90-891D-AC36A3FD7574}" +EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ARCtrl.ROCrate.Tests", "tests\ROCrate\ARCtrl.ROCrate.Tests.fsproj", "{212A1C64-02FC-465A-B0FA-F69735F37ACC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -168,6 +172,14 @@ Global {D10D12C7-B877-423B-867D-161D99E673C9}.Debug|Any CPU.Build.0 = Debug|Any CPU {D10D12C7-B877-423B-867D-161D99E673C9}.Release|Any CPU.ActiveCfg = Release|Any CPU {D10D12C7-B877-423B-867D-161D99E673C9}.Release|Any CPU.Build.0 = Release|Any CPU + {658BF141-B4B5-4B90-891D-AC36A3FD7574}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {658BF141-B4B5-4B90-891D-AC36A3FD7574}.Debug|Any CPU.Build.0 = Debug|Any CPU + {658BF141-B4B5-4B90-891D-AC36A3FD7574}.Release|Any CPU.ActiveCfg = Release|Any CPU + {658BF141-B4B5-4B90-891D-AC36A3FD7574}.Release|Any CPU.Build.0 = Release|Any CPU + {212A1C64-02FC-465A-B0FA-F69735F37ACC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {212A1C64-02FC-465A-B0FA-F69735F37ACC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {212A1C64-02FC-465A-B0FA-F69735F37ACC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {212A1C64-02FC-465A-B0FA-F69735F37ACC}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -194,6 +206,8 @@ Global {1CA11165-4B70-41D2-A846-50374E85385E} = {64B34A6E-318D-4E6E-9262-CE52C9B85A38} {5810EF87-4F85-4B4C-98E3-833AE914C628} = {64B34A6E-318D-4E6E-9262-CE52C9B85A38} {D10D12C7-B877-423B-867D-161D99E673C9} = {64B34A6E-318D-4E6E-9262-CE52C9B85A38} + {658BF141-B4B5-4B90-891D-AC36A3FD7574} = {6DA2330B-D407-4FB1-AF05-B0184034EC44} + {212A1C64-02FC-465A-B0FA-F69735F37ACC} = {64B34A6E-318D-4E6E-9262-CE52C9B85A38} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {1E354DE6-99BA-421E-9EF8-E808B855A85F} diff --git a/build.cmd b/build.cmd index fe247e50..1e9e4ec3 100644 --- a/build.cmd +++ b/build.cmd @@ -2,5 +2,4 @@ set PYTHONIOENCODING=utf-8 dotnet tool restore -cls dotnet run --project ./build/build.fsproj %* \ No newline at end of file diff --git a/build/ProjectInfo.fs b/build/ProjectInfo.fs index c74d1f2e..4101ad6b 100644 --- a/build/ProjectInfo.fs +++ b/build/ProjectInfo.fs @@ -16,6 +16,7 @@ let testProjects = "tests/Yaml" "tests/ValidationPackages" "tests/Contract" + "tests/ROCrate" ] /// Native JS test paths diff --git a/build/TestTasks.fs b/build/TestTasks.fs index 19114997..dfcbfd2a 100644 --- a/build/TestTasks.fs +++ b/build/TestTasks.fs @@ -1,4 +1,4 @@ -module TestTasks +module TestTasks open BlackFox.Fake open Fake.DotNet @@ -59,6 +59,33 @@ module RunTests = |> Seq.iter dotnetRun } + let runTestProject = BuildTask.createFn "runTestProject" [clean; build] (fun config -> + let dotnetRun = run dotnet "run" + match config.Context.Arguments with + | projectName::[] -> + let dotnetRun = run dotnet "run" + match List.tryFind (fun (p:string) -> p.EndsWith(projectName)) testProjects with + | Some p -> + // + printfn $"running tests for test project {p}" + dotnetRun p + // + run dotnet $"fable {p} -o {p}/js" "" + //transpile py files from fsharp code + run dotnet $"fable {p} -o {p}/py --lang python" "" + // run pyxpecto in target path to execute tests in python + run python $"{p}/py/main.py" "" + // transpile js files from fsharp code + run dotnet $"fable {p} -o {p}/js" "" + // run mocha in target path to execute tests + // "--timeout 20000" is used, because json schema validation takes a bit of time. + run node $"{p}/js/Main.js" "" + | _ -> + failwithf "Project %s not found" projectName + | _ -> failwith "Please provide a project name to run tests for as the single argument" + ) + + let runTests = BuildTask.create "RunTests" [clean; build; RunTests.runTestsJs; RunTests.runTestsJsNative; RunTests.runTestsPy; RunTests.runTestsPyNative; RunTests.runTestsDotnet] { () } \ No newline at end of file diff --git a/src/ROCrate/ARCtrl.ROCrate.fsproj b/src/ROCrate/ARCtrl.ROCrate.fsproj new file mode 100644 index 00000000..b16f34a1 --- /dev/null +++ b/src/ROCrate/ARCtrl.ROCrate.fsproj @@ -0,0 +1,36 @@ + + + + netstandard2.0 + true + + + + + + + + + + + + + + + + + + + + + + Kevin Schneider, nfdi4plants, DataPLANT OSS contributors + A data model of the ARC concept via it's RO Crate profile + MIT + logo.png + ARC F# FSharp dotnet .Net bioinformatics biology fable-library datascience dataplant nfdi metadata + https://github.com/nfdi4plants/ARCtrl/tree/main/src/CWL + https://github.com/nfdi4plants/ARCtrl + git + + diff --git a/src/ROCrate/ISAProfile/Assay.fs b/src/ROCrate/ISAProfile/Assay.fs new file mode 100644 index 00000000..152c9403 --- /dev/null +++ b/src/ROCrate/ISAProfile/Assay.fs @@ -0,0 +1,31 @@ +namespace ARCtrl.ROCrate + +open DynamicObj +open Fable.Core + +/// +[] +type Assay( + id, + identifier, + ?about, + ?comment, + ?creator, + ?hasPart, + ?measurementMethod, + ?measurementTechnique, + ?url, + ?variableMeasured +) as this = + inherit Dataset(id, "Assay") + do + DynObj.setValue this (nameof identifier) identifier + + DynObj.setValueOpt this (nameof measurementMethod) measurementMethod + DynObj.setValueOpt this (nameof measurementTechnique) measurementTechnique + DynObj.setValueOpt this (nameof variableMeasured) variableMeasured + DynObj.setValueOpt this (nameof about) about + DynObj.setValueOpt this (nameof comment) comment + DynObj.setValueOpt this (nameof creator) creator + DynObj.setValueOpt this (nameof hasPart) hasPart + DynObj.setValueOpt this (nameof url) url \ No newline at end of file diff --git a/src/ROCrate/ISAProfile/Data.fs b/src/ROCrate/ISAProfile/Data.fs new file mode 100644 index 00000000..476e9d68 --- /dev/null +++ b/src/ROCrate/ISAProfile/Data.fs @@ -0,0 +1,23 @@ +namespace ARCtrl.ROCrate + +open DynamicObj +open Fable.Core + +/// +[] +type Data( + id, + name, + ?additionalType, + ?comment, + ?encodingFormat, + ?disambiguatingDescription +) as this = + inherit ROCrateObject(id = id, schemaType = "schema.org/MediaObject", ?additionalType = additionalType) + do + DynObj.setValue this (nameof name) name + + DynObj.setValueOpt this (nameof comment) comment + DynObj.setValueOpt this (nameof encodingFormat) encodingFormat + DynObj.setValueOpt this (nameof disambiguatingDescription) disambiguatingDescription + diff --git a/src/ROCrate/ISAProfile/Dataset.fs b/src/ROCrate/ISAProfile/Dataset.fs new file mode 100644 index 00000000..8fb712ca --- /dev/null +++ b/src/ROCrate/ISAProfile/Dataset.fs @@ -0,0 +1,9 @@ +namespace ARCtrl.ROCrate + +open DynamicObj +open Fable.Core + +/// +[] +type Dataset (id: string, ?additionalType: string) = + inherit ROCrateObject(id = id, schemaType = "schema.org/Dataset", ?additionalType = additionalType) diff --git a/src/ROCrate/ISAProfile/Investigation.fs b/src/ROCrate/ISAProfile/Investigation.fs new file mode 100644 index 00000000..2498807c --- /dev/null +++ b/src/ROCrate/ISAProfile/Investigation.fs @@ -0,0 +1,37 @@ +namespace ARCtrl.ROCrate + +open DynamicObj +open Fable.Core + +/// +[] +type Investigation( + id, + identifier, + ?citation, + ?comment, + ?creator, + ?dateCreated, + ?dateModified, + ?datePublished, + ?hasPart, + ?headline, + ?mentions, + ?url, + ?description +) as this = + inherit Dataset(id, "Investigation") + do + DynObj.setValue this (nameof identifier) identifier + + DynObj.setValueOpt this (nameof citation) citation + DynObj.setValueOpt this (nameof comment) comment + DynObj.setValueOpt this (nameof creator) creator + DynObj.setValueOpt this (nameof dateCreated) dateCreated + DynObj.setValueOpt this (nameof dateModified) dateModified + DynObj.setValueOpt this (nameof datePublished) datePublished + DynObj.setValueOpt this (nameof hasPart) hasPart + DynObj.setValueOpt this (nameof headline) headline + DynObj.setValueOpt this (nameof mentions) mentions + DynObj.setValueOpt this (nameof url) url + DynObj.setValueOpt this (nameof description) description diff --git a/src/ROCrate/ISAProfile/LabProcess.fs b/src/ROCrate/ISAProfile/LabProcess.fs new file mode 100644 index 00000000..a92bb6b9 --- /dev/null +++ b/src/ROCrate/ISAProfile/LabProcess.fs @@ -0,0 +1,30 @@ +namespace ARCtrl.ROCrate + +open DynamicObj +open Fable.Core + +/// +[] +type LabProcess( + id, + name, + agent, + object, + result, + ?additionalType, + ?executesLabProtocol, + ?parameterValue, + ?endTime, + ?disambiguatingDescription +) as this = + inherit ROCrateObject(id = id, schemaType = "bioschemas.org/LabProcess", ?additionalType = additionalType) + do + DynObj.setValue this (nameof name) name + DynObj.setValue this (nameof agent) agent + DynObj.setValue this (nameof object) object + DynObj.setValue this (nameof result) result + + DynObj.setValueOpt this (nameof executesLabProtocol) executesLabProtocol + DynObj.setValueOpt this (nameof parameterValue) parameterValue + DynObj.setValueOpt this (nameof endTime) endTime + DynObj.setValueOpt this (nameof disambiguatingDescription) disambiguatingDescription \ No newline at end of file diff --git a/src/ROCrate/ISAProfile/LabProtocol.fs b/src/ROCrate/ISAProfile/LabProtocol.fs new file mode 100644 index 00000000..ec830005 --- /dev/null +++ b/src/ROCrate/ISAProfile/LabProtocol.fs @@ -0,0 +1,31 @@ +namespace ARCtrl.ROCrate + +open DynamicObj +open Fable.Core + +/// +[] +type LabProtocol( + id, + ?additionalType, + ?name, + ?intendedUse, + ?description, + ?url, + ?comment, + ?version, + ?labEquipment, + ?reagent, + ?computationalTool +) as this = + inherit ROCrateObject(id = id, schemaType = "bioschemas.org/LabProtocol", ?additionalType = additionalType) + do + DynObj.setValueOpt this (nameof name) name + DynObj.setValueOpt this (nameof intendedUse) intendedUse + DynObj.setValueOpt this (nameof description) description + DynObj.setValueOpt this (nameof url) url + DynObj.setValueOpt this (nameof comment) comment + DynObj.setValueOpt this (nameof version) version + DynObj.setValueOpt this (nameof labEquipment) labEquipment + DynObj.setValueOpt this (nameof reagent) reagent + DynObj.setValueOpt this (nameof computationalTool) computationalTool diff --git a/src/ROCrate/ISAProfile/Person.fs b/src/ROCrate/ISAProfile/Person.fs new file mode 100644 index 00000000..39aa17be --- /dev/null +++ b/src/ROCrate/ISAProfile/Person.fs @@ -0,0 +1,37 @@ +namespace ARCtrl.ROCrate + +open DynamicObj +open Fable.Core + +/// +[] +type Person( + id, + givenName, + ?additionalType, + ?familyName, + ?email, + ?identifier, + ?affiliation, + ?jobTitle, + ?additionalName, + ?address, + ?telephone, + ?faxNumber, + ?disambiguatingDescription +) as this= + inherit ROCrateObject(id = id, schemaType = "schema.org/Person", ?additionalType = additionalType) + do + + DynObj.setValue this (nameof givenName) givenName + + DynObj.setValueOpt this (nameof familyName) familyName + DynObj.setValueOpt this (nameof email) email + DynObj.setValueOpt this (nameof identifier) identifier + DynObj.setValueOpt this (nameof affiliation) affiliation + DynObj.setValueOpt this (nameof jobTitle) jobTitle + DynObj.setValueOpt this (nameof additionalName) additionalName + DynObj.setValueOpt this (nameof address) address + DynObj.setValueOpt this (nameof telephone) telephone + DynObj.setValueOpt this (nameof faxNumber) faxNumber + DynObj.setValueOpt this (nameof disambiguatingDescription) disambiguatingDescription diff --git a/src/ROCrate/ISAProfile/PropertyValue.fs b/src/ROCrate/ISAProfile/PropertyValue.fs new file mode 100644 index 00000000..886d694f --- /dev/null +++ b/src/ROCrate/ISAProfile/PropertyValue.fs @@ -0,0 +1,27 @@ +namespace ARCtrl.ROCrate + +open DynamicObj +open Fable.Core + +/// +[] +type PropertyValue( + id, + name, + value, + ?propertyID, + ?unitCode, + ?unitText, + ?valueReference, + ?additionalType +) as this = + inherit ROCrateObject(id = id, schemaType = "schema.org/PropertyValue", ?additionalType = additionalType) + do + + DynObj.setValue this (nameof name) name + DynObj.setValue this (nameof value) value + + DynObj.setValueOpt this (nameof propertyID) propertyID + DynObj.setValueOpt this (nameof unitCode) unitCode + DynObj.setValueOpt this (nameof unitText) unitText + DynObj.setValueOpt this (nameof valueReference) valueReference diff --git a/src/ROCrate/ISAProfile/Sample.fs b/src/ROCrate/ISAProfile/Sample.fs new file mode 100644 index 00000000..e03deab3 --- /dev/null +++ b/src/ROCrate/ISAProfile/Sample.fs @@ -0,0 +1,20 @@ +namespace ARCtrl.ROCrate + +open DynamicObj +open Fable.Core + +/// +[] +type Sample( + id, + name, + ?additionalType, + ?additionalProperty, + ?derivesFrom +) as this = + inherit ROCrateObject(id = id, schemaType = "bioschemas.org/Sample", ?additionalType = additionalType) + do + DynObj.setValue this (nameof name) name + + DynObj.setValueOpt this (nameof additionalProperty) additionalProperty + DynObj.setValueOpt this (nameof derivesFrom) derivesFrom diff --git a/src/ROCrate/ISAProfile/ScholarlyArticle.fs b/src/ROCrate/ISAProfile/ScholarlyArticle.fs new file mode 100644 index 00000000..797b611a --- /dev/null +++ b/src/ROCrate/ISAProfile/ScholarlyArticle.fs @@ -0,0 +1,28 @@ +namespace ARCtrl.ROCrate + +open DynamicObj +open Fable.Core + +/// +[] +type ScholarlyArticle( + id, + headline, + identifier, + ?additionalType, + ?author, + ?url, + ?creativeWorkStatus, + ?disambiguatingDescription + +) as this = + inherit ROCrateObject(id = id, schemaType = "schema.org/ScholarlyArticle", ?additionalType = additionalType) + do + + DynObj.setValue this (nameof headline) headline + DynObj.setValue this (nameof identifier) identifier + + DynObj.setValueOpt this (nameof author) author + DynObj.setValueOpt this (nameof url) url + DynObj.setValueOpt this (nameof creativeWorkStatus) creativeWorkStatus + DynObj.setValueOpt this (nameof disambiguatingDescription) disambiguatingDescription \ No newline at end of file diff --git a/src/ROCrate/ISAProfile/Study.fs b/src/ROCrate/ISAProfile/Study.fs new file mode 100644 index 00000000..e8007004 --- /dev/null +++ b/src/ROCrate/ISAProfile/Study.fs @@ -0,0 +1,38 @@ +namespace ARCtrl.ROCrate + +open DynamicObj +open Fable.Core + +/// +[] +type Study( + id, + identifier, + ?about, + ?citation, + ?comment, + ?creator, + ?dateCreated, + ?dateModified, + ?datePublished, + ?description, + ?hasPart, + ?headline, + ?url +) as this = + inherit Dataset(id, "Study") + do + DynObj.setValue this (nameof identifier) identifier + + DynObj.setValueOpt this (nameof about) about + DynObj.setValueOpt this (nameof citation) citation + DynObj.setValueOpt this (nameof comment) comment + DynObj.setValueOpt this (nameof creator) creator + DynObj.setValueOpt this (nameof dateCreated) dateCreated + DynObj.setValueOpt this (nameof dateModified) dateModified + DynObj.setValueOpt this (nameof datePublished) datePublished + DynObj.setValueOpt this (nameof description) description + DynObj.setValueOpt this (nameof hasPart) hasPart + DynObj.setValueOpt this (nameof headline) headline + DynObj.setValueOpt this (nameof url) url + diff --git a/src/ROCrate/ROCrateObject.fs b/src/ROCrate/ROCrateObject.fs new file mode 100644 index 00000000..30b30108 --- /dev/null +++ b/src/ROCrate/ROCrateObject.fs @@ -0,0 +1,40 @@ +namespace ARCtrl.ROCrate + +open DynamicObj + +/// Base interface implemented by all explicitly known objects in our ROCrate profiles. +type IROCrateObject = + abstract member SchemaType : string with get, set + abstract member Id: string + abstract member AdditionalType: string option with get, set + +/// Base class for all explicitly known objects in our ROCrate profiles to inherit from. +/// Basically a DynamicObj that implements the IROPCrateObject interface. +type ROCrateObject(id:string, schemaType: string, ?additionalType) = + inherit DynamicObj() + + let mutable _schemaType = schemaType + let mutable _additionalType = additionalType + + member this.Id + with get() = id + + member this.SchemaType + with get() = _schemaType + and set(value) = _schemaType <- value + + member this.AdditionalType + with get() = _additionalType + and set(value) = _additionalType <- value + + interface IROCrateObject with + + member this.SchemaType + with get() = _schemaType + and set(value) = _schemaType <- value + + member this.Id = id + + member this.AdditionalType + with get() = _additionalType + and set(value) = _additionalType <- value \ No newline at end of file diff --git a/src/ROCrate/playground.fsx b/src/ROCrate/playground.fsx new file mode 100644 index 00000000..4b939a85 --- /dev/null +++ b/src/ROCrate/playground.fsx @@ -0,0 +1,132 @@ +#r "nuget: DynamicObj, 3.0.0" + +open DynamicObj + +type IROCrateObject = + abstract member SchemaType : string + abstract member Id: string + abstract member AdditionalType: string option + +type ROCrateObject(id:string, schemaType: string, ?additionalType) = + inherit DynamicObj() + + let mutable _schemaType = "schema.org/Dataset" + let mutable _additionalType = additionalType + + member this.Id + with get() = id + + member this.SchemaType + with get() = _schemaType + and set(value) = _schemaType <- value + + member this.AdditionalType + with get() = _additionalType + and set(value) = _additionalType <- value + + interface IROCrateObject with + member this.SchemaType = schemaType + member this.Id = id + member this.AdditionalType = additionalType + +type Dataset (id: string, ?additionalType: string) = + inherit ROCrateObject(id = id, schemaType = "schema.org/Dataset", ?additionalType = additionalType) + + //interface implementations + interface IROCrateObject with + member this.Id with get () = this.Id + member this.SchemaType with get (): string = this.SchemaType + member this.AdditionalType with get (): string option = this.AdditionalType + +/// +type Study(id: string) = + // inheritance + inherit Dataset(id, "Study") + static member create( + // mandatory + id, + // Properties from Thing + identifier, + // optional + // Properties from CreativeWork + ?about, + ?citation, + ?comment, + ?creator, + ?dateCreated, + ?dateModified, + ?datePublished, + ?hasPart, + ?headline, + ?url, + // Properties from Thing + ?description + ) = + let ds = Study(id = id) + + // Properties from CreativeWork + DynObj.setValueOpt ds (nameof about) about + DynObj.setValueOpt ds (nameof citation) citation + DynObj.setValueOpt ds (nameof comment) comment + DynObj.setValueOpt ds (nameof creator) creator + DynObj.setValueOpt ds (nameof dateCreated) dateCreated + DynObj.setValueOpt ds (nameof dateModified) dateModified + DynObj.setValueOpt ds (nameof datePublished) datePublished + DynObj.setValueOpt ds (nameof hasPart) hasPart + DynObj.setValueOpt ds (nameof headline) headline + DynObj.setValueOpt ds (nameof url) url + + // Properties from Thing + DynObj.setValueOpt ds (nameof description) description + DynObj.setValue ds (nameof identifier) identifier + + ds + +module I = + type Investigation( + id, + // Properties from Thing + identifier: obj, + // optional + // Properties from CreativeWork + ?citation, + ?comment, + ?creator, + ?dateCreated, + ?dateModified, + ?datePublished, + ?hasPart, + ?headline, + ?mentions, + ?url, + // Properties from Thing + ?description + ) as i = + + inherit Dataset(id, "Investigation") + + do + + // Properties from CreativeWork + DynObj.setValueOpt i (nameof citation) citation + DynObj.setValueOpt i (nameof comment) comment + DynObj.setValueOpt i (nameof creator) creator + DynObj.setValueOpt i (nameof dateCreated) dateCreated + DynObj.setValueOpt i (nameof dateModified) dateModified + DynObj.setValueOpt i (nameof datePublished) datePublished + DynObj.setValueOpt i (nameof hasPart) hasPart + DynObj.setValueOpt i (nameof headline) headline + DynObj.setValueOpt i (nameof mentions) mentions + DynObj.setValueOpt i (nameof url) url + + // Properties from Thing + DynObj.setValueOpt i (nameof description) description + DynObj.setValue i (nameof identifier) identifier + +I.Investigation("lol", [1.]) +I.Investigation("lol", "") +I.Investigation("lol", [2]) + +Study.create("lol", [2]) +Study.create("lol", [2.]) +Study.create("lol", "") \ No newline at end of file diff --git a/tests/ROCrate/ARCtrl.ROCrate.Tests.fsproj b/tests/ROCrate/ARCtrl.ROCrate.Tests.fsproj new file mode 100644 index 00000000..7d2bcc81 --- /dev/null +++ b/tests/ROCrate/ARCtrl.ROCrate.Tests.fsproj @@ -0,0 +1,28 @@ + + + + Exe + net8.0 + false + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/ROCrate/Common.fs b/tests/ROCrate/Common.fs new file mode 100644 index 00000000..862477e1 --- /dev/null +++ b/tests/ROCrate/Common.fs @@ -0,0 +1,38 @@ +module Tests.Common + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils + +module Expect = + + let inline ROCrateObjectHasId (expectedId:string) (roc:#ROCrateObject) = + Expect.equal roc.Id expectedId "object did not contain correct @id" + + let inline ROCrateObjectHasType (expectedType:string) (roc:#ROCrateObject) = + Expect.equal roc.SchemaType expectedType "object did not contain correct @type" + + let inline ROCrateObjectHasAdditionalType (expectedAdditionalType:string) (roc:#ROCrateObject) = + Expect.isSome roc.AdditionalType "additionalType was None" + Expect.equal roc.AdditionalType (Some expectedAdditionalType) "object did not contain correct additionalType" + + let inline ROCrateObjectHasDynamicProperty (expectedPropertyName:string) (expectedPropertyValue:'P) (roc:#ROCrateObject) = + Expect.isSome (roc.TryGetDynamicPropertyInfo(expectedPropertyName)) $"object did not contain the dynamic property '{expectedPropertyName}'" + Expect.equal + (DynObj.tryGetTypedValue<'P> expectedPropertyName roc) + (Some expectedPropertyValue) + $"property value of '{expectedPropertyName}' was not correct" + + let inline ROCrateObjectHasStaticProperty (expectedPropertyName:string) (expectedPropertyValue:'P) (roc:#ROCrateObject) = + Expect.isSome (roc.TryGetStaticPropertyInfo(expectedPropertyName)) $"object did not contain the dynamic property '{expectedPropertyName}'" + Expect.equal + (DynObj.tryGetTypedValue<'P> expectedPropertyName roc) + (Some expectedPropertyValue) + $"property value of '{expectedPropertyName}' was not correct" + + let inline ROCrateObjectHasExpectedInterfaceMembers (expectedType:string) (expectedId:string) (expectedAdditionalType:string option) (roc:#ROCrateObject) = + let interfacerino = roc :> IROCrateObject + Expect.equal interfacerino.SchemaType expectedType "object did not contain correct @type via interface access" + Expect.equal interfacerino.Id expectedId "object did not contain correct @id via interface access" + Expect.equal interfacerino.AdditionalType expectedAdditionalType "object did not contain correct additionalType via interface access" diff --git a/tests/ROCrate/ISAProfile/Assay.Tests.fs b/tests/ROCrate/ISAProfile/Assay.Tests.fs new file mode 100644 index 00000000..d32fafd8 --- /dev/null +++ b/tests/ROCrate/ISAProfile/Assay.Tests.fs @@ -0,0 +1,71 @@ +module Tests.Assay + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = Assay( + id = "assay_mandatory_properties_id", + identifier = "identifier" +) + +let all_properties = Assay( + id = "assay_all_properties_id", + identifier = "identifier", + about = "about", + comment = "comment", + creator = "creator", + hasPart = "hasPart", + measurementMethod = "measurementMethod", + measurementTechnique = "measurementTechnique", + url = "url", + variableMeasured = "variableMeasured" +) + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "assay_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Dataset" mandatory_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "Assay" mandatory_properties + testCase "identifier" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "identifier" "identifier" mandatory_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "assay_all_properties_id" all_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Dataset" all_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "Assay" all_properties + testCase "identifier" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "identifier" "identifier" all_properties + testCase "about" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "about" "about" all_properties + testCase "comment" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "comment" "comment" all_properties + testCase "creator" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "creator" "creator" all_properties + testCase "hasPart" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "hasPart" "hasPart" all_properties + testCase "measurementMethod" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "measurementMethod" "measurementMethod" all_properties + testCase "measurementTechnique" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "measurementTechnique" "measurementTechnique" all_properties + testCase "url" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "url" "url" all_properties + testCase "variableMeasured" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "variableMeasured" "variableMeasured" all_properties + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Dataset" "assay_mandatory_properties_id" (Some "Assay") mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Dataset" "assay_all_properties_id" (Some "Assay") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "Assay" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/ROCrate/ISAProfile/Data.Tests.fs b/tests/ROCrate/ISAProfile/Data.Tests.fs new file mode 100644 index 00000000..79d12cdb --- /dev/null +++ b/tests/ROCrate/ISAProfile/Data.Tests.fs @@ -0,0 +1,61 @@ +module Tests.Data + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = Data( + id = "data_mandatory_properties_id", + name = "name" +) + +let all_properties = Data( + id = "data_all_properties_id", + name = "name", + additionalType = "additionalType", + comment = "comment", + encodingFormat = "encodingFormat", + disambiguatingDescription = "disambiguatingDescription" +) + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "data_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/MediaObject" mandatory_properties + testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "data_all_properties_id" all_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/MediaObject" all_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties + testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties + testCase "comment" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "comment" "comment" all_properties + testCase "encodingFormat" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "encodingFormat" "encodingFormat" all_properties + testCase "disambiguatingDescription" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "disambiguatingDescription" "disambiguatingDescription" all_properties + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/MediaObject" "data_mandatory_properties_id" None mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/MediaObject" "data_all_properties_id" (Some "additionalType") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "Data" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/ROCrate/ISAProfile/Dataset.Tests.fs b/tests/ROCrate/ISAProfile/Dataset.Tests.fs new file mode 100644 index 00000000..a6619d0a --- /dev/null +++ b/tests/ROCrate/ISAProfile/Dataset.Tests.fs @@ -0,0 +1,45 @@ +module Tests.Dataset + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = Dataset("dataset_mandatory_properties_id") +let all_properties = Dataset("dataset_all_properties_id", additionalType = "additionalType") + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "dataset_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Dataset" mandatory_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "dataset_all_properties_id" all_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Dataset" all_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Dataset" "dataset_mandatory_properties_id" None mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Dataset" "dataset_all_properties_id" (Some "additionalType") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "Dataset" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/ROCrate/ISAProfile/Investigation.Tests.fs b/tests/ROCrate/ISAProfile/Investigation.Tests.fs new file mode 100644 index 00000000..1e0d15de --- /dev/null +++ b/tests/ROCrate/ISAProfile/Investigation.Tests.fs @@ -0,0 +1,77 @@ +module Tests.Investigation + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = Investigation( + id = "investigation_mandatory_properties_id", + identifier = "identifier" +) + +let all_properties = Investigation( + id = "investigation_all_properties_id", + identifier = "identifier", + citation = "citation", + comment = "comment", + creator = "creator", + dateCreated = "dateCreated", + dateModified = "dateModified", + datePublished = "datePublished", + hasPart = "hasPart", + headline = "headline", + mentions = "mentions", + url = "url", + description = "description" +) + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "investigation_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Dataset" mandatory_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "Investigation" mandatory_properties + testCase "identifier" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "identifier" "identifier" mandatory_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "investigation_all_properties_id" all_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Dataset" all_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "Investigation" all_properties + testCase "identifier" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "identifier" "identifier" all_properties + testCase "citation" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "citation" "citation" all_properties + testCase "comment" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "comment" "comment" all_properties + testCase "creator" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "creator" "creator" all_properties + testCase "dateCreated" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "dateCreated" "dateCreated" all_properties + testCase "dateModified" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "dateModified" "dateModified" all_properties + testCase "datePublished" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "datePublished" "datePublished" all_properties + testCase "hasPart" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "hasPart" "hasPart" all_properties + testCase "headline" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "headline" "headline" all_properties + testCase "mentions" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "mentions" "mentions" all_properties + testCase "url" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "url" "url" all_properties + testCase "description" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "description" "description" all_properties + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Dataset" "investigation_mandatory_properties_id" (Some "Investigation") mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Dataset" "investigation_all_properties_id" (Some "Investigation") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "Investigation" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/ROCrate/ISAProfile/LabProcess.tests.fs b/tests/ROCrate/ISAProfile/LabProcess.tests.fs new file mode 100644 index 00000000..a713a077 --- /dev/null +++ b/tests/ROCrate/ISAProfile/LabProcess.tests.fs @@ -0,0 +1,76 @@ +module Tests.LabProcess + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = LabProcess( + id = "labprocess_mandatory_properties_id", + name = "name", + agent = "agent", + object = "object", + result = "result" +) + +let all_properties = LabProcess( + id = "labprocess_all_properties_id", + name = "name", + agent = "agent", + object = "object", + result = "result", + additionalType = "additionalType", + executesLabProtocol = "executesLabProtocol", + parameterValue = "parameterValue", + endTime = "endTime", + disambiguatingDescription = "disambiguatingDescription" +) + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "labprocess_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "bioschemas.org/LabProcess" mandatory_properties + testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" mandatory_properties + testCase "agent" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "agent" "agent" mandatory_properties + testCase "object" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "object" "object" mandatory_properties + testCase "result" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "result" "result" mandatory_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "labprocess_all_properties_id" all_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "bioschemas.org/LabProcess" all_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties + testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties + testCase "agent" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "agent" "agent" all_properties + testCase "object" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "object" "object" all_properties + testCase "result" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "result" "result" all_properties + testCase "executesLabProtocol" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "executesLabProtocol" "executesLabProtocol" all_properties + testCase "parameterValue" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "parameterValue" "parameterValue" all_properties + testCase "endTime" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "endTime" "endTime" all_properties + testCase "disambiguatingDescription" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "disambiguatingDescription" "disambiguatingDescription" all_properties + + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "bioschemas.org/LabProcess" "labprocess_mandatory_properties_id" None mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "bioschemas.org/LabProcess" "labprocess_all_properties_id" (Some "additionalType") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "LabProcess" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/ROCrate/ISAProfile/LabProtocol.Tests.fs b/tests/ROCrate/ISAProfile/LabProtocol.Tests.fs new file mode 100644 index 00000000..3e88ea43 --- /dev/null +++ b/tests/ROCrate/ISAProfile/LabProtocol.Tests.fs @@ -0,0 +1,69 @@ +module Tests.LabProtocol + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = LabProtocol( + id = "labprotocol_mandatory_properties_id" +) + +let all_properties = LabProtocol( + id = "labprotocol_all_properties_id", + additionalType = "additionalType", + name = "name", + intendedUse = "intendedUse", + description = "description", + url = "url", + comment = "comment", + version = "version", + labEquipment = "labEquipment", + reagent = "reagent", + computationalTool = "computationalTool" +) + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "labprotocol_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "bioschemas.org/LabProtocol" mandatory_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "labprotocol_all_properties_id" all_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "bioschemas.org/LabProtocol" all_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties + testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties + testCase "intendedUse" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "intendedUse" "intendedUse" all_properties + testCase "description" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "description" "description" all_properties + testCase "url" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "url" "url" all_properties + testCase "comment" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "comment" "comment" all_properties + testCase "version" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "version" "version" all_properties + testCase "labEquipment" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "labEquipment" "labEquipment" all_properties + testCase "reagent" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "reagent" "reagent" all_properties + testCase "computationalTool" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "computationalTool" "computationalTool" all_properties + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "bioschemas.org/LabProtocol" "labprotocol_mandatory_properties_id" None mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "bioschemas.org/LabProtocol" "labprotocol_all_properties_id" (Some "additionalType") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "LabProtocol" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/ROCrate/ISAProfile/Person.Tests.fs b/tests/ROCrate/ISAProfile/Person.Tests.fs new file mode 100644 index 00000000..cf72916c --- /dev/null +++ b/tests/ROCrate/ISAProfile/Person.Tests.fs @@ -0,0 +1,75 @@ +module Tests.Person + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = Person( + id = "person_mandatory_properties_id", + givenName = "givenName" +) + +let all_properties = Person( + id = "person_all_properties_id", + givenName = "givenName", + additionalType = "additionalType", + familyName = "familyName", + email = "email", + identifier = "identifier", + affiliation = "affiliation", + jobTitle = "jobTitle", + additionalName = "additionalName", + address = "address", + telephone = "telephone", + faxNumber = "faxNumber", + disambiguatingDescription = "disambiguatingDescription" +) + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "person_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Person" mandatory_properties + testCase "givenName" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "givenName" "givenName" all_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "person_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Person" mandatory_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties + testCase "givenName" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "givenName" "givenName" all_properties + testCase "familyName" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "familyName" "familyName" all_properties + testCase "email" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "email" "email" all_properties + testCase "identifier" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "identifier" "identifier" all_properties + testCase "affiliation" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "affiliation" "affiliation" all_properties + testCase "jobTitle" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "jobTitle" "jobTitle" all_properties + testCase "additionalName" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "additionalName" "additionalName" all_properties + testCase "address" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "address" "address" all_properties + testCase "telephone" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "telephone" "telephone" all_properties + testCase "faxNumber" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "faxNumber" "faxNumber" all_properties + testCase "disambiguatingDescription" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "disambiguatingDescription" "disambiguatingDescription" all_properties + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Person" "person_mandatory_properties_id" None mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Person" "person_all_properties_id" (Some "additionalType") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "Person" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/ROCrate/ISAProfile/PropertyValue.Tests.fs b/tests/ROCrate/ISAProfile/PropertyValue.Tests.fs new file mode 100644 index 00000000..6ca0eebe --- /dev/null +++ b/tests/ROCrate/ISAProfile/PropertyValue.Tests.fs @@ -0,0 +1,67 @@ +module Tests.PropertyValue + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = PropertyValue( + id = "propertyvalue_mandatory_properties_id", + name = "name", + value = "value" +) + +let all_properties = PropertyValue( + id = "propertyvalue_all_properties_id", + name = "name", + value = "value", + propertyID = "propertyID", + unitCode = "unitCode", + unitText = "unitText", + valueReference = "valueReference", + additionalType = "additionalType" +) + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "propertyvalue_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/PropertyValue" mandatory_properties + testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties + testCase "value" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "value" "value" all_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "propertyvalue_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/PropertyValue" mandatory_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties + testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties + testCase "value" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "value" "value" all_properties + testCase "propertyID" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "propertyID" "propertyID" all_properties + testCase "unitCode" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "unitCode" "unitCode" all_properties + testCase "unitText" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "unitText" "unitText" all_properties + testCase "valueReference" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "valueReference" "valueReference" all_properties + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/PropertyValue" "propertyvalue_mandatory_properties_id" None mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/PropertyValue" "propertyvalue_all_properties_id" (Some "additionalType") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "PropertyValue" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/ROCrate/ISAProfile/Sample.tests.fs b/tests/ROCrate/ISAProfile/Sample.tests.fs new file mode 100644 index 00000000..bcc5b025 --- /dev/null +++ b/tests/ROCrate/ISAProfile/Sample.tests.fs @@ -0,0 +1,59 @@ +module Tests.Sample + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = Sample( + id = "sample_mandatory_properties_id", + name = "name" +) + +let all_properties = Sample( + id = "sample_all_properties_id", + name = "name", + additionalType = "additionalType", + additionalProperty = "additionalProperty", + derivesFrom = "derivesFrom" +) + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "sample_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "bioschemas.org/Sample" mandatory_properties + testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "sample_all_properties_id" all_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "bioschemas.org/Sample" all_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties + testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties + testCase "additionalProperty" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "additionalProperty" "additionalProperty" all_properties + testCase "derivesFrom" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "derivesFrom" "derivesFrom" all_properties + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "bioschemas.org/Sample" "sample_mandatory_properties_id" None mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "bioschemas.org/Sample" "sample_all_properties_id" (Some "additionalType") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "Sample" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/ROCrate/ISAProfile/ScholarlyArticle.Tests.fs b/tests/ROCrate/ISAProfile/ScholarlyArticle.Tests.fs new file mode 100644 index 00000000..ba498f3d --- /dev/null +++ b/tests/ROCrate/ISAProfile/ScholarlyArticle.Tests.fs @@ -0,0 +1,67 @@ +module Tests.ScholarlyArticle + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = ScholarlyArticle( + id = "scholarlyarticle_mandatory_properties_id", + headline = "headline", + identifier = "identifier" +) + +let all_properties = ScholarlyArticle( + id = "scholarlyarticle_all_properties_id", + headline = "headline", + identifier = "identifier", + additionalType = "additionalType", + author = "author", + url = "url", + creativeWorkStatus = "creativeWorkStatus", + disambiguatingDescription = "disambiguatingDescription" +) + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "scholarlyarticle_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/ScholarlyArticle" mandatory_properties + testCase "headline" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "headline" "headline" all_properties + testCase "identifier" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "identifier" "identifier" all_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "scholarlyarticle_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/ScholarlyArticle" mandatory_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties + testCase "headline" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "headline" "headline" all_properties + testCase "identifier" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "identifier" "identifier" all_properties + testCase "author" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "author" "author" all_properties + testCase "url" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "url" "url" all_properties + testCase "creativeWorkStatus" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "creativeWorkStatus" "creativeWorkStatus" all_properties + testCase "disambiguatingDescription" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "disambiguatingDescription" "disambiguatingDescription" all_properties + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/ScholarlyArticle" "scholarlyarticle_mandatory_properties_id" None mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/ScholarlyArticle" "scholarlyarticle_all_properties_id" (Some "additionalType") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "ScholarlyArticle" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/ROCrate/ISAProfile/Study.Tests.fs b/tests/ROCrate/ISAProfile/Study.Tests.fs new file mode 100644 index 00000000..05151e08 --- /dev/null +++ b/tests/ROCrate/ISAProfile/Study.Tests.fs @@ -0,0 +1,77 @@ +module Tests.Study + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = Study( + id = "study_mandatory_properties_id", + identifier = "identifier" +) + +let all_properties = Study( + id = "study_all_properties_id", + identifier = "identifier", + about = "about", + citation = "citation", + comment = "comment", + creator = "creator", + dateCreated = "dateCreated", + dateModified = "dateModified", + datePublished = "datePublished", + description = "description", + hasPart = "hasPart", + headline = "headline", + url = "url" +) + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "study_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Dataset" mandatory_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "Study" mandatory_properties + testCase "identifier" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "identifier" "identifier" mandatory_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "study_all_properties_id" all_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "schema.org/Dataset" all_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "Study" all_properties + testCase "identifier" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "identifier" "identifier" all_properties + testCase "about" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "about" "about" all_properties + testCase "citation" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "citation" "citation" all_properties + testCase "comment" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "comment" "comment" all_properties + testCase "creator" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "creator" "creator" all_properties + testCase "dateCreated" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "dateCreated" "dateCreated" all_properties + testCase "dateModified" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "dateModified" "dateModified" all_properties + testCase "datePublished" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "datePublished" "datePublished" all_properties + testCase "description" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "description" "description" all_properties + testCase "hasPart" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "hasPart" "hasPart" all_properties + testCase "headline" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "headline" "headline" all_properties + testCase "url" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "url" "url" all_properties + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Dataset" "study_mandatory_properties_id" (Some "Study") mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "schema.org/Dataset" "study_all_properties_id" (Some "Study") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "Study" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/ROCrate/Main.fs b/tests/ROCrate/Main.fs new file mode 100644 index 00000000..ef0393c2 --- /dev/null +++ b/tests/ROCrate/Main.fs @@ -0,0 +1,21 @@ +module ROCrate.Tests + +open Fable.Pyxpecto + +let all = testSequenced <| testList "ROCrate" [ + Tests.ROCrateObject.main + Tests.Dataset.main + Tests.Investigation.main + Tests.Study.main + Tests.Assay.main + Tests.LabProcess.main + Tests.LabProtocol.main + Tests.Sample.main + Tests.Data.main + Tests.PropertyValue.main + Tests.Person.main + Tests.ScholarlyArticle.main +] + +[] +let main argv = Pyxpecto.runTests [||] all diff --git a/tests/ROCrate/ROCrateObject.Tests.fs b/tests/ROCrate/ROCrateObject.Tests.fs new file mode 100644 index 00000000..6d2b0e5f --- /dev/null +++ b/tests/ROCrate/ROCrateObject.Tests.fs @@ -0,0 +1,45 @@ +module Tests.ROCrateObject + +open ARCtrl.ROCrate +open DynamicObj + +open TestingUtils +open Common + +let mandatory_properties = ROCrateObject("rocrateobject_mandatory_properties_id", "someType") +let all_properties = ROCrateObject("rocrateobject_all_properties_id", "someType", additionalType = "additionalType") + +let tests_profile_object_is_valid = testList "constructed properties" [ + testList "mandatory properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "rocrateobject_mandatory_properties_id" mandatory_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "someType" mandatory_properties + ] + testList "all properties" [ + testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "rocrateobject_all_properties_id" all_properties + testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "someType" all_properties + testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties + ] +] + +let tests_interface_members = testList "interface members" [ + testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "someType" "rocrateobject_mandatory_properties_id" None mandatory_properties + testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "someType" "rocrateobject_all_properties_id" (Some "additionalType") all_properties +] + +let tests_dynamic_members = testSequenced ( + testList "dynamic members" [ + testCase "property not present before setting" <| fun _ -> Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be set" + testCase "Set dynamic property" <| fun _ -> + mandatory_properties.SetValue("yes",42) + Expect.ROCrateObjectHasDynamicProperty "yes" 42 mandatory_properties + testCase "Remove dynamic property" <| fun _ -> + mandatory_properties.Remove("yes") + Expect.isNone (DynObj.tryGetTypedValue "yes" mandatory_properties) "dynamic property 'yes' was set although it was expected not to be removed" + ] +) + +let main = testList "ROCrateObject" [ + tests_profile_object_is_valid + tests_interface_members + tests_dynamic_members +] \ No newline at end of file diff --git a/tests/TestingUtils/TestObjects.ROCrate/ArcPrototype@70a7c83e7858a974bf913de2e27d8e44191fc73f.json b/tests/TestingUtils/TestObjects.ROCrate/ArcPrototype@70a7c83e7858a974bf913de2e27d8e44191fc73f.json new file mode 100644 index 00000000..380e2f56 --- /dev/null +++ b/tests/TestingUtils/TestObjects.ROCrate/ArcPrototype@70a7c83e7858a974bf913de2e27d8e44191fc73f.json @@ -0,0 +1,193 @@ +{ + "@type": "CreativeWork", + "@id": "ro-crate-metadata.json", + "about": { + "@id": "./", + "@type": "Investigation", + "additionalType": "Investigation", + "identifier": "ArcPrototype", + "filename": "isa.investigation.xlsx", + "title": "ArcPrototype", + "description": "A prototypic ARC that implements all specification standards accordingly", + "people": [ + { + "@id": "timo.muehlhaus@rptu.de", + "@type": "Person", + "orcid": "http://orcid.org/0000-0003-3925-6778", + "firstName": "Timo", + "lastName": "Mühlhaus", + "email": "timo.muehlhaus@rptu.de", + "phone": "0 49 (0)631 205 4657", + "address": "RPTU University of Kaiserslautern, Paul-Ehrlich-Str. 23 , 67663 Kaiserslautern", + "affiliation": { + "@type": "Organization", + "@id": "#Organization_RPTU_University_of_Kaiserslautern", + "name": "RPTU University of Kaiserslautern", + "@context": { + "sdo": "http://schema.org/", + "Organization": "sdo:Organization", + "name": "sdo:name" + } + }, + "roles": [ + { + "@id": "http://purl.org/spar/scoro/principal-investigator", + "@type": "OntologyAnnotation", + "annotationValue": "principal investigator", + "termSource": "scoro", + "termAccession": "http://purl.org/spar/scoro/principal-investigator", + "@context": { + "sdo": "http://schema.org/", + "OntologyAnnotation": "sdo:DefinedTerm", + "annotationValue": "sdo:name", + "termSource": "sdo:inDefinedTermSet", + "termAccession": "sdo:termCode", + "comments": "sdo:disambiguatingDescription" + } + } + ], + "@context": { + "sdo": "http://schema.org/", + "Person": "sdo:Person", + "orcid": "sdo:identifier", + "firstName": "sdo:givenName", + "lastName": "sdo:familyName", + "midInitials": "sdo:additionalName", + "email": "sdo:email", + "address": "sdo:address", + "phone": "sdo:telephone", + "fax": "sdo:faxNumber", + "comments": "sdo:disambiguatingDescription", + "roles": "sdo:jobTitle", + "affiliation": "sdo:affiliation" + } + }, + { + "@id": "garth@rptu.de", + "@type": "Person", + "firstName": "Christoph", + "lastName": "Garth", + "email": "garth@rptu.de", + "affiliation": { + "@type": "Organization", + "@id": "#Organization_RPTU_University_of_Kaiserslautern", + "name": "RPTU University of Kaiserslautern", + "@context": { + "sdo": "http://schema.org/", + "Organization": "sdo:Organization", + "name": "sdo:name" + } + }, + "roles": [ + { + "@id": "http://purl.org/spar/scoro/principal-investigator", + "@type": "OntologyAnnotation", + "annotationValue": "principal investigator", + "termSource": "scoro", + "termAccession": "http://purl.org/spar/scoro/principal-investigator", + "@context": { + "sdo": "http://schema.org/", + "OntologyAnnotation": "sdo:DefinedTerm", + "annotationValue": "sdo:name", + "termSource": "sdo:inDefinedTermSet", + "termAccession": "sdo:termCode", + "comments": "sdo:disambiguatingDescription" + } + } + ], + "@context": { + "sdo": "http://schema.org/", + "Person": "sdo:Person", + "orcid": "sdo:identifier", + "firstName": "sdo:givenName", + "lastName": "sdo:familyName", + "midInitials": "sdo:additionalName", + "email": "sdo:email", + "address": "sdo:address", + "phone": "sdo:telephone", + "fax": "sdo:faxNumber", + "comments": "sdo:disambiguatingDescription", + "roles": "sdo:jobTitle", + "affiliation": "sdo:affiliation" + } + }, + { + "@id": "maus@nfdi4plants.org", + "@type": "Person", + "orcid": "0000-0002-8241-5300", + "firstName": "Oliver", + "lastName": "Maus", + "email": "maus@nfdi4plants.org", + "address": "RPTU University of Kaiserslautern, Erwin-Schrödinger-Str. 56 , 67663 Kaiserslautern", + "affiliation": { + "@type": "Organization", + "@id": "#Organization_RPTU_University_of_Kaiserslautern", + "name": "RPTU University of Kaiserslautern", + "@context": { + "sdo": "http://schema.org/", + "Organization": "sdo:Organization", + "name": "sdo:name" + } + }, + "roles": [ + { + "@id": "http://purl.org/spar/scoro/research-assistant", + "@type": "OntologyAnnotation", + "annotationValue": "research assistant", + "termSource": "scoro", + "termAccession": "http://purl.org/spar/scoro/research-assistant", + "@context": { + "sdo": "http://schema.org/", + "OntologyAnnotation": "sdo:DefinedTerm", + "annotationValue": "sdo:name", + "termSource": "sdo:inDefinedTermSet", + "termAccession": "sdo:termCode", + "comments": "sdo:disambiguatingDescription" + } + } + ], + "@context": { + "sdo": "http://schema.org/", + "Person": "sdo:Person", + "orcid": "sdo:identifier", + "firstName": "sdo:givenName", + "lastName": "sdo:familyName", + "midInitials": "sdo:additionalName", + "email": "sdo:email", + "address": "sdo:address", + "phone": "sdo:telephone", + "fax": "sdo:faxNumber", + "comments": "sdo:disambiguatingDescription", + "roles": "sdo:jobTitle", + "affiliation": "sdo:affiliation" + } + } + ], + "@context": { + "sdo": "http://schema.org/", + "Investigation": "sdo:Dataset", + "identifier": "sdo:identifier", + "title": "sdo:headline", + "additionalType": "sdo:additionalType", + "description": "sdo:description", + "submissionDate": "sdo:dateCreated", + "publicReleaseDate": "sdo:datePublished", + "publications": "sdo:citation", + "people": "sdo:creator", + "studies": "sdo:hasPart", + "ontologySourceReferences": "sdo:mentions", + "comments": "sdo:comment", + "filename": "sdo:alternateName" + } + }, + "conformsTo": { + "@id": "https://w3id.org/ro/crate/1.1" + }, + "@context": { + "sdo": "http://schema.org/", + "arc": "http://purl.org/nfdi4plants/ontology/", + "CreativeWork": "sdo:CreativeWork", + "about": "sdo:about", + "conformsTo": "sdo:conformsTo" + } +} \ No newline at end of file diff --git a/tests/TestingUtils/TestingUtils.fsproj b/tests/TestingUtils/TestingUtils.fsproj index 782d49df..955e0f06 100644 --- a/tests/TestingUtils/TestingUtils.fsproj +++ b/tests/TestingUtils/TestingUtils.fsproj @@ -5,6 +5,7 @@ true + @@ -32,5 +33,6 @@ + \ No newline at end of file