Skip to content

Commit 906f1d4

Browse files
authored
Merge pull request #3 from sanuann/convertors
fix and refactor audio, video and image properties
2 parents fa96e4c + aefa412 commit 906f1d4

File tree

5 files changed

+89
-22
lines changed

5 files changed

+89
-22
lines changed

reproschema/tests/contexts/generic

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,24 @@
1515
"@id": "reproschema:value"
1616
},
1717
"image": {
18+
"@id": "schema:image"
19+
},
20+
"imageUrl": {
1821
"@id": "schema:image",
19-
"@type": "@id"
22+
"@type": "xsd:anyURI"
2023
},
21-
"associatedMedia": {
22-
"@id": "schema:associatedMedia",
23-
"@type": "@id",
24-
"@container": "@set"
24+
"audio": {
25+
"@id": "schema:audio"
26+
},
27+
"video": {
28+
"@id": "schema:video"
29+
},
30+
"contentUrl": {
31+
"@id": "schema:contentUrl",
32+
"@type": "xsd:anyURI"
2533
},
34+
"VideoObject": "schema:VideoObject",
35+
"AudioObject": "schema:AudioObject",
2636
"inLanguage": {
2737
"@id": "schema:inLanguage"
2838
},

reproschema/tests/data/activities/activity1.jsonld

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
"schemaVersion": "1.0.0-rc2",
88
"version": "0.0.1",
99
"citation": "https://www.ncbi.nlm.nih.gov/pmc/articles/PMC1495268/",
10+
"image": {
11+
"@type": "AudioObject",
12+
"contentUrl": "http://example.com/sample-image.png"
13+
},
1014
"preamble": {
1115
"en": "Over the last 2 weeks, how often have you been bothered by any of the following problems?",
1216
"es": "Durante las últimas 2 semanas, ¿con qué frecuencia le han molestado los siguintes problemas?"

reproschema/tests/data/activities/items/item1.jsonld

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44
"@id": "item1.jsonld",
55
"prefLabel": "item1",
66
"description": "Q1 of example 1",
7-
"schemaVersion": "1.0.0-rc2",
7+
"schemaVersion": "1.0.0-rc1.post",
88
"version": "0.0.1",
9+
"audio": {
10+
"@type": "AudioObject",
11+
"contentUrl": "http://media.freesound.org/sample-file.mp4"
12+
},
13+
"image": {
14+
"@type": "ImageObject",
15+
"contentUrl": "http://example.com/sample-image.jpg"
16+
},
917
"question": {
1018
"en": "Little interest or pleasure in doing things",
1119
"es": "Poco interés o placer en hacer cosas"
@@ -31,21 +39,21 @@
3139
"en": "Several days",
3240
"es": "Varios días"
3341
},
34-
"value": 1
42+
"value": "a"
3543
},
3644
{
3745
"name": {
3846
"en": "More than half the days",
3947
"es": "Más de la mitad de los días"
4048
},
41-
"value": 2
49+
"value": {"@id": "http://example.com/choice3" }
4250
},
4351
{
4452
"name": {
4553
"en": "Nearly everyday",
4654
"es": "Casi todos los días"
4755
},
48-
"value": 3
56+
"value": {"@value": "choice-with-lang", "@language": "en"}
4957
}
5058
]
5159
},
@@ -54,7 +62,12 @@
5462
"source": "redcap",
5563
"column": "notes",
5664
"value": "some extra note"
65+
},
66+
{
67+
"source": "redcap",
68+
"column": "notes",
69+
"value": {"@id": "http://example.com/iri-example"}
5770
}
5871
]
5972

60-
}
73+
}

reproschema/tests/data/activities/items/item2.jsonld

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,32 @@
1010
"en": "Current temperature.",
1111
"es": "Fiebre actual."
1212
},
13+
"video": {
14+
"@type": "VideoObject",
15+
"contentUrl": "http://media.freesound.org/data/0/previews/719__elmomo__12oclock_girona_preview.mp4"
16+
},
17+
"imageUrl": "http://example.com/sample-image.jpg",
1318
"ui": {
1419
"inputType": "float"
1520
},
1621
"responseOptions": {
17-
"valueType": "xsd:float"
22+
"valueType": "xsd:float",
23+
"unitOptions": [
24+
{
25+
"prefLabel": {
26+
"en": "Fahrenheit",
27+
"es": "Fahrenheit"
28+
},
29+
"value": "°F"
30+
},
31+
{
32+
"prefLabel": {
33+
"en": "Celsius",
34+
"es": "Celsius"
35+
},
36+
"value": "°C"
37+
}
38+
]
1839
}
1940
}
2041

reproschema/tests/reproschema-shacl.ttl

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,14 @@ reproschema:ActivityShape a sh:NodeShape ;
2424
[ sh:datatype rdf:langString ;
2525
sh:path schema:citation ],
2626

27-
[ sh:nodeKind sh:IRI ;
27+
[ sh:or ( [ sh:datatype xsd:anyURI ; sh:pattern "((http|https)://)(www.)?[a-zA-Z0-9@:%._\\+~#?&//=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%._\\+~#?&//=]*)" ] [sh:node reproschema:MediaObjectShape] ) ;
2828
sh:path schema:image ],
2929

30-
[ sh:nodeKind sh:IRI ;
31-
sh:path schema:associatedMedia ],
30+
[ sh:node reproschema:MediaObjectShape ;
31+
sh:path schema:audio ],
32+
33+
[ sh:node reproschema:MediaObjectShape ;
34+
sh:path schema:video ],
3235

3336
[ sh:nodeKind sh:IRI ;
3437
sh:path schema:about ],
@@ -98,12 +101,14 @@ reproschema:FieldShape a sh:NodeShape ;
98101
[ sh:datatype rdf:langString ;
99102
sh:path reproschema:preamble ],
100103

101-
[ sh:nodeKind sh:IRI ;
102-
sh:maxCount 1 ;
104+
[ sh:or ( [ sh:datatype xsd:anyURI ; sh:pattern "((http|https)://)(www.)?[a-zA-Z0-9@:%._\\+~#?&//=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%._\\+~#?&//=]*)" ] [sh:node reproschema:MediaObjectShape] ) ;
103105
sh:path schema:image ],
104106

105-
[ sh:nodeKind sh:IRI ;
106-
sh:path schema:associatedMedia ],
107+
[ sh:node reproschema:MediaObjectShape ;
108+
sh:path schema:audio ],
109+
110+
[ sh:node reproschema:MediaObjectShape ;
111+
sh:path schema:video ],
107112

108113
[ sh:datatype xsd:string ;
109114
sh:maxCount 1 ;
@@ -144,8 +149,14 @@ reproschema:ProtocolShape a sh:NodeShape ;
144149
sh:maxCount 1 ;
145150
sh:path schema:about ],
146151

147-
[ sh:nodeKind sh:IRI ;
148-
sh:path schema:associatedMedia ],
152+
[ sh:or ( [ sh:datatype xsd:anyURI ; sh:pattern "((http|https)://)(www.)?[a-zA-Z0-9@:%._\\+~#?&//=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%._\\+~#?&//=]*)" ] [sh:node reproschema:MediaObjectShape] ) ;
153+
sh:path schema:image ],
154+
155+
[ sh:node reproschema:MediaObjectShape ;
156+
sh:path schema:audio ],
157+
158+
[ sh:node reproschema:MediaObjectShape ;
159+
sh:path schema:video ],
149160

150161
[ sh:nodeKind sh:IRI ;
151162
sh:path reproschema:landingPage ],
@@ -315,7 +326,7 @@ reproschema:OverridePropertiesShape a sh:NodeShape ;
315326
reproschema:ChoicesShape a sh:NodeShape ;
316327
sh:closed true ;
317328
sh:ignoredProperties ( rdf:type ) ;
318-
sh:property [ sh:nodeKind sh:IRI ;
329+
sh:property [ sh:or ( [ sh:datatype xsd:anyURI ; sh:pattern "((http|https)://)(www.)?[a-zA-Z0-9@:%._\\+~#?&//=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%._\\+~#?&//=]*)" ] [sh:node reproschema:MediaObjectShape] ) ;
319330
sh:path schema:image ],
320331

321332
[ sh:datatype rdf:langString ;
@@ -331,7 +342,7 @@ reproschema:UnitOptionsShape a sh:NodeShape ;
331342
sh:property [ sh:datatype rdf:langString ;
332343
sh:path skos:prefLabel ],
333344

334-
[ sh:or ( [ sh:datatype xsd:integer ] [ sh:nodeKind sh:IRI ] [ sh:datatype schema:Boolean ] [ sh:datatype schema:StructuredValue ] [ sh:datatype rdf:langString ]) ;
345+
[ sh:or ( [ sh:nodeKind sh:IRI ] [ sh:datatype rdf:langString ]) ;
335346
sh:path reproschema:value ] ;
336347
sh:targetClass reproschema:UnitOption .
337348

@@ -439,3 +450,11 @@ prov:SoftwareAgentShape a sh:NodeShape ;
439450
[ sh:nodeKind sh:IRI ;
440451
sh:path schema:url ] ;
441452
sh:targetClass reproschema:SoftwareAgent .
453+
454+
reproschema:MediaObjectShape a sh:NodeShape ;
455+
sh:closed true;
456+
sh:ignoredProperties ( rdf:type ) ;
457+
sh:property [ sh:datatype xsd:anyURI ;
458+
sh:minCount 1 ;
459+
sh:pattern "((http|https)://)(www.)?[a-zA-Z0-9@:%._\\+~#?&//=]{2,256}\\.[a-z]{2,6}\\b([-a-zA-Z0-9@:%._\\+~#?&//=]*)" ;
460+
sh:path schema:contentUrl ] .

0 commit comments

Comments
 (0)