From 1319a6a4e2976dd2ac69fe6185719bed22493e80 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Tue, 25 Jul 2023 15:54:02 +0200 Subject: [PATCH] Rename libraries --- ArcGraphModel.sln | 70 ++-- build/ProjectInfo.fs | 2 +- playground.fsx | 2 +- src/ArcGraphModel.IO/ArcGraphModel.IO.fsproj | 48 --- src/ArcGraphModel.IO/packages.lock.json | 84 ---- .../Address.fs | 4 +- src/ArcGraphModel/ArcGraphModel.fsproj | 63 +-- .../ISA/KeyParser.fs | 4 +- src/ArcGraphModel/ISA/Regex.fs | 366 ++++++++++++++++++ src/ArcGraphModel/{ => ISA}/TableTransform.fs | 31 +- src/ArcGraphModel/{ => ISA}/Terms.fs | 0 .../ISA/TokenAggregation.fs | 23 +- .../ISA/Tokenization.fs | 4 +- .../ISA/Worksheet.fs | 4 +- src/ArcGraphModel/packages.lock.json | 37 +- .../ControlledVocabulary.fsproj | 43 ++ .../CvAttributeCollection.fs | 2 +- .../CvContainer.fs | 2 +- .../CvObject.fs | 2 +- .../CvParam.fs | 2 +- .../CvTerm.fs | 2 +- .../ICvBase.fs | 2 +- .../IParam.fs | 2 +- .../IParamBase.fs | 2 +- .../ParamValue.fs | 2 +- .../UserParam.fs | 2 +- src/ControlledVocabulary/packages.lock.json | 36 ++ .../ArcGraphModel.Tests.fsproj | 17 +- .../Fixtures/isa.investigation.xlsx | Bin .../ParseInvestigationTests.fs | 50 +-- .../TestUtils.fs | 50 +-- .../ContainerTests.fs | 0 .../ControlledVocabulary.Tests.fsproj} | 14 +- .../CvBaseTests.fs | 12 +- .../ParamTests.fs | 0 .../Program.fs | 0 36 files changed, 676 insertions(+), 308 deletions(-) delete mode 100644 src/ArcGraphModel.IO/ArcGraphModel.IO.fsproj delete mode 100644 src/ArcGraphModel.IO/packages.lock.json rename src/{ArcGraphModel.IO => ArcGraphModel}/Address.fs (94%) rename src/{ArcGraphModel.IO => ArcGraphModel}/ISA/KeyParser.fs (99%) create mode 100644 src/ArcGraphModel/ISA/Regex.fs rename src/ArcGraphModel/{ => ISA}/TableTransform.fs (99%) rename src/ArcGraphModel/{ => ISA}/Terms.fs (100%) rename src/{ArcGraphModel.IO => ArcGraphModel}/ISA/TokenAggregation.fs (90%) rename src/{ArcGraphModel.IO => ArcGraphModel}/ISA/Tokenization.fs (97%) rename src/{ArcGraphModel.IO => ArcGraphModel}/ISA/Worksheet.fs (98%) create mode 100644 src/ControlledVocabulary/ControlledVocabulary.fsproj rename src/{ArcGraphModel/CvTokens => ControlledVocabulary}/CvAttributeCollection.fs (99%) rename src/{ArcGraphModel/CvTokens => ControlledVocabulary}/CvContainer.fs (99%) rename src/{ArcGraphModel/CvTokens => ControlledVocabulary}/CvObject.fs (95%) rename src/{ArcGraphModel/CvTokens => ControlledVocabulary}/CvParam.fs (99%) rename src/{ArcGraphModel/CvTokens => ControlledVocabulary}/CvTerm.fs (96%) rename src/{ArcGraphModel/CvTokens => ControlledVocabulary}/ICvBase.fs (98%) rename src/{ArcGraphModel/CvTokens => ControlledVocabulary}/IParam.fs (98%) rename src/{ArcGraphModel/CvTokens => ControlledVocabulary}/IParamBase.fs (99%) rename src/{ArcGraphModel/CvTokens => ControlledVocabulary}/ParamValue.fs (99%) rename src/{ArcGraphModel/CvTokens => ControlledVocabulary}/UserParam.fs (98%) create mode 100644 src/ControlledVocabulary/packages.lock.json rename tests/{ArcGraphModel.IO.Tests => ArcGraphModel.Tests}/Fixtures/isa.investigation.xlsx (100%) rename tests/{ArcGraphModel.IO.Tests => ArcGraphModel.Tests}/IntegrationTests/ParseInvestigationTests.fs (93%) rename tests/{ArcGraphModel.IO.Tests => ArcGraphModel.Tests}/TestUtils.fs (95%) rename tests/{ArcGraphModel.Tests => ControlledVocabulary.Tests}/ContainerTests.fs (100%) rename tests/{ArcGraphModel.IO.Tests/ArcGraphModel.IO.Tests.fsproj => ControlledVocabulary.Tests/ControlledVocabulary.Tests.fsproj} (70%) rename tests/{ArcGraphModel.Tests => ControlledVocabulary.Tests}/CvBaseTests.fs (83%) rename tests/{ArcGraphModel.Tests => ControlledVocabulary.Tests}/ParamTests.fs (100%) rename tests/{ArcGraphModel.IO.Tests => ControlledVocabulary.Tests}/Program.fs (100%) diff --git a/ArcGraphModel.sln b/ArcGraphModel.sln index 23b4472..3536843 100644 --- a/ArcGraphModel.sln +++ b/ArcGraphModel.sln @@ -3,12 +3,8 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.0.31903.59 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ArcGraphModel", "src\ArcGraphModel\ArcGraphModel.fsproj", "{32B01B13-37E2-4C86-9612-4BD8F33313D3}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{2EB71559-9BE4-4E02-9763-9092876D1E4A}" EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ArcGraphModel.Tests", "tests\ArcGraphModel.Tests\ArcGraphModel.Tests.fsproj", "{81CE2F06-74BE-45F9-B2EB-2BFADD5B9C95}" -EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sln", "sln", "{CE1B84FD-33DE-48E4-A97A-A4BDC34E08F0}" ProjectSection(SolutionItems) = preProject .gitignore = .gitignore @@ -26,11 +22,22 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "sln", "sln", "{CE1B84FD-33D EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{67DA0DCC-75F4-4F30-91C3-309A48B13D49}" EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Build", "build\Build.fsproj", "{CAC69396-1A09-4D95-B552-78712A4DA166}" +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ControlledVocabulary", "src\ControlledVocabulary\ControlledVocabulary.fsproj", "{F8E5EFC0-C74B-4C3C-BC22-7A5286A31DF6}" +EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ArcGraphModel", "src\ArcGraphModel\ArcGraphModel.fsproj", "{E80010AC-0AEE-4D7C-A85C-3A20C1FB7070}" +EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ArcGraphModel.Tests", "tests\ArcGraphModel.Tests\ArcGraphModel.Tests.fsproj", "{5A2C8580-8D5E-4A90-A21F-2C45C672A259}" +EndProject +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ControlledVocabulary.Tests", "tests\ControlledVocabulary.Tests\ControlledVocabulary.Tests.fsproj", "{2CBEE59D-07E4-460E-8B97-9267965D3F46}" EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ArcGraphModel.IO", "src\ArcGraphModel.IO\ArcGraphModel.IO.fsproj", "{30A760EF-FCB8-4454-811F-18983A9C076B}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{3DB2A5F4-23F6-4A06-9AE5-CEAC0707735B}" + ProjectSection(SolutionItems) = preProject + build.cmd = build.cmd + build.sh = build.sh + global.json = global.json + EndProjectSection EndProject -Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "ArcGraphModel.IO.Tests", "tests\ArcGraphModel.IO.Tests\ArcGraphModel.IO.Tests.fsproj", "{921A1AF1-4FB4-43FC-9B5E-B53D291EE610}" +Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Build", "build\Build.fsproj", "{ED24D0E3-BA79-4F6D-9A30-D05FF4EBAFDB}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -38,35 +45,36 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {32B01B13-37E2-4C86-9612-4BD8F33313D3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {32B01B13-37E2-4C86-9612-4BD8F33313D3}.Debug|Any CPU.Build.0 = Debug|Any CPU - {32B01B13-37E2-4C86-9612-4BD8F33313D3}.Release|Any CPU.ActiveCfg = Release|Any CPU - {32B01B13-37E2-4C86-9612-4BD8F33313D3}.Release|Any CPU.Build.0 = Release|Any CPU - {81CE2F06-74BE-45F9-B2EB-2BFADD5B9C95}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {81CE2F06-74BE-45F9-B2EB-2BFADD5B9C95}.Debug|Any CPU.Build.0 = Debug|Any CPU - {81CE2F06-74BE-45F9-B2EB-2BFADD5B9C95}.Release|Any CPU.ActiveCfg = Release|Any CPU - {81CE2F06-74BE-45F9-B2EB-2BFADD5B9C95}.Release|Any CPU.Build.0 = Release|Any CPU - {CAC69396-1A09-4D95-B552-78712A4DA166}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CAC69396-1A09-4D95-B552-78712A4DA166}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CAC69396-1A09-4D95-B552-78712A4DA166}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CAC69396-1A09-4D95-B552-78712A4DA166}.Release|Any CPU.Build.0 = Release|Any CPU - {30A760EF-FCB8-4454-811F-18983A9C076B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {30A760EF-FCB8-4454-811F-18983A9C076B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {30A760EF-FCB8-4454-811F-18983A9C076B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {30A760EF-FCB8-4454-811F-18983A9C076B}.Release|Any CPU.Build.0 = Release|Any CPU - {921A1AF1-4FB4-43FC-9B5E-B53D291EE610}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {921A1AF1-4FB4-43FC-9B5E-B53D291EE610}.Debug|Any CPU.Build.0 = Debug|Any CPU - {921A1AF1-4FB4-43FC-9B5E-B53D291EE610}.Release|Any CPU.ActiveCfg = Release|Any CPU - {921A1AF1-4FB4-43FC-9B5E-B53D291EE610}.Release|Any CPU.Build.0 = Release|Any CPU + {F8E5EFC0-C74B-4C3C-BC22-7A5286A31DF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F8E5EFC0-C74B-4C3C-BC22-7A5286A31DF6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F8E5EFC0-C74B-4C3C-BC22-7A5286A31DF6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F8E5EFC0-C74B-4C3C-BC22-7A5286A31DF6}.Release|Any CPU.Build.0 = Release|Any CPU + {E80010AC-0AEE-4D7C-A85C-3A20C1FB7070}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E80010AC-0AEE-4D7C-A85C-3A20C1FB7070}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E80010AC-0AEE-4D7C-A85C-3A20C1FB7070}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E80010AC-0AEE-4D7C-A85C-3A20C1FB7070}.Release|Any CPU.Build.0 = Release|Any CPU + {5A2C8580-8D5E-4A90-A21F-2C45C672A259}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5A2C8580-8D5E-4A90-A21F-2C45C672A259}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5A2C8580-8D5E-4A90-A21F-2C45C672A259}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5A2C8580-8D5E-4A90-A21F-2C45C672A259}.Release|Any CPU.Build.0 = Release|Any CPU + {2CBEE59D-07E4-460E-8B97-9267965D3F46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2CBEE59D-07E4-460E-8B97-9267965D3F46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2CBEE59D-07E4-460E-8B97-9267965D3F46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2CBEE59D-07E4-460E-8B97-9267965D3F46}.Release|Any CPU.Build.0 = Release|Any CPU + {ED24D0E3-BA79-4F6D-9A30-D05FF4EBAFDB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED24D0E3-BA79-4F6D-9A30-D05FF4EBAFDB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED24D0E3-BA79-4F6D-9A30-D05FF4EBAFDB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED24D0E3-BA79-4F6D-9A30-D05FF4EBAFDB}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution - {32B01B13-37E2-4C86-9612-4BD8F33313D3} = {67DA0DCC-75F4-4F30-91C3-309A48B13D49} - {81CE2F06-74BE-45F9-B2EB-2BFADD5B9C95} = {2EB71559-9BE4-4E02-9763-9092876D1E4A} - {30A760EF-FCB8-4454-811F-18983A9C076B} = {67DA0DCC-75F4-4F30-91C3-309A48B13D49} - {921A1AF1-4FB4-43FC-9B5E-B53D291EE610} = {2EB71559-9BE4-4E02-9763-9092876D1E4A} + {F8E5EFC0-C74B-4C3C-BC22-7A5286A31DF6} = {67DA0DCC-75F4-4F30-91C3-309A48B13D49} + {E80010AC-0AEE-4D7C-A85C-3A20C1FB7070} = {67DA0DCC-75F4-4F30-91C3-309A48B13D49} + {5A2C8580-8D5E-4A90-A21F-2C45C672A259} = {2EB71559-9BE4-4E02-9763-9092876D1E4A} + {2CBEE59D-07E4-460E-8B97-9267965D3F46} = {2EB71559-9BE4-4E02-9763-9092876D1E4A} + {ED24D0E3-BA79-4F6D-9A30-D05FF4EBAFDB} = {3DB2A5F4-23F6-4A06-9AE5-CEAC0707735B} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {933E3470-7D09-4F22-A056-2407458B9600} diff --git a/build/ProjectInfo.fs b/build/ProjectInfo.fs index 2ad6b02..665a4d9 100644 --- a/build/ProjectInfo.fs +++ b/build/ProjectInfo.fs @@ -6,8 +6,8 @@ let project = "ArcGraphModel" let testProjects = [ + "tests/ControlledVocabulary.Tests" "tests/ArcGraphModel.Tests" - "tests/ArcGraphModel.IO.Tests" ] let solutionFile = $"{project}.sln" diff --git a/playground.fsx b/playground.fsx index 3987c28..1885361 100644 --- a/playground.fsx +++ b/playground.fsx @@ -29,7 +29,7 @@ open System.Collections.Generic //#r @"C:\Repos\nfdi4plants\ArcGraphModel\src\ArcGraphModel.IO\bin\Debug\netstandard2.0\ArcGraphModel.IO.dll" //#r @"C:/Users/olive/.nuget/packages/fsharpaux/1.1.0/lib/net5.0/FSharpAux.dll" #r "src/ArcGraphModel/bin/Debug/netstandard2.0/ArcGraphModel.dll" -#r "src/ArcGraphModel.IO/bin/Debug/netstandard2.0/ArcGraphModel.IO.dll" +#r "src/ControlledVocabulary/bin/Debug/netstandard2.0/ControlledVocabulary.dll" open FsSpreadsheet open FsSpreadsheet.ExcelIO diff --git a/src/ArcGraphModel.IO/ArcGraphModel.IO.fsproj b/src/ArcGraphModel.IO/ArcGraphModel.IO.fsproj deleted file mode 100644 index e4d242d..0000000 --- a/src/ArcGraphModel.IO/ArcGraphModel.IO.fsproj +++ /dev/null @@ -1,48 +0,0 @@ - - - - netstandard2.0 - true - true - - - - - - - - - - - - - Oliver Maus, Heinrich Lukas Weil, Timo Mühlhaus, Kevin Frey, Kevin Schneider - Fsharp Library for tokenization of isa and cwl files into the ArcGraphModel - Fsharp Library for tokenization of isa and cwl files into the ArcGraphModel - MIT - - F# FSharp datascience rdm arc dataplant nfdi4plants xlsx io isa fable fable-library fable-javascript - https://github.com/nfdi4plants/ArcGraphModel - git - - - - - - - - - <_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.PackageVersion)' != ''" /> - <_ProjectReferenceWithExactPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.ExactVersion)' == 'true'" /> - <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExplicitPackageVersion)' == '@(_ProjectReferencesWithVersions)'"> - @(_ProjectReferenceWithExplicitPackageVersion->'%(PackageVersion)') - - <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExactPackageVersion)' == '@(_ProjectReferencesWithVersions)'"> - [@(_ProjectReferencesWithVersions->'%(ProjectVersion)')] - - <_ProjectReferencesWithVersions Remove="@(_ProjectReferenceWithReassignedVersion)" /> - <_ProjectReferencesWithVersions Include="@(_ProjectReferenceWithReassignedVersion)" /> - - - - diff --git a/src/ArcGraphModel.IO/packages.lock.json b/src/ArcGraphModel.IO/packages.lock.json deleted file mode 100644 index 1bc7e7a..0000000 --- a/src/ArcGraphModel.IO/packages.lock.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "version": 1, - "dependencies": { - ".NETStandard,Version=v2.0": { - "FSharp.Core": { - "type": "Direct", - "requested": "[6.0.7, )", - "resolved": "6.0.7", - "contentHash": "e6wGrq5smV3Yk2fBE/Y0nBG5oFyF59k5Je0a0QDydUpg6liyaafGjD3xvutciKepCP2knspZ/sWViC/F1OyyQQ==" - }, - "NETStandard.Library": { - "type": "Direct", - "requested": "[2.0.3, )", - "resolved": "2.0.3", - "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", - "dependencies": { - "Microsoft.NETCore.Platforms": "1.1.0" - } - }, - "Aether": { - "type": "Transitive", - "resolved": "8.3.1", - "contentHash": "GKedgXPkm3nUO+Zbj9suNFQ/wCjw30ixUTgnrPvj0oJ9WiAyy1kDacJTHgTPTjyD1RILuDEPTPwsKGWlSpWLOw==", - "dependencies": { - "FSharp.Core": "4.3.4" - } - }, - "Fable.Core": { - "type": "Transitive", - "resolved": "4.0.0", - "contentHash": "crDLkyN4xADgnCqIneMUGVDo2oS92W4oufbIH/jwc8Fk7nIH6pS/Ds1rBB4R1jUfU1WM1k9GEPa4Up8cNj5VYw==" - }, - "FSharp.FGL": { - "type": "Transitive", - "resolved": "0.0.2", - "contentHash": "6tOOMs0Rm4bPIVPZ5eE3x2aQ299heMv3LCJBFGca0mb7JOPN5IeBRvcdVpHokQ1ag9ndCuFC98nOUQqu2DquEw==", - "dependencies": { - "Aether": "8.3.1", - "FSharp.Core": "5.0.0" - } - }, - "FSharp.FGL.ArrayAdjacencyGraph": { - "type": "Transitive", - "resolved": "0.0.2", - "contentHash": "L7JmdDkb375CcOVdAW5HFDpuj0ZQFuzVNhHOp/eJhH3xPWGJ5skeTLm8P0XWyxTjpCCAtoW2B0oScU+QtCgxSw==", - "dependencies": { - "FSharp.Core": "5.0.0", - "FSharp.FGL": "0.0.2" - } - }, - "FSharpAux.Core": { - "type": "Transitive", - "resolved": "2.0.0", - "contentHash": "ltsM7H9SsfnvjcWXm5TcoyBysatHpwR8krCfyXdWriMT0DBxZxji3bhxNOcm4HeQXD4slL2TrJgULXyiCtJBRQ==", - "dependencies": { - "FSharp.Core": "6.0.7" - } - }, - "FsSpreadsheet": { - "type": "Transitive", - "resolved": "3.1.0", - "contentHash": "ZBFN/UHnY5SvNTI4YB++saHRqwFlO/agYm/FzraW+uT/iNWz3DuHVDdFfL70a4Ngmtkntond23JBbV66NJhxbw==", - "dependencies": { - "FSharp.Core": "6.0.6", - "Fable.Core": "4.0.0" - } - }, - "Microsoft.NETCore.Platforms": { - "type": "Transitive", - "resolved": "1.1.0", - "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" - }, - "arcgraphmodel": { - "type": "Project", - "dependencies": { - "FSharp.Core": "[6.0.7, )", - "FSharp.FGL.ArrayAdjacencyGraph": "[0.0.2, 0.0.2]", - "FSharpAux.Core": "[2.0.0, 2.0.0]", - "FsSpreadsheet": "[3.1.0, 3.1.0]" - } - } - } - } -} \ No newline at end of file diff --git a/src/ArcGraphModel.IO/Address.fs b/src/ArcGraphModel/Address.fs similarity index 94% rename from src/ArcGraphModel.IO/Address.fs rename to src/ArcGraphModel/Address.fs index 36f27fe..76a98e6 100644 --- a/src/ArcGraphModel.IO/Address.fs +++ b/src/ArcGraphModel/Address.fs @@ -1,6 +1,6 @@ -namespace ArcGraphModel.IO +namespace ArcGraphModel -open ArcGraphModel +open ControlledVocabulary module Address = diff --git a/src/ArcGraphModel/ArcGraphModel.fsproj b/src/ArcGraphModel/ArcGraphModel.fsproj index f198e11..064d229 100644 --- a/src/ArcGraphModel/ArcGraphModel.fsproj +++ b/src/ArcGraphModel/ArcGraphModel.fsproj @@ -7,42 +7,51 @@ - - - - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - Oliver Maus, Heinrich Lukas Weil, Timo Mühlhaus, Kevin Frey, Kevin Schneider - Fsharp Library for working on ARCs as collection of controlled vocabulary token - Fsharp Library for working on ARCs as collection of controlled vocabulary token + Fsharp Library for tokenization of isa and cwl files into the ArcGraphModel + Fsharp Library for tokenization of isa and cwl files into the ArcGraphModel MIT - F# FSharp datascience rdm arc dataplant nfdi4plants fable fable-library fable-javascript + F# FSharp datascience rdm arc dataplant nfdi4plants xlsx io isa fable fable-library fable-javascript https://github.com/nfdi4plants/ArcGraphModel git + + + + + + + + + + + <_ProjectReferenceWithExplicitPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.PackageVersion)' != ''" /> + <_ProjectReferenceWithExactPackageVersion Include="@(ProjectReference->'%(FullPath)')" Condition="'%(ProjectReference.ExactVersion)' == 'true'" /> + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExplicitPackageVersion)' == '@(_ProjectReferencesWithVersions)'"> + @(_ProjectReferenceWithExplicitPackageVersion->'%(PackageVersion)') + + <_ProjectReferenceWithReassignedVersion Include="@(_ProjectReferencesWithVersions)" Condition="'%(Identity)' != '' And '@(_ProjectReferenceWithExactPackageVersion)' == '@(_ProjectReferencesWithVersions)'"> + [@(_ProjectReferencesWithVersions->'%(ProjectVersion)')] + + <_ProjectReferencesWithVersions Remove="@(_ProjectReferenceWithReassignedVersion)" /> + <_ProjectReferencesWithVersions Include="@(_ProjectReferenceWithReassignedVersion)" /> + + + diff --git a/src/ArcGraphModel.IO/ISA/KeyParser.fs b/src/ArcGraphModel/ISA/KeyParser.fs similarity index 99% rename from src/ArcGraphModel.IO/ISA/KeyParser.fs rename to src/ArcGraphModel/ISA/KeyParser.fs index 6e0962d..c864915 100644 --- a/src/ArcGraphModel.IO/ISA/KeyParser.fs +++ b/src/ArcGraphModel/ISA/KeyParser.fs @@ -1,6 +1,6 @@ -namespace ArcGraphModel.IO +namespace ArcGraphModel -open ArcGraphModel +open ControlledVocabulary open FSharpAux open FsSpreadsheet diff --git a/src/ArcGraphModel/ISA/Regex.fs b/src/ArcGraphModel/ISA/Regex.fs new file mode 100644 index 0000000..1808ee1 --- /dev/null +++ b/src/ArcGraphModel/ISA/Regex.fs @@ -0,0 +1,366 @@ +/// +/// This module contains unified regex patterns and matching functions to parse isa tab column headers to BuildingBlock information. +/// +namespace ArcGraphModel.ISA + +open System + +module Regex = + + module Pattern = + + /// This pattern is only used to remove any leftover #id attributes from previous Swate version. + /// `"Parameter [biological replicate#2]"` This #id is deprecated but the pattern can still be used to remove any from files. + /// Was deprecated before 2023. + [] + let IdPattern = "#\d+" // @"(?<=#)\d+(?=[\)\]])" <- Cannot be used in IE11 + + /// This pattern captures characters between squared brackets, without id: Parameter [biological replicate#2] -> [biological replicate] + /// + /// TODO: Could be redesigned to use capture groups, then it could return inner without brackets + /// + [] + let SquaredBracketsTermNamePattern = "\[.*\]" // @"(?<= \[)[^#\]]*(?=[\]#])" <- Cannot be used in IE11 + + /// Used to get unit name from Excel numberFormat: 0.00 "degree Celsius" --> degree Celsius + [] + let ExcelNumberFormat = "\"(?(.*?))\"" + + /// Hits Unit column header + [] + let UnitPattern = @"Unit" + + /// Hits Term Source REF and Term Accession Number column headers + /// + /// Example 1: "Term Source REF (MS:1003022)" + /// + /// Example 2: "Term Accession Number (MS:1003022)" + /// + /// the id part "MS:1003022" is captured as `id` group. + [] + let ReferenceColumnPattern = @"(Term Source REF|Term Accession Number)\s\((?.+)\)" + + /// Hits Term Accession Number column header + /// + /// Example 1: "Term Source REF (MS:1003022)" + /// + /// the id part "MS:1003022" is captured as `id` group. + [] + let TermSourceREFColumnPattern = @"Term Source REF\s\((?.+)\)" + + /// Hits Term Source REF column header + /// + /// Example 1: "Term Accession Number (MS:1003022)" + /// + /// the id part "MS:1003022" is captured as `id` group. + [] + let TermAccessionNumberColumnPattern = @"Term Accession Number\s\((?.+)\)" + + /// Hits term accession, without id: ENVO:01001831 + [] + let TermAnnotationShortPattern = @"(?\w+?):(?\w+)" //prev: @"[\w]+?:[\d]+" + + // https://obofoundry.org/id-policy.html#mapping-of-owl-ids-to-obo-format-ids + /// Regex pattern is designed to hit only Foundry-compliant URIs. + [] + let TermAnnotationURIPattern = @"http://purl.obolibrary.org/obo/(?\w+?)_(?\w+)" + + /// Watch this closely, this could hit some edge cases we do not want to cover. + [] + let TermAnnotationURIPattern_lessRestrictive = @".*\/(?\w+?)[:_](?\w+)" + + /// This pattern is used to match both Input and Output columns and capture the IOType as `iotype` group. + [] + let IOTypePattern = @"(Input|Output)\s\[(?.+)\]" + + /// This pattern is used to match Input column and capture the IOType as `iotype` group. + [] + let InputPattern = @"Input\s\[(?.+)\]" + + /// This pattern is used to match Output column and capture the IOType as `iotype` group. + [] + let OutputPattern = @"Output\s\[(?.+)\]" + + /// This pattern matches any column header starting with some text, followed by one whitespace and a term name inside squared brackets. + /// + /// Captures column type as named group: "termcolumntype" (e.g. Component, Characteristic .. ). + /// + /// Captures term name as named group: "termname" (e.g. instrument model). + /// + /// Exmp. 1: Parameter [instrument model] --> termcolumntype: Parameter; termname: instrument model + /// + /// Exmp. 2: Characteristic [species] --> termcolumntype: Characteristic; termname: species + [] + let TermColumnPattern = @"(?.+)\s\[(?.+)\]" + + /// This pattern is used to match auto-generated table names. Mainly used in ArcAssay.addTable(). Default tables will get such a name. + /// + /// Will match "New Table 10" and will capture the number as `number` group. + [] + let AutoGeneratedTableName = @"^New\sTable\s(?\d+)$" + + module ActivePatterns = + + open System.Text.RegularExpressions + + /// Matches, if the input string matches the given regex pattern. + let (|Regex|_|) pattern (input : string) = + let m = Regex.Match(input.Trim(), pattern) + if m.Success then Some(m) + else None + + /// Matches any column header starting with some text, followed by one whitespace and a term name inside squared brackets. + let (|TermColumn|_|) input = + match input with + | Regex Pattern.TermColumnPattern r -> + {|TermColumnType = r.Groups.["termcolumntype"].Value; TermName = r.Groups.["termname"].Value|} + |> Some + | _ -> None + + /// Matches a "Unit" column header. + let (|UnitColumnHeader|_|) input = + match input with + | Regex Pattern.UnitPattern _ -> Some() + | _ -> None + + /// Matches a "Parameter [Term]" or "Parameter Value [Term]" column header and returns the Term string. + let (|ParameterColumnHeader|_|) input = + match input with + | TermColumn r -> + match r.TermColumnType with + | "Parameter" + | "Parameter Value" -> Some r.TermName + | _ -> None + | _ -> None + + /// Matches a "Factor [Term]" or "Factor Value [Term]" column header and returns the Term string. + let (|FactorColumnHeader|_|) input = + match input with + | TermColumn r -> + match r.TermColumnType with + | "Factor" + | "Factor Value" -> Some r.TermName + | _ -> None + | _ -> None + + /// Matches a "Characteristic [Term]" or "Characteristics [Term]" or "Characteristics Value [Term]" column header and returns the Term string. + let (|CharacteristicColumnHeader|_|) input = + match input with + | TermColumn r -> + match r.TermColumnType with + | "Characteristic" + | "Characteristics" + | "Characteristics Value" -> Some r.TermName + | _ -> None + | _ -> None + + + /// Matches a short term string and returns the term source ref and the annotation number strings. + /// + /// Example: "MS:1003022" --> term source ref: "MS"; annotation number: "1003022" + let (|TermAnnotationShort|_|) input = + match input with + | Regex Pattern.TermAnnotationShortPattern value -> + let termsourceref = value.Groups.["termsourceref"].Value + let localtan = value.Groups.["localtan"].Value + {|TermSourceREF = termsourceref; LocalTAN = localtan|} + |> Some + | _ -> + None + + /// Matches a term string (either short or URI) and returns the term source ref and the annotation number strings. + /// + /// Example 1: "MS:1003022" --> term source ref: "MS"; annotation number: "1003022" + /// + /// Example 2: "http://purl.obolibrary.org/obo/MS_1003022" --> term source ref: "MS"; annotation number: "1003022" + let (|TermAnnotation|_|) input = + match input with + | Regex Pattern.TermAnnotationShortPattern value + | Regex Pattern.TermAnnotationURIPattern value + | Regex Pattern.TermAnnotationURIPattern_lessRestrictive value -> + let termsourceref = value.Groups.["termsourceref"].Value + let localtan = value.Groups.["localtan"].Value + {|TermSourceREF = termsourceref; LocalTAN = localtan; TermAccessionNumber = input|} + |> Some + | _ -> + None + + /// Matches a "Term Source REF (ShortTerm)" column header and returns the ShortTerm as Term Source Ref and Annotation Number. + /// + /// Example: "Term Source REF (MS:1003022)" --> term source ref: "MS"; annotation number: "1003022" + let (|TSRColumnHeader|_|) input = + match input with + | Regex Pattern.TermSourceREFColumnPattern r -> + match r.Groups.["id"].Value with + | TermAnnotation r -> Some r + | _ -> None + | _ -> None + + /// Matches a "Term Accession Number (ShortTerm)" column header and returns the ShortTerm as Term Source Ref and Annotation Number. + /// + /// Example: "Term Accession Number (MS:1003022)" --> term source ref: "MS"; annotation number: "1003022" + let (|TANColumnHeader|_|) input = + match input with + | Regex Pattern.TermAccessionNumberColumnPattern r -> + match r.Groups.["id"].Value with + | TermAnnotation r -> Some r + | _ -> None + | _ -> None + + /// Matches a "Input [InputType]" column header and returns the InputType as string. + let (|InputColumnHeader|_|) input = + match input with + | Regex Pattern.InputPattern r -> + Some r.Groups.["iotype"].Value + | _ -> None + + /// Matches a "Output [OutputType]" column header and returns the OutputType as string. + let (|OutputColumnHeader|_|) input = + match input with + | Regex Pattern.OutputPattern r -> + Some r.Groups.["iotype"].Value + | _ -> None + + + /// Matches auto-generated readable table names. Mainly used in ArcAssay.addTable(). Default tables will get such a name. + /// + /// Will match "New Table 10" and return the number `10`. + let (|AutoGeneratedTableName|_|) input = + match input with + | Regex Pattern.AutoGeneratedTableName r -> + r.Groups.["number"].Value |> int |> Some + | _ -> None + + open Pattern + open ActivePatterns + open System + open System.Text.RegularExpressions + + + + let tryParseTermAnnotationShort (str:string) = + match str.Trim() with + | Regex TermAnnotationShortPattern value -> + let termsourceref = value.Groups.["termsourceref"].Value + let localtan = value.Groups.["localtan"].Value + {|TermSourceREF = termsourceref; LocalTAN = localtan|} + |> Some + | _ -> None + + /// + /// This function can be used to extract `IDSPACE:LOCALID` (or: `Term Accession`) from Swate header strings or obofoundry conform URI strings. + /// + /// **Example 1:** "http://purl.obolibrary.org/obo/GO_000001" --> "GO:000001" + /// + /// **Example 2:** "Term Source REF (NFDI4PSO:0000064)" --> "NFDI4PSO:0000064" + /// + let tryParseTermAnnotation (str:string) = + match str.Trim() with + | Regex TermAnnotationShortPattern value + | Regex TermAnnotationURIPattern value + | Regex TermAnnotationURIPattern_lessRestrictive value -> + let termsourceref = value.Groups.["termsourceref"].Value + let localtan = value.Groups.["localtan"].Value + {|TermSourceREF = termsourceref; LocalTAN = localtan|} + |> Some + | _ -> + None + + /// Tries to parse 'str' to term accession and returns it in the format `Some "termsourceref:localtan"`. Exmp.: `Some "MS:000001"` + let tryGetTermAnnotationShortString (str:string) = + tryParseTermAnnotation str + |> Option.map (fun r -> r.TermSourceREF + ":" + r.LocalTAN) + + /// Parses 'str' to term accession and returns it in the format "termsourceref:localtan". Exmp.: "MS:000001" + let getTermAnnotationShortString (str:string) = + match tryGetTermAnnotationShortString str with + | Some s -> s + | None -> failwith $"Unable to parse '{str}' to term accession." + + /// + /// This function is used to parse Excel numberFormat string to term name. + /// + /// **Example 1:** "0.00 "degree Celsius"" --> "degree Celsius" + /// + let tryParseExcelNumberFormat (headerStr:string) = + match headerStr.Trim() with + | Regex ExcelNumberFormat value -> + // remove quotes at beginning and end of matched string + let numberFormat = value.Groups.["numberFormat"].Value + Some numberFormat + | _ -> + None + + /// + /// This function is used to match both Input and Output columns and capture the IOType as `iotype` group. + /// + /// **Example 1:** "Input [Sample]" --> "Sample" + /// + let tryParseIOTypeHeader (headerStr: string) = + match headerStr.Trim() with + | Regex IOTypePattern value -> + // remove quotes at beginning and end of matched string + let numberFormat = value.Groups.["iotype"].Value + Some numberFormat + | _ -> + None + + /// Matches any column header starting with some text, followed by one whitespace and a term name inside squared brackets. + let tryParseTermColumn input = + match input with + | TermColumn r -> Some r + | _ -> None + + + /// Matches a "Unit" column header. + let tryParseUnitColumnHeader input = + match input with + | UnitColumnHeader r -> Some r + | _ -> None + + /// Matches a "Parameter [Term]" or "Parameter Value [Term]" column header and returns the Term string. + let tryParseParameterColumnHeader input = + match input with + | ParameterColumnHeader r -> Some r + | _ -> None + + /// Matches a "Factor [Term]" or "Factor Value [Term]" column header and returns the Term string. + let tryParseFactorColumnHeader input = + match input with + | FactorColumnHeader r -> Some r + | _ -> None + + /// Matches a "Characteristic [Term]" or "Characteristics [Term]" or "Characteristics Value [Term]" column header and returns the Term string. + let tryParseCharacteristicColumnHeader input = + match input with + | CharacteristicColumnHeader r -> Some r + | _ -> None + + /// Matches a "Term Source REF (ShortTerm)" column header and returns the ShortTerm as Term Source Ref and Annotation Number. + /// + /// Example: "Term Source REF (MS:1003022)" --> term source ref: "MS"; annotation number: "1003022" + let tryParseTSRColumnHeader input = + match input with + | TSRColumnHeader r -> Some r + | _ -> None + + /// Matches a "Term Accession Number (ShortTerm)" column header and returns the ShortTerm as Term Source Ref and Annotation Number. + /// + /// Example: "Term Accession Number (MS:1003022)" --> term source ref: "MS"; annotation number: "1003022" + let tryParseTANColumnHeader input = + match input with + | TANColumnHeader r -> Some r + | _ -> None + + /// Matches a "Input [InputType]" column header and returns the InputType as string. + let tryParseInputColumnHeader input = + match input with + | InputColumnHeader r -> Some r + | _ -> None + + + /// Matches a "Output [OutputType]" column header and returns the OutputType as string. + let tryParseOutputColumnHeader input = + match input with + | OutputColumnHeader r -> Some r + | _ -> None diff --git a/src/ArcGraphModel/TableTransform.fs b/src/ArcGraphModel/ISA/TableTransform.fs similarity index 99% rename from src/ArcGraphModel/TableTransform.fs rename to src/ArcGraphModel/ISA/TableTransform.fs index 1100a52..c5b9603 100644 --- a/src/ArcGraphModel/TableTransform.fs +++ b/src/ArcGraphModel/ISA/TableTransform.fs @@ -1,5 +1,6 @@ namespace ArcGraphModel +open ControlledVocabulary open FSharpAux open FsSpreadsheet open FSharp.FGL @@ -78,9 +79,9 @@ module TableTransform = let tables = FsWorkbook.getTables workbook tables |> List.filter (fun t -> String.contains "annotationTable" t.Name) - /// + /// /// Returns all header cells from a given FsCellsCollection and a given FsTable. - /// + /// let getHeaderCellsOf (fcc : FsCellsCollection) (table : FsTable) = table.Cells fcc |> Seq.filter (fun c -> c.RowNumber = table.RangeAddress.FirstAddress.RowNumber) @@ -98,18 +99,18 @@ module TableTransform = |> Seq.toList //|> List.skip 1 - /// - /// Takes a list of header cells and splits them into a tuple of IO column header cells and Term-related Building Block header cells by using a given FsCellsCollection and a given FsTable. - /// + /// + /// Takes a list of header cells and splits them into a tuple of IO column header cells and Term-related Building Block header cells by using a given FsCellsCollection and a given FsTable. + /// let splitColumns (table : FsTable) (fcc : FsCellsCollection) (cl : FsCell list) = cl |> List.partition (fun c -> List.contains c.Value nodeColumnNames) - /// - /// Takes a list of header cells from Term-related Building Blocks and groups them into a list of Building Block units. - /// - /// (1 inner list = 1 Building Block unit) - /// + /// + /// Takes a list of header cells from Term-related Building Blocks and groups them into a list of Building Block units. + /// + /// (1 inner list = 1 Building Block unit) + /// let groupTermRelatedBuildingBlocks (table : FsTable) (fcc : FsCellsCollection) (cl : FsCell list) = cl |> Seq.groupWhen (fun h -> String.contains "[" h.Value) @@ -234,11 +235,11 @@ module TableTransform = CvParam("(n/a)", headerCell.Value, "(n/a)", ParamValue.Value dc.Value) ) - /// - /// Takes an FsWorkbook and returns a list of worksheet names and their respective IO columns as CvParam lists and Term-related Building Blocks as CvParam lists. - /// - /// (inner CvParam list: CvParams of a column, outer CvParam list: all columns in a worksheet's AnnotationTable) - /// + /// + /// Takes an FsWorkbook and returns a list of worksheet names and their respective IO columns as CvParam lists and Term-related Building Blocks as CvParam lists. + /// + /// (inner CvParam list: CvParams of a column, outer CvParam list: all columns in a worksheet's AnnotationTable) + /// let parseWorkbook wb = let tables = getAnnotationTables wb let worksheets = wb.GetWorksheets() diff --git a/src/ArcGraphModel/Terms.fs b/src/ArcGraphModel/ISA/Terms.fs similarity index 100% rename from src/ArcGraphModel/Terms.fs rename to src/ArcGraphModel/ISA/Terms.fs diff --git a/src/ArcGraphModel.IO/ISA/TokenAggregation.fs b/src/ArcGraphModel/ISA/TokenAggregation.fs similarity index 90% rename from src/ArcGraphModel.IO/ISA/TokenAggregation.fs rename to src/ArcGraphModel/ISA/TokenAggregation.fs index 3d15a5e..59b19be 100644 --- a/src/ArcGraphModel.IO/ISA/TokenAggregation.fs +++ b/src/ArcGraphModel/ISA/TokenAggregation.fs @@ -1,19 +1,20 @@ -namespace ArcGraphModel.IO +namespace ArcGraphModel -open ArcGraphModel +open ControlledVocabulary -module List = - - let splitByPredicate (predicate : 'T -> bool) (l : list<'T>) : 'T list * 'T list = - let rec loop toDo positives negatives = - match toDo with - | head :: tail when predicate head -> loop tail (head :: positives) negatives - | head :: tail -> loop tail positives (head :: negatives) - | [] -> positives |> List.rev,negatives |> List.rev - loop l [] [] module TokenAggregation = + module List = + + let splitByPredicate (predicate : 'T -> bool) (l : list<'T>) : 'T list * 'T list = + let rec loop toDo positives negatives = + match toDo with + | head :: tail when predicate head -> loop tail (head :: positives) negatives + | head :: tail -> loop tail positives (head :: negatives) + | [] -> positives |> List.rev,negatives |> List.rev + loop l [] [] + /// Merge two parameters /// /// First checks what kind of value the child param stores and then merges it into the parent diff --git a/src/ArcGraphModel.IO/ISA/Tokenization.fs b/src/ArcGraphModel/ISA/Tokenization.fs similarity index 97% rename from src/ArcGraphModel.IO/ISA/Tokenization.fs rename to src/ArcGraphModel/ISA/Tokenization.fs index 328bcca..79d27d6 100644 --- a/src/ArcGraphModel.IO/ISA/Tokenization.fs +++ b/src/ArcGraphModel/ISA/Tokenization.fs @@ -1,6 +1,6 @@ -namespace ArcGraphModel.IO +namespace ArcGraphModel -open ArcGraphModel +open ControlledVocabulary open FsSpreadsheet open KeyParser diff --git a/src/ArcGraphModel.IO/ISA/Worksheet.fs b/src/ArcGraphModel/ISA/Worksheet.fs similarity index 98% rename from src/ArcGraphModel.IO/ISA/Worksheet.fs rename to src/ArcGraphModel/ISA/Worksheet.fs index fda8817..0202966 100644 --- a/src/ArcGraphModel.IO/ISA/Worksheet.fs +++ b/src/ArcGraphModel/ISA/Worksheet.fs @@ -1,6 +1,6 @@ -namespace ArcGraphModel.IO +namespace ArcGraphModel -open ArcGraphModel +open ControlledVocabulary open FSharpAux open FsSpreadsheet diff --git a/src/ArcGraphModel/packages.lock.json b/src/ArcGraphModel/packages.lock.json index 5ae0880..c7f3730 100644 --- a/src/ArcGraphModel/packages.lock.json +++ b/src/ArcGraphModel/packages.lock.json @@ -29,14 +29,25 @@ }, "FsSpreadsheet": { "type": "Direct", - "requested": "[3.1.0, 3.1.0]", - "resolved": "3.1.0", - "contentHash": "ZBFN/UHnY5SvNTI4YB++saHRqwFlO/agYm/FzraW+uT/iNWz3DuHVDdFfL70a4Ngmtkntond23JBbV66NJhxbw==", + "requested": "[3.1.1, 3.1.1]", + "resolved": "3.1.1", + "contentHash": "dD9Je8u6XO8J2ZMrfRTljmlD992pW+8tvxsbCtvnvmDnzzuos/cxP1jYRjsEneSG4FSpRRQhzwtqkyvhCqxS1Q==", "dependencies": { "FSharp.Core": "6.0.6", "Fable.Core": "4.0.0" } }, + "FsSpreadsheet.ExcelIO": { + "type": "Direct", + "requested": "[3.1.1, 3.1.1]", + "resolved": "3.1.1", + "contentHash": "HVxKVw2lF+/1EWr6571thtHbEVcCP7MjFS1+OMEpQLTMZH3M8dJbNA0xFKaP2mMVzK2HESobbn7hrMzc6hi6zQ==", + "dependencies": { + "DocumentFormat.OpenXml": "[2.12.3]", + "FSharp.Core": "6.0.6", + "FsSpreadsheet": "[3.0.0, 4.0.0)" + } + }, "NETStandard.Library": { "type": "Direct", "requested": "[2.0.3, )", @@ -54,6 +65,14 @@ "FSharp.Core": "4.3.4" } }, + "DocumentFormat.OpenXml": { + "type": "Transitive", + "resolved": "2.12.3", + "contentHash": "qLww6khV25dTzGU3+9rG5vB6RbMoWuNA015151ZmazoepkvxW6/4a5u4QQASoXsZsBITsw5ZO0/Xpzm31tQ43g==", + "dependencies": { + "System.IO.Packaging": "4.7.0" + } + }, "Fable.Core": { "type": "Transitive", "resolved": "4.0.0", @@ -72,6 +91,18 @@ "type": "Transitive", "resolved": "1.1.0", "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" + }, + "System.IO.Packaging": { + "type": "Transitive", + "resolved": "4.7.0", + "contentHash": "9VV4KAbgRQZ79iEoG40KIeZy38O30oWwewScAST879+oki8g/Wa2HXZQgrhDDxQM4GkP1PnRJll05NMiVPbYAw==" + }, + "controlledvocabulary": { + "type": "Project", + "dependencies": { + "FSharp.Core": "[6.0.7, )", + "FSharpAux.Core": "[2.0.0, 2.0.0]" + } } } } diff --git a/src/ControlledVocabulary/ControlledVocabulary.fsproj b/src/ControlledVocabulary/ControlledVocabulary.fsproj new file mode 100644 index 0000000..04f3f1e --- /dev/null +++ b/src/ControlledVocabulary/ControlledVocabulary.fsproj @@ -0,0 +1,43 @@ + + + + netstandard2.0 + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + Oliver Maus, Heinrich Lukas Weil, Timo Mühlhaus, Kevin Frey, Kevin Schneider + Fsharp Library for working on ARCs as collection of controlled vocabulary token + Fsharp Library for working on ARCs as collection of controlled vocabulary token + MIT + + F# FSharp datascience rdm arc dataplant nfdi4plants fable fable-library fable-javascript + https://github.com/nfdi4plants/ArcGraphModel + git + + + diff --git a/src/ArcGraphModel/CvTokens/CvAttributeCollection.fs b/src/ControlledVocabulary/CvAttributeCollection.fs similarity index 99% rename from src/ArcGraphModel/CvTokens/CvAttributeCollection.fs rename to src/ControlledVocabulary/CvAttributeCollection.fs index 0e0faad..cdd8cd5 100644 --- a/src/ArcGraphModel/CvTokens/CvAttributeCollection.fs +++ b/src/ControlledVocabulary/CvAttributeCollection.fs @@ -1,4 +1,4 @@ -namespace ArcGraphModel +namespace ControlledVocabulary open System.Collections.Generic open FSharpAux diff --git a/src/ArcGraphModel/CvTokens/CvContainer.fs b/src/ControlledVocabulary/CvContainer.fs similarity index 99% rename from src/ArcGraphModel/CvTokens/CvContainer.fs rename to src/ControlledVocabulary/CvContainer.fs index e4e7276..a48d77c 100644 --- a/src/ArcGraphModel/CvTokens/CvContainer.fs +++ b/src/ControlledVocabulary/CvContainer.fs @@ -1,4 +1,4 @@ -namespace ArcGraphModel +namespace ControlledVocabulary open System.Collections.Generic open FSharpAux diff --git a/src/ArcGraphModel/CvTokens/CvObject.fs b/src/ControlledVocabulary/CvObject.fs similarity index 95% rename from src/ArcGraphModel/CvTokens/CvObject.fs rename to src/ControlledVocabulary/CvObject.fs index 2c11249..fc7aad4 100644 --- a/src/ArcGraphModel/CvTokens/CvObject.fs +++ b/src/ControlledVocabulary/CvObject.fs @@ -1,4 +1,4 @@ -namespace ArcGraphModel +namespace ControlledVocabulary open System.Collections.Generic diff --git a/src/ArcGraphModel/CvTokens/CvParam.fs b/src/ControlledVocabulary/CvParam.fs similarity index 99% rename from src/ArcGraphModel/CvTokens/CvParam.fs rename to src/ControlledVocabulary/CvParam.fs index 507b482..10cb3d6 100644 --- a/src/ArcGraphModel/CvTokens/CvParam.fs +++ b/src/ControlledVocabulary/CvParam.fs @@ -1,4 +1,4 @@ -namespace ArcGraphModel +namespace ControlledVocabulary open System open System.Collections.Generic diff --git a/src/ArcGraphModel/CvTokens/CvTerm.fs b/src/ControlledVocabulary/CvTerm.fs similarity index 96% rename from src/ArcGraphModel/CvTokens/CvTerm.fs rename to src/ControlledVocabulary/CvTerm.fs index 17e456c..ddf0796 100644 --- a/src/ArcGraphModel/CvTokens/CvTerm.fs +++ b/src/ControlledVocabulary/CvTerm.fs @@ -1,4 +1,4 @@ -namespace ArcGraphModel +namespace ControlledVocabulary /// Represents a term from a controlled vocabulary (Cv) /// in the form of: id|accession * name|value * refUri diff --git a/src/ArcGraphModel/CvTokens/ICvBase.fs b/src/ControlledVocabulary/ICvBase.fs similarity index 98% rename from src/ArcGraphModel/CvTokens/ICvBase.fs rename to src/ControlledVocabulary/ICvBase.fs index a1aff36..73cb879 100644 --- a/src/ArcGraphModel/CvTokens/ICvBase.fs +++ b/src/ControlledVocabulary/ICvBase.fs @@ -1,4 +1,4 @@ -namespace ArcGraphModel +namespace ControlledVocabulary open System.Collections.Generic diff --git a/src/ArcGraphModel/CvTokens/IParam.fs b/src/ControlledVocabulary/IParam.fs similarity index 98% rename from src/ArcGraphModel/CvTokens/IParam.fs rename to src/ControlledVocabulary/IParam.fs index b0b6009..c1624b5 100644 --- a/src/ArcGraphModel/CvTokens/IParam.fs +++ b/src/ControlledVocabulary/IParam.fs @@ -1,4 +1,4 @@ -namespace ArcGraphModel +namespace ControlledVocabulary open System.Collections.Generic open FSharpAux diff --git a/src/ArcGraphModel/CvTokens/IParamBase.fs b/src/ControlledVocabulary/IParamBase.fs similarity index 99% rename from src/ArcGraphModel/CvTokens/IParamBase.fs rename to src/ControlledVocabulary/IParamBase.fs index fb2bd76..ed9a319 100644 --- a/src/ArcGraphModel/CvTokens/IParamBase.fs +++ b/src/ControlledVocabulary/IParamBase.fs @@ -1,4 +1,4 @@ -namespace ArcGraphModel +namespace ControlledVocabulary open System diff --git a/src/ArcGraphModel/CvTokens/ParamValue.fs b/src/ControlledVocabulary/ParamValue.fs similarity index 99% rename from src/ArcGraphModel/CvTokens/ParamValue.fs rename to src/ControlledVocabulary/ParamValue.fs index 1655ebb..e75d639 100644 --- a/src/ArcGraphModel/CvTokens/ParamValue.fs +++ b/src/ControlledVocabulary/ParamValue.fs @@ -1,4 +1,4 @@ -namespace ArcGraphModel +namespace ControlledVocabulary open System diff --git a/src/ArcGraphModel/CvTokens/UserParam.fs b/src/ControlledVocabulary/UserParam.fs similarity index 98% rename from src/ArcGraphModel/CvTokens/UserParam.fs rename to src/ControlledVocabulary/UserParam.fs index 4a2ea3a..4b889a8 100644 --- a/src/ArcGraphModel/CvTokens/UserParam.fs +++ b/src/ControlledVocabulary/UserParam.fs @@ -1,4 +1,4 @@ -namespace ArcGraphModel +namespace ControlledVocabulary open System.Collections.Generic open FSharpAux diff --git a/src/ControlledVocabulary/packages.lock.json b/src/ControlledVocabulary/packages.lock.json new file mode 100644 index 0000000..91fd90c --- /dev/null +++ b/src/ControlledVocabulary/packages.lock.json @@ -0,0 +1,36 @@ +{ + "version": 1, + "dependencies": { + ".NETStandard,Version=v2.0": { + "FSharp.Core": { + "type": "Direct", + "requested": "[6.0.7, )", + "resolved": "6.0.7", + "contentHash": "e6wGrq5smV3Yk2fBE/Y0nBG5oFyF59k5Je0a0QDydUpg6liyaafGjD3xvutciKepCP2knspZ/sWViC/F1OyyQQ==" + }, + "FSharpAux.Core": { + "type": "Direct", + "requested": "[2.0.0, 2.0.0]", + "resolved": "2.0.0", + "contentHash": "ltsM7H9SsfnvjcWXm5TcoyBysatHpwR8krCfyXdWriMT0DBxZxji3bhxNOcm4HeQXD4slL2TrJgULXyiCtJBRQ==", + "dependencies": { + "FSharp.Core": "6.0.7" + } + }, + "NETStandard.Library": { + "type": "Direct", + "requested": "[2.0.3, )", + "resolved": "2.0.3", + "contentHash": "st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==", + "dependencies": { + "Microsoft.NETCore.Platforms": "1.1.0" + } + }, + "Microsoft.NETCore.Platforms": { + "type": "Transitive", + "resolved": "1.1.0", + "contentHash": "kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==" + } + } + } +} \ No newline at end of file diff --git a/tests/ArcGraphModel.Tests/ArcGraphModel.Tests.fsproj b/tests/ArcGraphModel.Tests/ArcGraphModel.Tests.fsproj index 0d45934..3b952cf 100644 --- a/tests/ArcGraphModel.Tests/ArcGraphModel.Tests.fsproj +++ b/tests/ArcGraphModel.Tests/ArcGraphModel.Tests.fsproj @@ -1,4 +1,4 @@ - + net6.0 @@ -7,13 +7,14 @@ - - - + + + + @@ -28,10 +29,10 @@ - - - - + + + + diff --git a/tests/ArcGraphModel.IO.Tests/Fixtures/isa.investigation.xlsx b/tests/ArcGraphModel.Tests/Fixtures/isa.investigation.xlsx similarity index 100% rename from tests/ArcGraphModel.IO.Tests/Fixtures/isa.investigation.xlsx rename to tests/ArcGraphModel.Tests/Fixtures/isa.investigation.xlsx diff --git a/tests/ArcGraphModel.IO.Tests/IntegrationTests/ParseInvestigationTests.fs b/tests/ArcGraphModel.Tests/IntegrationTests/ParseInvestigationTests.fs similarity index 93% rename from tests/ArcGraphModel.IO.Tests/IntegrationTests/ParseInvestigationTests.fs rename to tests/ArcGraphModel.Tests/IntegrationTests/ParseInvestigationTests.fs index 51224db..6a45e14 100644 --- a/tests/ArcGraphModel.IO.Tests/IntegrationTests/ParseInvestigationTests.fs +++ b/tests/ArcGraphModel.Tests/IntegrationTests/ParseInvestigationTests.fs @@ -1,25 +1,25 @@ -module IntegrationTests.Investigation - -open FsSpreadsheet -open FsSpreadsheet.ExcelIO -open ArcGraphModel -open ArcGraphModel.IO -open Xunit - -open TestUtils - - -let inves = FsWorkbook.fromXlsxFile "Fixtures/isa.investigation.xlsx" -let invesWs = FsWorkbook.getWorksheets inves |> Seq.head -let invesWsParsed = Worksheet.parseRowsFlat invesWs - -//let cvp1 = CvParam("", "ONTOLOGY SOURCE REFERENCE", "", ParamValue.Value "", []) -let up1 = UserParam("ONTOLOGY SOURCE REFERENCE", ParamValue.Value "", []) - -[] -let ``First Param is UserParam`` () = - Assert.True (invesWsParsed.Head |> UserParam.tryUserParam).IsSome - -[] -let ``First UserParam name`` () = UserParam.termNamesEqual (invesWsParsed.Head :?> UserParam) up1 - +module IntegrationTests.Investigation + +open ControlledVocabulary +open FsSpreadsheet +open FsSpreadsheet.ExcelIO +open ArcGraphModel +open Xunit + +open TestUtils + + +let inves = FsWorkbook.fromXlsxFile "Fixtures/isa.investigation.xlsx" +let invesWs = FsWorkbook.getWorksheets inves |> Seq.head +let invesWsParsed = Worksheet.parseRowsFlat invesWs + +//let cvp1 = CvParam("", "ONTOLOGY SOURCE REFERENCE", "", ParamValue.Value "", []) +let up1 = UserParam("ONTOLOGY SOURCE REFERENCE", ParamValue.Value "", []) + +[] +let ``First Param is UserParam`` () = + Assert.True (invesWsParsed.Head |> UserParam.tryUserParam).IsSome + +[] +let ``First UserParam name`` () = UserParam.termNamesEqual (invesWsParsed.Head :?> UserParam) up1 + diff --git a/tests/ArcGraphModel.IO.Tests/TestUtils.fs b/tests/ArcGraphModel.Tests/TestUtils.fs similarity index 95% rename from tests/ArcGraphModel.IO.Tests/TestUtils.fs rename to tests/ArcGraphModel.Tests/TestUtils.fs index 083a294..140ef8e 100644 --- a/tests/ArcGraphModel.IO.Tests/TestUtils.fs +++ b/tests/ArcGraphModel.Tests/TestUtils.fs @@ -1,25 +1,25 @@ -module TestUtils - -open Xunit - - -module CvParam = - - open ArcGraphModel - - let termNamesEqual (cvpActual : CvParam) (cvpExpectec : CvParam) = - Assert.Equal( - (CvBase.getCvName cvpActual), - (CvBase.getCvName cvpExpectec) - ) - - -module UserParam = - - open ArcGraphModel - - let termNamesEqual (upActual : UserParam) (upExpectec : UserParam) = - Assert.Equal( - (CvBase.getCvName upActual), - (CvBase.getCvName upExpectec) - ) +module TestUtils + +open Xunit +open ControlledVocabulary + +module CvParam = + + open ArcGraphModel + + let termNamesEqual (cvpActual : CvParam) (cvpExpectec : CvParam) = + Assert.Equal( + (CvBase.getCvName cvpActual), + (CvBase.getCvName cvpExpectec) + ) + + +module UserParam = + + open ArcGraphModel + + let termNamesEqual (upActual : UserParam) (upExpectec : UserParam) = + Assert.Equal( + (CvBase.getCvName upActual), + (CvBase.getCvName upExpectec) + ) diff --git a/tests/ArcGraphModel.Tests/ContainerTests.fs b/tests/ControlledVocabulary.Tests/ContainerTests.fs similarity index 100% rename from tests/ArcGraphModel.Tests/ContainerTests.fs rename to tests/ControlledVocabulary.Tests/ContainerTests.fs diff --git a/tests/ArcGraphModel.IO.Tests/ArcGraphModel.IO.Tests.fsproj b/tests/ControlledVocabulary.Tests/ControlledVocabulary.Tests.fsproj similarity index 70% rename from tests/ArcGraphModel.IO.Tests/ArcGraphModel.IO.Tests.fsproj rename to tests/ControlledVocabulary.Tests/ControlledVocabulary.Tests.fsproj index f5c0a8e..15cdadb 100644 --- a/tests/ArcGraphModel.IO.Tests/ArcGraphModel.IO.Tests.fsproj +++ b/tests/ControlledVocabulary.Tests/ControlledVocabulary.Tests.fsproj @@ -7,15 +7,13 @@ - - - + + + - - @@ -29,7 +27,11 @@ - + + + + + diff --git a/tests/ArcGraphModel.Tests/CvBaseTests.fs b/tests/ControlledVocabulary.Tests/CvBaseTests.fs similarity index 83% rename from tests/ArcGraphModel.Tests/CvBaseTests.fs rename to tests/ControlledVocabulary.Tests/CvBaseTests.fs index 83a5719..3c4d44e 100644 --- a/tests/ArcGraphModel.Tests/CvBaseTests.fs +++ b/tests/ControlledVocabulary.Tests/CvBaseTests.fs @@ -1,11 +1,13 @@ module CvBaseTests.Casting -open ArcGraphModel +open ControlledVocabulary open Xunit +let assayTerm = "ARCO:1234","Assay","ARCO" + [] let ``ICvBase can be cast to CvParam using generic tryAs`` () = - let v = CvParam(Terms.assay,ParamValue.Value 5) :> ICvBase + let v = CvParam(assayTerm,ParamValue.Value 5) :> ICvBase let result = CvBase.tryAs v Assert.True(result.IsSome) @@ -16,7 +18,7 @@ let ``ICvBase can be cast to CvParam using generic tryAs`` () = [] let ``ICvBase can be cast to CvParam using tryCvParam`` () = - let v = CvParam(Terms.assay,ParamValue.Value 5) :> ICvBase + let v = CvParam(assayTerm,ParamValue.Value 5) :> ICvBase let result = CvParam.tryCvParam v Assert.True(result.IsSome) @@ -49,12 +51,12 @@ let ``ICvBase can be cast to UserParam using tryUserParam`` () = [] let ``ICvBase can be cast to CvContainer using generic tryAs`` () = - let v = CvContainer(Terms.assay) :> ICvBase + let v = CvContainer(assayTerm) :> ICvBase let result = CvBase.tryAs v Assert.True(result.IsSome) [] let ``ICvBase can be cast to UserParam using tryCvContainer`` () = - let v = CvContainer(Terms.assay) :> ICvBase + let v = CvContainer(assayTerm) :> ICvBase let result = CvContainer.tryCvContainer v Assert.True(result.IsSome) diff --git a/tests/ArcGraphModel.Tests/ParamTests.fs b/tests/ControlledVocabulary.Tests/ParamTests.fs similarity index 100% rename from tests/ArcGraphModel.Tests/ParamTests.fs rename to tests/ControlledVocabulary.Tests/ParamTests.fs diff --git a/tests/ArcGraphModel.IO.Tests/Program.fs b/tests/ControlledVocabulary.Tests/Program.fs similarity index 100% rename from tests/ArcGraphModel.IO.Tests/Program.fs rename to tests/ControlledVocabulary.Tests/Program.fs