-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathArcCore.fs
More file actions
126 lines (98 loc) · 2.9 KB
/
Copy pathArcCore.fs
File metadata and controls
126 lines (98 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
namespace Arc.Build
open System
[<Struct>]
type Iri =
private
| Iri of string
member this.Value =
let (Iri value) = this
value
override this.ToString() =
this.Value
static member Create(value: string) =
if String.IsNullOrWhiteSpace value then
invalidArg (nameof value) "IRI must not be empty."
Iri value
static member op_Explicit(value: string) =
Iri.Create value
static member op_Implicit(iri: Iri) =
iri.Value
[<Struct>]
type ArcId =
private
| ArcId of string
member this.Value =
let (ArcId value) = this
value
override this.ToString() = this.Value
static member Create(value: string) =
if String.IsNullOrWhiteSpace value then
invalidArg (nameof value) "ARC id must not be empty."
ArcId value
/// The closed structural classification of an ArcObject. The finer-grained semantics ride on
/// `DTypes` (see [Vocabulary]); this is the coarse category. INSDC concept → kind mapping lives in the
/// mapping docs.
type ArcObjectKind =
| Observable // an entity/material an activity observes or consumes
| Instrument // a device/instrument an activity is carried out with
| Resource // data or an addressable resource (a file, a URL)
| Activity // a process/activity
| Agent // a person, institution, or software agent
| Role // the role an agent plays in an activity
| Recipe // a plan/protocol
| Collection // a grouping dataset or generic object container
| Selector // an addressing/provenance selector (e.g. an XPath into a source record)
type ArcValue =
| String of string
| Integer of int64
| Float of float
| Boolean of bool
| DateTime of DateTimeOffset
| Iri of Iri
| Ref of ArcId
| List of ArcValue list
type OntologyTerm =
{
Id: Iri
Name: string option
Source: string option
}
type AnnotationValue =
| Literal of ArcValue
| Term of OntologyTerm
| LiteralWithUnit of value: ArcValue * unit: OntologyTerm
| TermWithUnit of value: OntologyTerm * unit: OntologyTerm
type ArcAnnotation =
{
Property: OntologyTerm
Value: AnnotationValue
Evidence: ArcId option
Source: ArcId option
}
type ArcObject =
{
Id: ArcId
Kind: ArcObjectKind
DTypes: Set<Iri>
Properties: Map<Iri, ArcValue>
Annotations: ArcAnnotation list
}
type ArcRelation =
{
Id: ArcId option
Subject: ArcId
Predicate: Iri
Object: ArcId
Properties: Map<Iri, ArcValue>
Annotations: ArcAnnotation list
}
type ArcIR =
{
Objects: Map<ArcId, ArcObject>
Relations: Set<ArcRelation>
}
static member Empty =
{
Objects = Map.empty
Relations = Set.empty
}