Skip to content

Commit

Permalink
correct interface implementation on ROCrateObject, remove interface i…
Browse files Browse the repository at this point in the history
…mplementation from Dataset
  • Loading branch information
kMutagene committed Sep 5, 2024
1 parent 192812d commit c71b8a3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 19 deletions.
6 changes: 0 additions & 6 deletions src/ROCrate/ISAProfile/Dataset.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,3 @@ open Fable.Core
[<AttachMembers>]
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
10 changes: 2 additions & 8 deletions src/ROCrate/ISAProfile/Investigation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ open Fable.Core
[<AttachMembers>]
type Investigation(
id,
// Properties from Thing
identifier,
// optional
// Properties from CreativeWork
?citation,
?comment,
?creator,
Expand All @@ -21,12 +18,12 @@ type Investigation(
?headline,
?mentions,
?url,
// Properties from Thing
?description
) as this =
inherit Dataset(id, "Investigation")
do
// Properties from CreativeWork
DynObj.setValue this (nameof identifier) identifier

DynObj.setValueOpt this (nameof citation) citation
DynObj.setValueOpt this (nameof comment) comment
DynObj.setValueOpt this (nameof creator) creator
Expand All @@ -37,7 +34,4 @@ type Investigation(
DynObj.setValueOpt this (nameof headline) headline
DynObj.setValueOpt this (nameof mentions) mentions
DynObj.setValueOpt this (nameof url) url

// Properties from Thing
DynObj.setValueOpt this (nameof description) description
DynObj.setValue this (nameof identifier) identifier
15 changes: 11 additions & 4 deletions src/ROCrate/ROCrateObject.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ open DynamicObj

/// Base interface implemented by all explicitly known objects in our ROCrate profiles.
type IROCrateObject =
abstract member SchemaType : string
abstract member SchemaType : string with get, set
abstract member Id: string
abstract member AdditionalType: string option
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.
Expand All @@ -28,6 +28,13 @@ type ROCrateObject(id:string, schemaType: string, ?additionalType) =
and set(value) = _additionalType <- value

interface IROCrateObject with
member this.SchemaType = schemaType

member this.SchemaType
with get() = _schemaType
and set(value) = _schemaType <- value

member this.Id = id
member this.AdditionalType = additionalType

member this.AdditionalType
with get() = _additionalType
and set(value) = _additionalType <- value
2 changes: 1 addition & 1 deletion tests/TestingUtils/TestingUtils.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<ItemGroup>
<Content Include="testobjects.rocrate\ArcPrototype%4070a7c83e7858a974bf913de2e27d8e44191fc73f.json" />
<Content Include="TestObjects.ROCrate\ArcPrototype%4070a7c83e7858a974bf913de2e27d8e44191fc73f.json" />
<Compile Include="TestObjects.Json\Study.fs" />
<Compile Include="TestObjects.Json\ROCrate.fs" />
<Content Include="TestObjects.Json\MinimalJson.json" />
Expand Down

0 comments on commit c71b8a3

Please sign in to comment.