From c71b8a301fbdf95531a9ba0d33f8e6d0d238adc9 Mon Sep 17 00:00:00 2001 From: Kevin Schneider Date: Thu, 5 Sep 2024 08:19:23 +0200 Subject: [PATCH] correct interface implementation on ROCrateObject, remove interface implementation from Dataset --- src/ROCrate/ISAProfile/Dataset.fs | 6 ------ src/ROCrate/ISAProfile/Investigation.fs | 10 ++-------- src/ROCrate/ROCrateObject.fs | 15 +++++++++++---- tests/TestingUtils/TestingUtils.fsproj | 2 +- 4 files changed, 14 insertions(+), 19 deletions(-) diff --git a/src/ROCrate/ISAProfile/Dataset.fs b/src/ROCrate/ISAProfile/Dataset.fs index fd85b239..8fb712ca 100644 --- a/src/ROCrate/ISAProfile/Dataset.fs +++ b/src/ROCrate/ISAProfile/Dataset.fs @@ -7,9 +7,3 @@ open Fable.Core [] 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 \ No newline at end of file diff --git a/src/ROCrate/ISAProfile/Investigation.fs b/src/ROCrate/ISAProfile/Investigation.fs index 31213679..2498807c 100644 --- a/src/ROCrate/ISAProfile/Investigation.fs +++ b/src/ROCrate/ISAProfile/Investigation.fs @@ -7,10 +7,7 @@ open Fable.Core [] type Investigation( id, - // Properties from Thing identifier, - // optional - // Properties from CreativeWork ?citation, ?comment, ?creator, @@ -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 @@ -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 diff --git a/src/ROCrate/ROCrateObject.fs b/src/ROCrate/ROCrateObject.fs index a27bb8c7..30b30108 100644 --- a/src/ROCrate/ROCrateObject.fs +++ b/src/ROCrate/ROCrateObject.fs @@ -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. @@ -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 \ No newline at end of file + + member this.AdditionalType + with get() = _additionalType + and set(value) = _additionalType <- value \ No newline at end of file diff --git a/tests/TestingUtils/TestingUtils.fsproj b/tests/TestingUtils/TestingUtils.fsproj index 623113ea..955e0f06 100644 --- a/tests/TestingUtils/TestingUtils.fsproj +++ b/tests/TestingUtils/TestingUtils.fsproj @@ -5,7 +5,7 @@ true - +