Skip to content

Commit 0f71200

Browse files
committed
Add --rdfstar option to script/parse.
1 parent eb57e42 commit 0f71200

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

example-files/bob-star.jsonld

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"@context": {
3+
"@base": "http://example.org/",
4+
"ex": "http://example.org/",
5+
"foaf": "http://xmlns.com/foaf/0.1/"
6+
},
7+
"@id": {
8+
"@id": "bob",
9+
"foaf:age": 23
10+
},
11+
"ex:certainty": 0.8
12+
}

script/parse

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ OPT_ARGS = [
116116
["--output", "-o", GetoptLong::REQUIRED_ARGUMENT, "Where to store output (default STDOUT)"],
117117
["--profile", GetoptLong::NO_ARGUMENT, "Run profiler with output to doc/profiles/"],
118118
["--quiet", GetoptLong::NO_ARGUMENT, "Reduce output"],
119+
["--rdfstar", GetoptLong::REQUIRED_ARGUMENT, "RDF* mode, SA or PG"],
119120
["--stream", GetoptLong::NO_ARGUMENT, "Streaming reader/writer"],
120121
["--uri", GetoptLong::REQUIRED_ARGUMENT, "Run with argument value as base"],
121122
["--validate", GetoptLong::NO_ARGUMENT, "Validate input"],
@@ -156,6 +157,9 @@ opts.each do |opt, arg|
156157
when '--quiet'
157158
options[:quiet] = true
158159
logger.level = Logger::FATAL
160+
when '--rdfstar'
161+
parser_options[:rdfstar] = arg.to_sym
162+
usage unless [:PG, :SA].include?(parser_options[:rdfstar])
159163
when '--stream' then parser_options[:stream] = true
160164
when '--uri' then parser_options[:base] = arg
161165
when '--validate' then parser_options[:validate] = true

0 commit comments

Comments
 (0)