Skip to content

Commit

Permalink
Merge pull request #426 from nfdi4plants/ro-crate-data-model
Browse files Browse the repository at this point in the history
Ro crate data model
  • Loading branch information
HLWeil authored Sep 5, 2024
2 parents 08eec01 + c71b8a3 commit 8b4368a
Show file tree
Hide file tree
Showing 35 changed files with 1,633 additions and 2 deletions.
14 changes: 14 additions & 0 deletions ARCtrl.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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}
Expand Down
1 change: 0 additions & 1 deletion build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@

set PYTHONIOENCODING=utf-8
dotnet tool restore
cls
dotnet run --project ./build/build.fsproj %*
1 change: 1 addition & 0 deletions build/ProjectInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ let testProjects =
"tests/Yaml"
"tests/ValidationPackages"
"tests/Contract"
"tests/ROCrate"
]

/// Native JS test paths
Expand Down
29 changes: 28 additions & 1 deletion build/TestTasks.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module TestTasks
module TestTasks

open BlackFox.Fake
open Fake.DotNet
Expand Down Expand Up @@ -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] {
()
}
36 changes: 36 additions & 0 deletions src/ROCrate/ARCtrl.ROCrate.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="ROCrateObject.fs" />
<Compile Include="ISAProfile\Dataset.fs" />
<Compile Include="ISAProfile\Investigation.fs" />
<Compile Include="ISAProfile\Study.fs" />
<Compile Include="ISAProfile\Assay.fs" />
<Compile Include="ISAProfile\LabProcess.fs" />
<Compile Include="ISAProfile\LabProtocol.fs" />
<Compile Include="ISAProfile\Sample.fs" />
<Compile Include="ISAProfile\Data.fs" />
<Compile Include="ISAProfile\PropertyValue.fs" />
<Compile Include="ISAProfile\Person.fs" />
<Compile Include="ISAProfile\ScholarlyArticle.fs" />
<None Include="playground.fsx" />
<None Include="../../build/logo.png" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="DynamicObj" Version="3.1.0" />
</ItemGroup>
<PropertyGroup>
<Authors>Kevin Schneider, nfdi4plants, DataPLANT OSS contributors</Authors>
<Description>A data model of the ARC concept via it's RO Crate profile</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>logo.png</PackageIcon>
<PackageTags>ARC F# FSharp dotnet .Net bioinformatics biology fable-library datascience dataplant nfdi metadata</PackageTags>
<PackageProjectUrl>https://github.com/nfdi4plants/ARCtrl/tree/main/src/CWL</PackageProjectUrl>
<RepositoryUrl>https://github.com/nfdi4plants/ARCtrl</RepositoryUrl>
<RepositoryType>git</RepositoryType>
</PropertyGroup>
</Project>
31 changes: 31 additions & 0 deletions src/ROCrate/ISAProfile/Assay.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
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
23 changes: 23 additions & 0 deletions src/ROCrate/ISAProfile/Data.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
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

9 changes: 9 additions & 0 deletions src/ROCrate/ISAProfile/Dataset.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
type Dataset (id: string, ?additionalType: string) =
inherit ROCrateObject(id = id, schemaType = "schema.org/Dataset", ?additionalType = additionalType)
37 changes: 37 additions & 0 deletions src/ROCrate/ISAProfile/Investigation.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
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
30 changes: 30 additions & 0 deletions src/ROCrate/ISAProfile/LabProcess.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
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
31 changes: 31 additions & 0 deletions src/ROCrate/ISAProfile/LabProtocol.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
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
37 changes: 37 additions & 0 deletions src/ROCrate/ISAProfile/Person.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
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
27 changes: 27 additions & 0 deletions src/ROCrate/ISAProfile/PropertyValue.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
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
20 changes: 20 additions & 0 deletions src/ROCrate/ISAProfile/Sample.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
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
Loading

0 comments on commit 8b4368a

Please sign in to comment.