@@ -14,7 +14,6 @@ module OntologySourceReference =
14
14
Encode.tryInclude " name" Encode.string ( osr.Name)
15
15
Encode.tryInclude " version" Encode.string ( osr.Version)
16
16
Encode.tryIncludeSeq " comments" Comment.encoder ( osr.Comments)
17
- " @context" , ROCrateContext.OntologySourceReference.context_ jsonvalue
18
17
]
19
18
|> Encode.choose
20
19
|> Encode.object
@@ -55,7 +54,7 @@ module OntologySourceReference =
55
54
|> Encode.choose
56
55
|> Encode.object
57
56
58
- let decoder ( options : ConverterOptions ) : Decoder < OntologySourceReference > =
57
+ let decoder : Decoder < OntologySourceReference > =
59
58
Decode.object ( fun get ->
60
59
OntologySourceReference(
61
60
?description = get.Optional.Field " description" Decode.uri,
@@ -66,31 +65,36 @@ module OntologySourceReference =
66
65
)
67
66
)
68
67
69
- module OntologySourceReference =
70
-
71
-
72
- let fromJsonString ( s : string ) =
73
- Decode.fromJsonString decoder s
68
+ module ISAJson =
69
+ let encoder = encoder
70
+ let decoder = decoder
71
+
72
+ [<AutoOpen>]
73
+ module OntologySourceReferenceExtensions =
74
74
75
- let fromJsonldString ( s : string ) =
76
- Decode.fromJsonString ( decoder ( ConverterOptions( IsJsonLD= true ))) s
75
+ type OntologySourceReference with
76
+
77
+ static member fromJsonString ( s : string ) =
78
+ Decode.fromJsonString OntologySourceReference.decoder s
77
79
78
- let toJsonString ( oa : OntologySourceReference ) =
79
- encoder ( ConverterOptions()) oa
80
- |> Encode.toJsonString 2
80
+ static member toJsonString (? spaces ) =
81
+ fun ( obj : OntologySourceReference ) ->
82
+ OntologySourceReference.encoder obj
83
+ |> Encode.toJsonString ( Encode.defaultSpaces spaces)
81
84
82
- /// exports in json-ld format
83
- let toJsonldString ( oa : OntologySourceReference ) =
84
- encoder ( ConverterOptions( SetID= true , IsJsonLD= true )) oa
85
- |> Encode.toJsonString 2
85
+ static member fromROCrateJsonString ( s : string ) =
86
+ Decode.fromJsonString OntologySourceReference.ROCrate.decoder s
86
87
87
- let toJsonldStringWithContext ( a : OntologySourceReference ) =
88
- encoder ( ConverterOptions( SetID= true , IsJsonLD= true )) a
89
- |> Encode.toJsonString 2
88
+ /// exports in json-ld format
89
+ static member toROCrateJsonString (? spaces ) =
90
+ fun ( obj : OntologySourceReference ) ->
91
+ OntologySourceReference.ROCrate.encoder obj
92
+ |> Encode.toJsonString ( Encode.defaultSpaces spaces)
90
93
91
- // let fromFile (path : string) =
92
- // File.ReadAllText path
93
- // |> fromString
94
+ static member toISAJsonString (? spaces ) =
95
+ fun ( obj : OntologySourceReference ) ->
96
+ OntologySourceReference.ISAJson.encoder obj
97
+ |> Encode.toJsonString ( Encode.defaultSpaces spaces)
94
98
95
- //let toFile (path : string) (osr:OntologySourceReference ) =
96
- // File.WriteAllText(path,toString osr)
99
+ static member fromISAJsonString ( s : string ) =
100
+ Decode.fromJsonString OntologySourceReference.ISAJson.decoder s
0 commit comments