Skip to content

Commit 2834a60

Browse files
caroottHLWeil
authored andcommitted
add ARCWorkflow to Dataset
1 parent e3deae4 commit 2834a60

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

src/ROCrate/ARCtrl.ROCrate.fsproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@
2828
<Compile Include="Generic\LabProcess.fs" />
2929
<Compile Include="Generic\CreateAction.fs" />
3030
<Compile Include="Generic\CreativeWork.fs" />
31-
<Compile Include="Generic\Dataset.fs" />
3231
<Compile Include="Generic\SoftwareApplication.fs" />
3332
<Compile Include="Generic\FormalParameter.fs" />
3433
<Compile Include="Generic\ComputationalWorkflow.fs" />
3534
<Compile Include="Generic\SoftwareSourceCode.fs" />
3635
<Compile Include="Generic\WorkflowProtocol.fs" />
36+
<Compile Include="Generic\Dataset.fs" />
3737

3838
<!-- ISA Profile types -->
3939
<Compile Include="ISAProfile\Dataset.fs" />

src/ROCrate/Generic/Dataset.fs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ type LDDataset =
4848

4949
static member variableMeasured = "http://schema.org/variableMeasured"
5050

51+
static member mainEntity = "http://schema.org/mainEntity"
52+
53+
static member version = "http://schema.org/version"
54+
5155
static member tryGetIdentifierAsString(lp : LDNode, ?context : LDContext) =
5256
match lp.TryGetPropertyAsSingleton(LDDataset.identifier, ?context = context) with
5357
| Some (:? string as n) -> Some n
@@ -274,6 +278,20 @@ type LDDataset =
274278
static member setVariableMeasuredAsPropertyValues(lp : LDNode, variableMeasured : ResizeArray<LDNode>, ?context : LDContext) =
275279
lp.SetProperty(LDDataset.variableMeasured, variableMeasured, ?context = context)
276280

281+
static member getMainEntities(lp : LDNode, ?graph : LDGraph, ?context : LDContext) =
282+
lp.GetPropertyNodes(LDDataset.mainEntity, ?graph = graph, ?context = context)
283+
284+
static member setMainEntities(lp : LDNode, mainEntities : ResizeArray<LDNode>, ?context : LDContext) =
285+
lp.SetProperty(LDDataset.mainEntity, mainEntities, ?context = context)
286+
287+
static member tryGetVersionAsString(lp : LDNode, ?context : LDContext) =
288+
match lp.TryGetPropertyAsSingleton(LDDataset.version, ?context = context) with
289+
| Some (:? string as n) -> Some n
290+
| _ -> None
291+
292+
static member setVersionAsString(lp : LDNode, version : string, ?context : LDContext) =
293+
lp.SetProperty(LDDataset.version, version, ?context = context)
294+
277295
static member genIDInvesigation() =
278296
"./"
279297

@@ -282,6 +300,9 @@ type LDDataset =
282300

283301
static member genIDAssay(identifier : string) =
284302
$"assays/{identifier}/"
303+
304+
static member genIDARCWorkflow(identifier : string) =
305+
$"workflows/{identifier}/"
285306

286307
static member validate(lp : LDNode, ?context : LDContext) =
287308
lp.HasType(LDDataset.schemaType, ?context = context)
@@ -298,6 +319,11 @@ type LDDataset =
298319
LDDataset.validate(lp, ?context = context)
299320
&& lp.AdditionalType.Contains("Assay")
300321

322+
static member validateARCWorkflow (lp : LDNode, ?context : LDContext) =
323+
LDDataset.validate(lp, ?context = context)
324+
&& lp.AdditionalType.Contains("ARC Workflow")
325+
&& LDDataset.getMainEntities(lp, ?context = context).Exists(fun ld' -> LDWorkflowProtocol.validate(ld', ?context = context))
326+
301327
static member create(id : string, ?identier : string, ?creators : ResizeArray<LDNode>, ?dateCreated : System.DateTime, ?datePublished : System.DateTime, ?dateModified : System.DateTime, ?description : string, ?hasParts : ResizeArray<LDNode>, ?name : string, ?citations : ResizeArray<LDNode>, ?comments : ResizeArray<LDNode>, ?mentions : ResizeArray<LDNode>, ?url : string, ?abouts : ResizeArray<LDNode>, ?measurementMethod : LDNode, ?measurementTechnique : LDNode, ?variableMeasureds : ResizeArray<LDNode>, ?context : LDContext) =
302328
let s = LDNode(id, ResizeArray [LDDataset.schemaType], ?context = context)
303329
s.SetOptionalProperty(LDDataset.identifier, identier, ?context = context)
@@ -341,3 +367,13 @@ type LDDataset =
341367
let s = LDDataset.create(id, identier = identifier, ?name = name, ?description = description, ?creators = creators, ?hasParts = hasParts, ?measurementMethod = measurementMethod, ?measurementTechnique = measurementTechnique, ?variableMeasureds = variableMeasureds, ?abouts = abouts, ?comments = comments, ?context = context)
342368
s.AdditionalType <- ResizeArray ["Assay"]
343369
s
370+
371+
static member createARCWorkflow(identifier : string, mainEntities: ResizeArray<LDNode>, ?id : string, ?name : string, ?description : string, ?creators : ResizeArray<LDNode>, ?hasParts : ResizeArray<LDNode>, ?measurementMethod : LDNode, ?measurementTechnique : LDNode, ?variableMeasureds : ResizeArray<LDNode>, ?abouts : ResizeArray<LDNode>, ?comments : ResizeArray<LDNode>, ?context : LDContext, ?version : string) =
372+
let id = match id with
373+
| Some i -> i
374+
| None -> LDDataset.genIDARCWorkflow(identifier)
375+
let s = LDDataset.create(id, identier = identifier, ?name = name, ?description = description, ?creators = creators, ?hasParts = hasParts, ?measurementMethod = measurementMethod, ?measurementTechnique = measurementTechnique, ?variableMeasureds = variableMeasureds, ?abouts = abouts, ?comments = comments, ?context = context)
376+
s.AdditionalType <- ResizeArray ["ARC Workflow"]
377+
s.SetProperty(LDDataset.mainEntity, mainEntities, ?context = context)
378+
s.SetOptionalProperty(LDDataset.version, version, ?context = context)
379+
s

0 commit comments

Comments
 (0)