Update vocabulary for parameters for doing remote-doc testing, and add to remote-doc-manifest.ttl
authorGregg Kellogg <gregg@kellogg-assoc.com>
Sat, 07 Sep 2013 18:28:20 -0700
changeset 1985 42299bc01c80
parent 1984 5393a779d3ab
child 1986 838a8ed5afb7
Update vocabulary for parameters for doing remote-doc testing, and add to remote-doc-manifest.ttl
test-suite/context.jsonld
test-suite/tests/remote-doc-manifest.jsonld
test-suite/vocab.html
test-suite/vocab.jsonld
test-suite/vocab.ttl
test-suite/vocab_gen.rb
--- a/test-suite/context.jsonld	Fri Sep 06 11:17:32 2013 +0200
+++ b/test-suite/context.jsonld	Sat Sep 07 18:28:20 2013 -0700
@@ -7,12 +7,13 @@
     "rdfs":     "http://www.w3.org/2000/01/rdf-schema#",
     "xsd":      "http://www.w3.org/2001/XMLSchema#",
 
-    "context":  { "@id": "input", "@type": "@id" },
-    "expect":   { "@id": "mf:result", "@type": "@id" },
-    "frame":    { "@id": "input", "@type": "@id" },
-    "input":    { "@id": "mf:action", "@type": "@id" },
-    "option":   { "@type": "@id"},
-    "sequence": { "@id": "mf:entries", "@type": "@id", "@container": "@list" },
+    "context":    { "@id": "input", "@type": "@id" },
+    "expect":     { "@id": "mf:result", "@type": "@id" },
+    "frame":      { "@id": "input", "@type": "@id" },
+    "input":      { "@id": "mf:action", "@type": "@id" },
+    "option":     { "@type": "@id"},
+    "sequence":   { "@id": "mf:entries", "@type": "@id", "@container": "@list" },
+    "redirectTo": { "@type": "@id"},
 
     "name":                 "mf:name",
     "purpose":              "rdfs:comment",
@@ -23,6 +24,8 @@
     "expandContext":        { "@type": "xsd:string" },
     "processingMode":       { "@type": "xsd:string" },
     "produceGeneralizedRdf":{ "@type": "xsd:boolean" },
-    "useNativeTypes":       { "@type": "xsd:boolean" }
+    "useNativeTypes":       { "@type": "xsd:boolean" },
+    "httpStatus":           { "@type": "xsd:integer"},
+    "httpLink":             { "@container": "@set"}
   }
 }
--- a/test-suite/tests/remote-doc-manifest.jsonld	Fri Sep 06 11:17:32 2013 +0200
+++ b/test-suite/tests/remote-doc-manifest.jsonld	Sat Sep 07 18:28:20 2013 -0700
@@ -25,6 +25,9 @@
       "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
       "name": "load JSON document with extension-type",
       "purpose": "Document loader loads a JSON document having an extension mime-subtype.",
+      "option": {
+        "contentType": "application/jldTest+json"
+      },
       "input": "remote-doc-0003-in.jldt",
       "expect": "remote-doc-0003-out.jsonld"
     }, {
@@ -32,6 +35,9 @@
       "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
       "name": "loading an unknown type raises loading document failed",
       "purpose": "Loading a document with a non-JSON mime type raises loading document failed",
+      "option": {
+        "contentType": "application/jldTest"
+      },
       "input": "remote-doc-0004-in.jldte",
       "expect": "loading document failed"
     }, {
@@ -39,6 +45,10 @@
       "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
       "name": "Load JSON-LD through 301 redirect",
       "purpose": "Loading a document with a redirect should use the redirected URL as document base",
+      "option": {
+        "redirectTo": "remote-doc-0001-in.jsonld",
+        "httpStatus": 301
+      },
       "input": "remote-doc-0005-in.jsonld",
       "expect": "remote-doc-0001-out.jsonld"
     }, {
@@ -46,6 +56,10 @@
       "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
       "name": "Load JSON-LD through 303 redirect",
       "purpose": "Loading a document with a redirect should use the redirected URL as document base",
+      "option": {
+        "redirectTo": "remote-doc-0001-in.jsonld",
+        "httpStatus": 303
+      },
       "input": "remote-doc-0006-in.jsonld",
       "expect": "remote-doc-0001-out.jsonld"
     }, {
@@ -53,6 +67,10 @@
       "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
       "name": "Load JSON-LD through 307 redirect",
       "purpose": "Loading a document with a redirect should use the redirected URL as document base",
+      "option": {
+        "redirectTo": "remote-doc-0001-in.jsonld",
+        "httpStatus": 307
+      },
       "input": "remote-doc-0007-in.jsonld",
       "expect": "remote-doc-0001-out.jsonld"
     }, {
@@ -67,6 +85,9 @@
       "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
       "name": "load JSON-LD document with link",
       "purpose": "If a context is specified in a link header, it is not used for JSON-LD.",
+      "option": {
+        "httpLink": "<remote-doc-0009-context.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\""
+      },
       "input": "remote-doc-0009-in.jsonld",
       "expect": "remote-doc-0009-out.jsonld"
     }, {
@@ -74,6 +95,9 @@
       "@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
       "name": "load JSON document with link",
       "purpose": "If a context is specified in a link header, it is used for JSON.",
+      "option": {
+        "httpLink": "<remote-doc-0010-context.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\""
+      },
       "input": "remote-doc-0010-in.json",
       "expect": "remote-doc-0010-out.jsonld"
     }, {
@@ -82,12 +106,22 @@
       "name": "load JSON document with extension-type with link",
       "purpose": "IfIf a context is specified in a link header, it is used for a JSON extension type.",
       "input": "remote-doc-0011-in.jldt",
+      "option": {
+        "contentType": "application/jldTest+json",
+        "httpLink": "<remote-doc-0011-context.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\""
+      },
       "expect": "remote-doc-0011-out.jsonld"
     }, {
       "@id": "#t0012",
       "@type": ["jld:NegativeEvaluationTest", "jld:ExpandTest"],
       "name": "Multiple context link headers",
       "purpose": "Loading a file when multiple link headers are returned is an error",
+      "option": {
+        "httpLink": [
+          "<remote-doc-0012-context1.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\"",
+          "<remote-doc-0012-context2.jsonld>; rel=\"http://www.w3.org/ns/json-ld#context\""
+        ]
+      },
       "input": "remote-doc-0012-in.json",
       "expect": "multiple context link headers"
     }
--- a/test-suite/vocab.html	Fri Sep 06 11:17:32 2013 +0200
+++ b/test-suite/vocab.html	Sat Sep 07 18:28:20 2013 -0700
@@ -166,6 +166,38 @@
       <div class='row'>
         <section class='offset2 span8'>
           <dl>
+            <dt about='jld:httpLink' property='rdfs:label' typeof='rdfs:Property'>HTTP link</dt>
+            <dd about='jld:httpLink'>
+              <span property='rdfs:comment'><p>An HTTP Link header to be added to the result of requesting the input file.</p></span>
+              <div>
+                <strong>
+                  domain:
+                </strong>
+                <code property='rdfs:domain' resource='jld:Test'>jld:Test</code>
+              </div>
+              <div>
+                <strong>
+                  range:
+                </strong>
+                <code property='rdfs:range' resource='xsd:boolean'>xsd:boolean</code>
+              </div>
+            </dd>
+            <dt about='jld:httpStatus' property='rdfs:label' typeof='rdfs:Property'>HTTP status</dt>
+            <dd about='jld:httpStatus'>
+              <span property='rdfs:comment'><p>The HTTP status code that must be returned when the input file is requested. This is typically used along with the <code>redirectTo</code> property.</p></span>
+              <div>
+                <strong>
+                  domain:
+                </strong>
+                <code property='rdfs:domain' resource='jld:Test'>jld:Test</code>
+              </div>
+              <div>
+                <strong>
+                  range:
+                </strong>
+                <code property='rdfs:range' resource='xsd:boolean'>xsd:boolean</code>
+              </div>
+            </dd>
             <dt about='jld:base' property='rdfs:label' typeof='rdfs:Property'>base</dt>
             <dd about='jld:base'>
               <span property='rdfs:comment'><p>The base IRI to use when expanding or compacting the document. If set, this overrides the input document&#39;s IRI.</p></span>
@@ -198,6 +230,22 @@
                 <code property='rdfs:range' resource='xsd:boolean'>xsd:boolean</code>
               </div>
             </dd>
+            <dt about='jld:contentType' property='rdfs:label' typeof='rdfs:Property'>content type</dt>
+            <dd about='jld:contentType'>
+              <span property='rdfs:comment'><p>The HTTP Content-Type used for the input file, in case it is a non-registered type.</p></span>
+              <div>
+                <strong>
+                  domain:
+                </strong>
+                <code property='rdfs:domain' resource='jld:Test'>jld:Test</code>
+              </div>
+              <div>
+                <strong>
+                  range:
+                </strong>
+                <code property='rdfs:range' resource='xsd:boolean'>xsd:boolean</code>
+              </div>
+            </dd>
             <dt about='jld:expandContext' property='rdfs:label' typeof='rdfs:Property'>expand context</dt>
             <dd about='jld:expandContext'>
               <span property='rdfs:comment'><p>A context that is used to initialize the active context when expanding a document.</p></span>
@@ -278,6 +326,22 @@
                 <code property='rdfs:range' resource='xsd:boolean'>xsd:boolean</code>
               </div>
             </dd>
+            <dt about='jld:redirectTo' property='rdfs:label' typeof='rdfs:Property'>redirect to</dt>
+            <dd about='jld:redirectTo'>
+              <span property='rdfs:comment'><p>The location of a URL for redirection. A request made of the input file must be redirected to the designated URL.</p></span>
+              <div>
+                <strong>
+                  domain:
+                </strong>
+                <code property='rdfs:domain' resource='jld:Test'>jld:Test</code>
+              </div>
+              <div>
+                <strong>
+                  range:
+                </strong>
+                <code property='rdfs:range' resource='xsd:boolean'>xsd:boolean</code>
+              </div>
+            </dd>
             <dt about='jld:useDocumentLoader' property='rdfs:label' typeof='rdfs:Property'>use document loader</dt>
             <dd about='jld:useDocumentLoader'>
               <span property='rdfs:comment'><p>Test runners must implement a callback method with a method signature as defined in <a href="http://json-ld.org/spec/latest/json-ld-api/index.html#idl-def-LoadDocumentCallback">LoadDocumentCallback</a>. Specifying this option requires the test runner to provide this callback to the appropriate API method using the <code>documentLoader</code> option.</p></span>
@@ -296,7 +360,7 @@
             </dd>
             <dt about='jld:useNativeTypes' property='rdfs:label' typeof='rdfs:Property'>use native types</dt>
             <dd about='jld:useNativeTypes'>
-              <span property='rdfs:comment'><p>If the <em>use native types</em> flag is set to <code>true</code>, RDF literals with a datatype IRI tha equals <code>xsd:integer</code> or <code>xsd:double</code> are converted to a JSON numbers and RDF literals with a datatype IRI that equals <code>xsd:boolean</code> are converted to <code>true</code> or <code>false</code> based on their lexical form.</p></span>
+              <span property='rdfs:comment'><p>If the <em>use native types</em> flag is set to <code>true</code>, RDF literals with a datatype IRI that equal <code>xsd:integer</code> or <code>xsd:double</code> are converted to a JSON numbers and RDF literals with a datatype IRI that equals <code>xsd:boolean</code> are converted to <code>true</code> or <code>false</code> based on their lexical form.</p></span>
               <div>
                 <strong>
                   domain:
--- a/test-suite/vocab.jsonld	Fri Sep 06 11:17:32 2013 +0200
+++ b/test-suite/vocab.jsonld	Sat Sep 07 18:28:20 2013 -0700
@@ -132,6 +132,14 @@
       "rdfs:range": "xsd:boolean"
     },
     {
+      "@id": "jld:contentType",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "The HTTP Content-Type used for the input file, in case it is a non-registered type.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "content type",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
       "@id": "jld:expandContext",
       "@type": "rdfs:Property",
       "rdfs:comment": "A context that is used to initialize the active context when expanding a document.",
@@ -140,6 +148,22 @@
       "rdfs:range": "rdfs:Resource"
     },
     {
+      "@id": "jld:httpLink",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "An HTTP Link header to be added to the result of requesting the input file.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "HTTP link",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
+      "@id": "jld:httpStatus",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "The HTTP status code that must be returned when the input file is requested. This is typically used along with the `redirectTo` property.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "HTTP status",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
       "@id": "jld:input",
       "@type": "rdfs:Property",
       "rdfs:comment": "Secondary input file",
@@ -172,6 +196,14 @@
       "rdfs:range": "xsd:boolean"
     },
     {
+      "@id": "jld:redirectTo",
+      "@type": "rdfs:Property",
+      "rdfs:comment": "The location of a URL for redirection. A request made of the input file must be redirected to the designated URL.",
+      "rdfs:domain": "jld:Test",
+      "rdfs:label": "redirect to",
+      "rdfs:range": "xsd:boolean"
+    },
+    {
       "@id": "jld:useDocumentLoader",
       "@type": "rdfs:Property",
       "rdfs:comment": "Test runners must implement a callback method with a method signature as defined in [LoadDocumentCallback](http://json-ld.org/spec/latest/json-ld-api/index.html#idl-def-LoadDocumentCallback). Specifying this option requires the test runner to provide this callback to the appropriate API method using the `documentLoader` option.",
@@ -182,10 +214,10 @@
     {
       "@id": "jld:useNativeTypes",
       "@type": "rdfs:Property",
-      "rdfs:comment": "If the _use native types_ flag is set to `true`, RDF literals with a datatype IRI tha equals `xsd:integer` or `xsd:double` are converted to a JSON numbers and RDF literals with a datatype IRI that equals `xsd:boolean` are converted to `true` or `false` based on their lexical form.",
+      "rdfs:comment": "If the _use native types_ flag is set to `true`, RDF literals with a datatype IRI that equal `xsd:integer` or `xsd:double` are converted to a JSON numbers and RDF literals with a datatype IRI that equals `xsd:boolean` are converted to `true` or `false` based on their lexical form.",
       "rdfs:domain": "jld:FromRDFTest",
       "rdfs:label": "use native types",
       "rdfs:range": "xsd:boolean"
     }
   ]
-}
+}
\ No newline at end of file
--- a/test-suite/vocab.ttl	Fri Sep 06 11:17:32 2013 +0200
+++ b/test-suite/vocab.ttl	Sat Sep 07 18:28:20 2013 -0700
@@ -243,3 +243,37 @@
     """ ;
   rdfs:domain	 :FromRDFTest ;
   rdfs:range   xsd:boolean .
+
+:contentType a rdfs:Property ;
+  rdfs:label "content type";
+  rdfs:comment """
+    The HTTP Content-Type used for the input file, in case it is a non-registered type.
+    """ ;
+  rdfs:domain	 :Test ;
+  rdfs:range   xsd:boolean .
+
+:redirectTo a rdfs:Property ;
+  rdfs:label "redirect to";
+  rdfs:comment """
+    The location of a URL for redirection. A request made of the input file must be redirected
+    to the designated URL.
+    """ ;
+  rdfs:domain	 :Test ;
+  rdfs:range   xsd:boolean .
+
+:httpStatus a rdfs:Property ;
+  rdfs:label "HTTP status";
+  rdfs:comment """
+    The HTTP status code that must be returned when the input file is requested. This
+    is typically used along with the `redirectTo` property.
+    """ ;
+  rdfs:domain	 :Test ;
+  rdfs:range   xsd:boolean .
+
+:httpLink a rdfs:Property ;
+  rdfs:label "HTTP link";
+  rdfs:comment """
+    An HTTP Link header to be added to the result of requesting the input file.
+    """ ;
+  rdfs:domain	 :Test ;
+  rdfs:range   xsd:boolean .
--- a/test-suite/vocab_gen.rb	Fri Sep 06 11:17:32 2013 +0200
+++ b/test-suite/vocab_gen.rb	Sat Sep 07 18:28:20 2013 -0700
@@ -9,7 +9,7 @@
 
 File.open("vocab.jsonld", "w") do |f|
   r = RDF::Repository.load("vocab.ttl")
-  JSON::LD::API.fromRDF(r) do |expanded|
+  JSON::LD::API.fromRDF(r, :useNativeTypes => true) do |expanded|
     # Remove leading/trailing and multiple whitespace from rdf:comments
     expanded.each do |o|
       c = o[RDF::RDFS.comment.to_s].first['@value']