Skip to content

Commit 750922d

Browse files
author
Peter Amstutz
committed
Can use refScope and mapSubject/mapPredicate on specialize.
1 parent 9773208 commit 750922d

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

schema_salad/metaschema/metaschema.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,13 +140,15 @@ $graph:
140140
jsonldPredicate:
141141
_id: "sld:specializeFrom"
142142
_type: "@id"
143+
refScope: 1
143144

144145
- name: specializeTo
145146
type: string
146147
doc: "The new data type to replace with"
147148
jsonldPredicate:
148149
_id: "sld:specializeTo"
149150
_type: "@id"
151+
refScope: 1
150152

151153

152154
- name: NamedType
@@ -242,8 +244,7 @@ $graph:
242244
extends: [NamedType, RecordSchema, SchemaDefinedType]
243245
documentRoot: true
244246
specialize:
245-
specializeFrom: "#RecordField"
246-
specializeTo: "#SaladRecordField"
247+
RecordField: SaladRecordField
247248
fields:
248249
- name: abstract
249250
type: boolean?
@@ -271,7 +272,10 @@ $graph:
271272
base record as a template. For each field inherited from the base
272273
record, replace any instance of the type `specializeFrom` with
273274
`specializeTo`.
274-
275+
jsonldPredicate:
276+
_id: "sld:specialize"
277+
mapSubject: specializeFrom
278+
mapPredicate: specializeTo
275279

276280
- name: SaladEnumSchema
277281
type: record

schema_salad/schema.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,9 @@ def get_metaschema():
9898
"refScope": 1
9999
},
100100
"fields": {
101-
"@id": "sld:fields",
102-
"mapSubject": "name",
103-
"mapPredicate": "type"
101+
"@id": "https://w3id.org/cwl/salad#fields",
102+
"mapPredicate": "type",
103+
"mapSubject": "name"
104104
},
105105
"float": "http://www.w3.org/2001/XMLSchema#float",
106106
"identity": "https://w3id.org/cwl/salad#JsonldPredicate/identity",
@@ -122,14 +122,20 @@ def get_metaschema():
122122
"record": "https://w3id.org/cwl/salad#record",
123123
"refScope": "https://w3id.org/cwl/salad#JsonldPredicate/refScope",
124124
"sld": "https://w3id.org/cwl/salad#",
125-
"specialize": "https://w3id.org/cwl/salad#SaladRecordSchema/specialize",
125+
"specialize": {
126+
"@id": "https://w3id.org/cwl/salad#specialize",
127+
"mapPredicate": "specializeTo",
128+
"mapSubject": "specializeFrom"
129+
},
126130
"specializeFrom": {
127131
"@id": "https://w3id.org/cwl/salad#specializeFrom",
128-
"@type": "@id"
132+
"@type": "@id",
133+
"refScope": 1
129134
},
130135
"specializeTo": {
131136
"@id": "https://w3id.org/cwl/salad#specializeTo",
132-
"@type": "@id"
137+
"@type": "@id",
138+
"refScope": 1
133139
},
134140
"string": "http://www.w3.org/2001/XMLSchema#string",
135141
"symbols": {

0 commit comments

Comments
 (0)