Skip to content

Commit 4e3e9e6

Browse files
committed
Finish 2.1.2
2 parents 60feb34 + 02a1691 commit 4e3e9e6

File tree

12 files changed

+248928
-44
lines changed

12 files changed

+248928
-44
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.1.1
1+
2.1.2

bin/jsonld

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def run(input, options)
2121
reader_class.new(input, options[:parser_options])
2222
end
2323

24-
prefixes = {}
2524
start = Time.new
2625
if options[:expand]
2726
options = options.merge(expandContext: options.delete(:context)) if options.has_key?(:context)
@@ -87,17 +86,27 @@ input = nil
8786
OPT_ARGS = [
8887
["--dbg", GetoptLong::NO_ARGUMENT, "Turn on verbose debugging"],
8988
["--compact", GetoptLong::NO_ARGUMENT, "Compact document, using --context"],
89+
["--compactArrays", GetoptLong::OPTIONAL_ARGUMENT, "Set compactArrays option"],
9090
["--context", GetoptLong::REQUIRED_ARGUMENT,"Context to apply for expand, compact and converting from RDF"],
91+
["--embed", GetoptLong::REQUIRED_ARGUMENT,"a flag specifying that objects should be directly embedded in the output, instead of being referred to by their IRI"],
9192
["--evaluate","-e", GetoptLong::REQUIRED_ARGUMENT,"Evaluate argument as a JSON-LD document"],
9293
["--expand", GetoptLong::NO_ARGUMENT, "Expand document, using an optional --context"],
94+
["--expanded", GetoptLong::OPTIONAL_ARGUMENT, "Input is already expanded"],
95+
["--explicit", GetoptLong::OPTIONAL_ARGUMENT, "a flag specifying that for properties to be included in the output, they must be explicitly declared in the framing context"],
9396
["--flatten", GetoptLong::NO_ARGUMENT, "Flatten document, using an optional --context"],
9497
["--format", GetoptLong::REQUIRED_ARGUMENT,"Specify output format when converting to RDF"],
9598
["--frame", GetoptLong::REQUIRED_ARGUMENT,"Frame document, using the file or URL as a frame specification"],
9699
["--input-format", GetoptLong::REQUIRED_ARGUMENT,"Format of the input document, when converting from RDF."],
100+
["--omitDefault", GetoptLong::OPTIONAL_ARGUMENT,"a flag specifying that properties that are missing from the JSON-LD input should be omitted from the output"],
97101
["--output", "-o", GetoptLong::REQUIRED_ARGUMENT,"Output to the specified file path"],
98102
["--parse-only", GetoptLong::NO_ARGUMENT, "Parse the document for well-formedness only"],
103+
["--processingMode",GetoptLong::REQUIRED_ARGUMENT,"Set processing mode, defaults to json-ld-1.1"],
99104
["--quiet", GetoptLong::NO_ARGUMENT, "Supress most output other than progress indicators"],
105+
["--rename_bnodes", GetoptLong::OPTIONAL_ARGUMENT,"Rename bnodes as part of expansion, or keep them the same"],
106+
["--requireAll", GetoptLong::OPTIONAL_ARGUMENT,"Rename bnodes as part of expansion, or keep them the same"],
107+
["--simple_compact_iris",GetoptLong::OPTIONAL_ARGUMENT,"When compacting IRIs, do not use terms with expanded term definitions"],
100108
["--stream", GetoptLong::NO_ARGUMENT, "Use Streaming reader/writer"],
109+
["--unique_bnodes", GetoptLong::OPTIONAL_ARGUMENT,"Use unique bnode identifiers"],
101110
["--uri", GetoptLong::REQUIRED_ARGUMENT,"URI to be used as the document base"],
102111
["--validate", GetoptLong::NO_ARGUMENT, "Validate while processing"],
103112
["--help", "-?", GetoptLong::NO_ARGUMENT, "This message"]
@@ -121,22 +130,42 @@ opts = GetoptLong.new(*OPT_ARGS.map {|o| o[0..-2]})
121130

122131
opts.each do |opt, arg|
123132
case opt
124-
when '--dbg' then parser_options[:debug] = ::JSON::LD::debug = true
125-
when '--compact' then options[:compact] = true
126-
when '--context' then options[:context] = arg
127-
when '--evaluate' then input = arg
128-
when '--expand' then options[:expand] = true
129-
when '--format' then options[:output_format] = arg.to_sym
130-
when '--flatten' then options[:flatten] = arg
131-
when '--frame' then options[:frame] = arg
132-
when '--input-format' then options[:input_format] = arg.to_sym
133-
when '--output' then options[:output] = File.open(arg, "w")
134-
when '--parse-only' then options[:parse_only] = true
135-
when '--quiet' then options[:quiet] = true
136-
when '--stream' then parser_options[:stream] = true
137-
when '--uri' then parser_options[:base] = arg
138-
when '--validate' then parser_options[:validate] = true
139-
when '--help' then usage
133+
when '--dbg' then parser_options[:debug] = ::JSON::LD::debug = true
134+
when '--compact' then options[:compact] = true
135+
when "--compactArrays" then options[:compactArrays] = (arg || 'true') == 'true'
136+
when '--context' then options[:context] = arg
137+
when '--evaluate' then input = arg
138+
when '--expand' then options[:expand] = true
139+
when "--expanded" then options[:expanded] = (arg || 'true') == 'true'
140+
when "--explicit" then options[:compactArrays] = (arg || 'true') == 'true'
141+
when '--format' then options[:output_format] = arg.to_sym
142+
when '--flatten' then options[:flatten] = arg
143+
when '--frame' then options[:frame] = arg
144+
when '--input-format' then options[:input_format] = arg.to_sym
145+
when "--omitDefault" then options[:omitDefault] = (arg || 'true') == 'true'
146+
when '--output' then options[:output] = File.open(arg, "w")
147+
when '--parse-only' then options[:parse_only] = true
148+
when '--processingMode' then options[:processingMode] = arg
149+
when '--quiet' then options[:quiet] = true
150+
when "--rename_bnodes" then options[:rename_bnodes] = (arg || 'true') == 'true'
151+
when "--requireAll" then options[:requireAll] = (arg || 'true') == 'true'
152+
when '--stream' then parser_options[:stream] = true
153+
when "--unique_bnodes" then options[:unique_bnodes] = (arg || 'true') == 'true'
154+
when '--uri' then parser_options[:base] = arg
155+
when '--validate' then parser_options[:validate] = true
156+
when '--help' then usage
157+
when '--embed'
158+
case arg
159+
when '@always', '@never', '@link', '@last'
160+
options[:embed] = arg
161+
when 'true'
162+
options[:embed] = true
163+
when 'false'
164+
options[:embed] = false
165+
else
166+
STDERR.puts "--embed option takes one of '@always', '@never', '@link', '@last', true, or false"
167+
exit(1)
168+
end
140169
end
141170
end
142171

example-files/earl-frame.jsonld

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
{
2+
"@context": {
3+
"@vocab": "http://www.w3.org/ns/earl#",
4+
"foaf:homepage": {
5+
"@type": "@id"
6+
},
7+
"dc": "http://purl.org/dc/terms/",
8+
"doap": "http://usefulinc.com/ns/doap#",
9+
"earl": "http://www.w3.org/ns/earl#",
10+
"mf": "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#",
11+
"foaf": "http://xmlns.com/foaf/0.1/",
12+
"rdfs": "http://www.w3.org/2000/01/rdf-schema#",
13+
"assertedBy": {
14+
"@type": "@id"
15+
},
16+
"assertions": {
17+
"@type": "@id",
18+
"@container": "@set"
19+
},
20+
"bibRef": {
21+
"@id": "dc:bibliographicCitation"
22+
},
23+
"created": {
24+
"@id": "doap:created",
25+
"@type": "xsd:date"
26+
},
27+
"description": {
28+
"@id": "rdfs:comment",
29+
"@language": "en"
30+
},
31+
"developer": {
32+
"@id": "doap:developer",
33+
"@type": "@id",
34+
"@container": "@set"
35+
},
36+
"doapDesc": {
37+
"@id": "doap:description",
38+
"@language": "en"
39+
},
40+
"generatedBy": {
41+
"@type": "@id"
42+
},
43+
"homepage": {
44+
"@id": "doap:homepage",
45+
"@type": "@id"
46+
},
47+
"language": {
48+
"@id": "doap:programming-language"
49+
},
50+
"license": {
51+
"@id": "doap:license",
52+
"@type": "@id"
53+
},
54+
"mode": {
55+
"@type": "@id"
56+
},
57+
"name": {
58+
"@id": "doap:name"
59+
},
60+
"outcome": {
61+
"@type": "@id"
62+
},
63+
"release": {
64+
"@id": "doap:release",
65+
"@type": "@id"
66+
},
67+
"revision": {
68+
"@id": "doap:revision"
69+
},
70+
"shortdesc": {
71+
"@id": "doap:shortdesc",
72+
"@language": "en"
73+
},
74+
"subject": {
75+
"@type": "@id"
76+
},
77+
"test": {
78+
"@type": "@id"
79+
},
80+
"testAction": {
81+
"@id": "mf:action",
82+
"@type": "@id"
83+
},
84+
"testResult": {
85+
"@id": "mf:result",
86+
"@type": "@id"
87+
},
88+
"title": {
89+
"@id": "mf:name"
90+
},
91+
"entries": {
92+
"@id": "mf:entries",
93+
"@type": "@id",
94+
"@container": "@list"
95+
},
96+
"testSubjects": {
97+
"@type": "@id",
98+
"@container": "@set"
99+
},
100+
"xsd": {
101+
"@id": "http://www.w3.org/2001/XMLSchema#"
102+
}
103+
},
104+
"@requireAll": true,
105+
"@embed": "@always",
106+
"assertions": {
107+
},
108+
"bibRef": {
109+
},
110+
"generatedBy": {
111+
"@embed": "@always",
112+
"developer": {
113+
"@embed": "@always"
114+
},
115+
"release": {
116+
"@embed": "@always"
117+
}
118+
},
119+
"testSubjects": {
120+
"@embed": "@always",
121+
"@type": "earl:TestSubject",
122+
"developer": {
123+
"@embed": "@always"
124+
},
125+
"homepage": {
126+
"@embed": "@never"
127+
}
128+
},
129+
"entries": [
130+
{
131+
"@embed": "@always",
132+
"@type": "mf:Manifest",
133+
"entries": [
134+
{
135+
"@embed": "@always",
136+
"@type": "earl:TestCase",
137+
"assertions": {
138+
"@embed": "@always",
139+
"@type": "earl:Assertion",
140+
"assertedBy": {
141+
"@embed": "@never"
142+
},
143+
"result": {
144+
"@embed": "@always",
145+
"@type": "earl:TestResult"
146+
},
147+
"subject": {
148+
"@embed": "@never"
149+
}
150+
}
151+
}
152+
]
153+
}
154+
]
155+
}

0 commit comments

Comments
 (0)