Skip to content

Commit

Permalink
wip ro-crate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene committed Sep 4, 2024
1 parent ccd1805 commit 95cab6f
Show file tree
Hide file tree
Showing 22 changed files with 248 additions and 225 deletions.
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
3 changes: 1 addition & 2 deletions src/ROCrate/ARCtrl.ROCrate.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<Compile Include="IROCrateObject.fs" />
<Compile Include="ROCrateObject.fs" />
<Compile Include="ISAProfile\Dataset.fs" />
<Compile Include="ISAProfile\Investigation.fs" />
<Compile Include="ISAProfile\Study.fs" />
Expand All @@ -17,7 +17,6 @@
<Compile Include="ISAProfile\PropertyValue.fs" />
<Compile Include="ISAProfile\Person.fs" />
<Compile Include="ISAProfile\ScholarlyArticle.fs" />
<Compile Include="ROCrateObject.fs" />
<None Include="playground.fsx" />
<None Include="../../build/logo.png" Pack="true" PackagePath="\" />
</ItemGroup>
Expand Down
7 changes: 0 additions & 7 deletions src/ROCrate/IROCrateObject.fs

This file was deleted.

27 changes: 4 additions & 23 deletions src/ROCrate/ISAProfile/Data.fs
Original file line number Diff line number Diff line change
@@ -1,42 +1,23 @@
namespace ARCtrl.ROCrate
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
type Data(id: string, ?additionalType: string) =
inherit DynamicObj()

let mutable _schemaType = "schema.org/MediaObject"
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 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
inherit ROCrateObject(id = id, schemaType = "schema.org/MediaObject", ?additionalType = additionalType)

static member create(
// mandatory
id,
name,
?additionalType,
?comment,
?encodingFormat,
?disambiguatingDescription
) =
let d = Data(id)
let d = Data(id, ?additionalType = additionalType)

DynObj.setValue d (nameof name) name

Expand Down
18 changes: 2 additions & 16 deletions src/ROCrate/ISAProfile/Dataset.fs
Original file line number Diff line number Diff line change
@@ -1,26 +1,12 @@
namespace ARCtrl.ROCrate
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
type Dataset (id: string, ?additionalType: string) =
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
inherit ROCrateObject(id = id, schemaType = "schema.org/Dataset", ?additionalType = additionalType)

//interface implementations
interface IROCrateObject with
Expand Down
26 changes: 3 additions & 23 deletions src/ROCrate/ISAProfile/LabProcess.fs
Original file line number Diff line number Diff line change
@@ -1,32 +1,13 @@
namespace ARCtrl.ROCrate
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
type LabProcess(id: string, ?additionalType: string) =
inherit DynamicObj()

let mutable _schemaType = "bioschemas.org/LabProcess"
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 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
inherit ROCrateObject(id = id, schemaType = "bioschemas.org/LabProcess", ?additionalType = additionalType)

static member create(
// mandatory
Expand All @@ -42,14 +23,13 @@ type LabProcess(id: string, ?additionalType: string) =
?endTime,
?disambiguatingDescription
) =
let lp = LabProcess(id)
let lp = LabProcess(id, ?additionalType = additionalType)

DynObj.setValue lp (nameof name) name
DynObj.setValue lp (nameof agent) agent
DynObj.setValue lp (nameof object) object
DynObj.setValue lp (nameof result) result

DynObj.setValueOpt lp (nameof additionalType) additionalType
DynObj.setValueOpt lp (nameof executesLabProtocol) executesLabProtocol
DynObj.setValueOpt lp (nameof parameterValue) parameterValue
DynObj.setValueOpt lp (nameof endTime) endTime
Expand Down
27 changes: 4 additions & 23 deletions src/ROCrate/ISAProfile/LabProtocol.fs
Original file line number Diff line number Diff line change
@@ -1,36 +1,17 @@
namespace ARCtrl.ROCrate
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
type LabProtocol(id: string, ?additionalType: string) =
inherit DynamicObj()

let mutable _schemaType = "bioschemas.org/LabProtocol"
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 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
inherit ROCrateObject(id = id, schemaType = "bioschemas.org/LabProtocol", ?additionalType = additionalType)

static member create(
// mandatory
id,
?additionalType,
?name,
?intendedUse,
?description,
Expand All @@ -41,7 +22,7 @@ type LabProtocol(id: string, ?additionalType: string) =
?reagent,
?computationalTool
) =
let lp = LabProcess(id)
let lp = LabProcess(id, ?additionalType = additionalType)

DynObj.setValueOpt lp (nameof name) name
DynObj.setValueOpt lp (nameof intendedUse) intendedUse
Expand Down
27 changes: 4 additions & 23 deletions src/ROCrate/ISAProfile/Person.fs
Original file line number Diff line number Diff line change
@@ -1,37 +1,18 @@
namespace ARCtrl.ROCrate
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
type Person(id: string, ?additionalType: string) =
inherit DynamicObj()

let mutable _schemaType = "schema.org/Person"
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 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
inherit ROCrateObject(id = id, schemaType = "schema.org/Person", ?additionalType = additionalType)

static member create(
// mandatory
id,
givenName,
?additionalType,
?familyName,
?email,
?identifier,
Expand All @@ -43,7 +24,7 @@ type Person(id: string, ?additionalType: string) =
?faxNumber,
?disambiguatingDescription
) =
let p = Person(id)
let p = Person(id, ?additionalType = additionalType)

DynObj.setValue p (nameof givenName) givenName

Expand Down
24 changes: 2 additions & 22 deletions src/ROCrate/ISAProfile/PropertyValue.fs
Original file line number Diff line number Diff line change
@@ -1,32 +1,12 @@
namespace ARCtrl.ROCrate
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
type PropertyValue(id: string, ?additionalType: string) =
inherit DynamicObj()

let mutable _schemaType = "schema.org/PropertyValue"
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 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
inherit ROCrateObject(id = id, schemaType = "schema.org/PropertyValue", ?additionalType = additionalType)

static member create(
// mandatory
Expand Down
27 changes: 4 additions & 23 deletions src/ROCrate/ISAProfile/Sample.fs
Original file line number Diff line number Diff line change
@@ -1,41 +1,22 @@
namespace ARCtrl.ROCrate
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
type Sample(id: string, ?additionalType: string) =
inherit DynamicObj()

let mutable _schemaType = "bioschemas.org/Sample"
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 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
inherit ROCrateObject(id = id, schemaType = "bioschemas.org/Sample", ?additionalType = additionalType)

static member create(
// mandatory
id,
name,
?additionalType,
?additionalProperty,
?derivesFrom
) =
let s = Sample(id)
let s = Sample(id, ?additionalType = additionalType)

DynObj.setValue s (nameof name) name

Expand Down
27 changes: 4 additions & 23 deletions src/ROCrate/ISAProfile/ScholarlyArticle.fs
Original file line number Diff line number Diff line change
@@ -1,44 +1,25 @@
namespace ARCtrl.ROCrate
namespace ARCtrl.ROCrate

open DynamicObj
open Fable.Core

///
[<AttachMembers>]
type ScholarlyArticle(id: string, ?additionalType: string) =
inherit DynamicObj()

let mutable _schemaType = "schema.org/ScholarlyArticle"
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 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
inherit ROCrateObject(id = id, schemaType = "schema.org/ScholarlyArticle", ?additionalType = additionalType)

static member create(
// mandatory
id,
headline,
identifier,
?additionalType,
?author,
?url,
?creativeWorkStatus,
?disambiguatingDescription
) =
let sa = ScholarlyArticle(id)
let sa = ScholarlyArticle(id, ?additionalType = additionalType)

DynObj.setValue sa (nameof headline) headline
DynObj.setValue sa (nameof identifier) identifier
Expand Down
Loading

0 comments on commit 95cab6f

Please sign in to comment.