diff --git a/tests/README.md b/tests/README.md index 43139214..f836542a 100644 --- a/tests/README.md +++ b/tests/README.md @@ -5,6 +5,8 @@ be used to verify JSON-LD Processor conformance to the set of specifications that constitute JSON-LD. The goal of the suite is to provide an easy and comprehensive JSON-LD testing solution for developers creating JSON-LD Processors. +More information and an RDFS definition of the test vocabulary can be found at [vocab](https://w3c.github.io/json-ld-api/tests/vocab). + # Design Tests are defined into _compact_, _expand_, _flatten_, _remote-doc_, _fromRdf_, and _toRdf_ sections: @@ -26,7 +28,9 @@ Tests are defined into _compact_, _expand_, _flatten_, _remote-doc_, _fromRdf_, * _remote-doc_ tests have _input_ and _expected_ documents. The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output. - For *NegativeEvaluationTests*, the result is a string associated with the expected error code. Options may be present to describe the intended HTTP behavior: + For *NegativeEvaluationTests*, the result is a string associated with the expected error code. + + Options may be present to describe the intended HTTP behavior: * _contentType_: Content-Type of the returned HTTP payload, defaults to the appropriate type for the _input_ suffix. * _httpStatus_: The HTTP status code to return, defaults to `200`. * _redirectTo_: The HTTP _Content-Location_ header value. @@ -35,6 +39,23 @@ Tests are defined into _compact_, _expand_, _flatten_, _remote-doc_, _fromRdf_, The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output. * _toRdf_ tests have _input_ and _expected_ documents. The _expected_ results can be compared using [RDF Dataset Isomorphism](https://www.w3.org/TR/rdf11-concepts/#dfn-dataset-isomorphism). +* _http_ tests have _input_ and _expected_ documents and an optional _context_ document. + These tests describe the behavior of an HTTP server performing content-negotiation using the ACCEPT header, specified using the _accept_ option to generate the _expected_ result document. + The _expected_ results can be compared using [JSON-LD object comparison](#json-ld-object-comparison) with the processor output + after potentially remapping blank node identifiers (see below). + Additionally, if the result is compacted and the `ordered` option is not set, result should be expanded and compared with the expanded _expected_ document also using [JSON-LD object comparison](#json-ld-object-comparison). + + If the result is to be compacted, and no explicit context URL is provided, test subjects should use http/default-context.jsonld + + If the profile parameter includes http://example.com/do-not-use, test subjects should reject the URL and not accept the media type. Otherwise, for any other URL, applications should apply the specified URL for the context or frame, as appropriate. + + For *NegativeEvaluationTests*, the result is the expected HTTP status. Options may be present to describe the intended HTTP behavior: + * _accept_: The HTTP _Accept_ header value. + + Options may be present to describe the intended HTTP behavior: + * _contentType_: Content-Type of the returned HTTP payload, defaults to the appropriate type for the _input_ suffix. + * _httpAccept_: The HTTP _Accept_ header value. + * _httpLink_: The HTTP _Link_ header value. Unless `processingMode` is set explicitly in a test entry, `processingMode` is compatible with both `json-ld-1.0` and `json-ld-1.1`. diff --git a/tests/context.jsonld b/tests/context.jsonld index 540b0fc3..1323e8dd 100644 --- a/tests/context.jsonld +++ b/tests/context.jsonld @@ -1,8 +1,8 @@ { "@context": { - "@vocab": "https://json-ld.org/test-suite/vocab#", + "@vocab": "https://w3c.github.io/json-ld-api/tests/vocab#", "dc": "http://purl.org/dc/terms/", - "jld": "https://w3c.github.io/json-ld-api/vocab#", + "jld": "https://w3c.github.io/json-ld-api/tests/vocab#", "mf": "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#", "rdfs": "http://www.w3.org/2000/01/rdf-schema#", "xsd": "http://www.w3.org/2001/XMLSchema#", @@ -21,10 +21,11 @@ "base": { "@type": "@id" }, "compactArrays": { "@type": "xsd:boolean" }, "compactToRelative": { "@type": "xsd:boolean" }, - "documentLoader": { "@type": "xsd:string" }, + "contentType": { "@type": "xsd:boolean" }, "expandContext": { "@type": "xsd:string" }, - "httpStatus": { "@type": "xsd:integer" }, + "httpAccept": { "@type": "xsd:string" }, "httpLink": { "@type": "xsd:string", "@container": "@set" }, + "httpStatus": { "@type": "xsd:integer" }, "processingMode": { "@type": "xsd:string" }, "produceGeneralizedRdf":{ "@type": "xsd:boolean" }, "specVersion": { "@type": "xsd:string" }, diff --git a/tests/http-manifest.jsonld b/tests/http-manifest.jsonld new file mode 100644 index 00000000..085f0dfb --- /dev/null +++ b/tests/http-manifest.jsonld @@ -0,0 +1,228 @@ +{ + "@context": "https://w3c.github.io/json-ld-api/context.jsonld", + "@id": "", + "@type": "mf:Manifest", + "name": "HTTP", + "description": "Tests the appropriate server response to an HTTP Accept header and use of the profile parameter to the application/ld+json media type.", + "baseIri": "https://w3c.github.io/json-ld-api/tests/", + "sequence": [ + { + "@id": "#t0001", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return unprocessed input", + "purpose": "Support application/ld+json media type.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json", + "contentType": "application/ld+json" + }, + "input": "http/0001-in.jsonld", + "expect": "http/0001-out.jsonld" + }, { + "@id": "#t0002", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return expanded input with profile=http://www.w3.org/ns/json-ld#expanded", + "purpose": "Perform expansion of the input.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=http://www.w3.org/ns/json-ld#expanded", + "contentType": "application/ld+json" + }, + "input": "http/0002-in.jsonld", + "expect": "http/0002-out.jsonld" + }, { + "@id": "#t0003", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return compacted input using the default context with profile=http://www.w3.org/ns/json-ld#compacted", + "purpose": "Perform compaction of the input.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=http://www.w3.org/ns/json-ld#compacted", + "contentType": "application/ld+json" + }, + "input": "http/0003-in.jsonld", + "context": "http/default-context.jsonld", + "expect": "http/0003-out.jsonld" + }, { + "@id": "#t0004", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return compacted input using the specified context with application/ld+json and link header", + "purpose": "Perform compaction of the input.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json", + "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#context\"", + "contentType": "application/ld+json" + }, + "input": "http/0004-in.jsonld", + "context": "http/0004-context.jsonld", + "expect": "http/0004-out.jsonld" + }, { + "@id": "#t0005", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return compacted input using the specified context with application/ld+json;profile=\"http://www.w3.org/ns/json-ld#compacted\"", + "purpose": "Perform compaction of the input.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=\"http://www.w3.org/ns/json-ld#compacted\"", + "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#context\"", + "contentType": "application/ld+json" + }, + "input": "http/0005-in.jsonld", + "context": "http/0005-context.jsonld", + "expect": "http/0005-out.jsonld" + }, { + "@id": "#t0007", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return flattened input as application/ld+json using specified with application/ld+json;profile=http://www.w3.org/ns/json-ld#flattened", + "purpose": "Perform flattening of the input in expanded form.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=http://www.w3.org/ns/json-ld#flattened", + "contentType": "application/ld+json" + }, + "input": "http/0007-in.jsonld", + "expect": "http/0007-out.jsonld" + }, { + "@id": "#t0008", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return flattened input using the default context with application/ld+json;profile=\"http://www.w3.org/ns/json-ld#flattened http://www.w3.org/ns/json-ld#compacted\"", + "purpose": "Perform flattening of the input in compact form.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=\"http://www.w3.org/ns/json-ld#flattened http://www.w3.org/ns/json-ld#compacted\"", + "contentType": "application/ld+json" + }, + "input": "http/0008-in.jsonld", + "expect": "http/0008-out.jsonld" + }, { + "@id": "#t0009", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return flattened input using the default context with application/ld+json;profile=\"http://www.w3.org/ns/json-ld#compacted http://www.w3.org/ns/json-ld#flattened\"", + "purpose": "Perform flattening of the input in compact form.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=\"http://www.w3.org/ns/json-ld#compacted http://www.w3.org/ns/json-ld#flattened\"", + "contentType": "application/ld+json" + }, + "input": "http/0009-in.jsonld", + "expect": "http/0009-out.jsonld" + }, { + "@id": "#t0010", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return flattened input using the specified context with application/ld+json;profile=\"http://www.w3.org/ns/json-ld#flattened\"", + "purpose": "Perform flattening of the input in compact form.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=\"http://www.w3.org/ns/json-ld#flattened https://w3c.github.io/json-ld-api/tests/http/0010-context.jsonld\"", + "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#context\"", + "contentType": "application/ld+json" + }, + "input": "http/0010-in.jsonld", + "context": "http/0010-context.jsonld", + "expect": "http/0010-out.jsonld" + }, { + "@id": "#t0011", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return flattened input using the specified context with application/ld+json;profile=http://www.w3.org/ns/json-ld#flattened", + "purpose": "Perform flattening of the input in compact form.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=http://www.w3.org/ns/json-ld#flattened", + "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#context\"", + "contentType": "application/ld+json" + }, + "input": "http/0011-in.jsonld", + "context": "http/0011-context.jsonld", + "expect": "http/0011-out.jsonld" + }, { + "@id": "#t0012", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return flattened input using the specified context with application/ld+json;profile=\"http://www.w3.org/ns/json-ld#flattened http://www.w3.org/ns/json-ld#compacted\"", + "purpose": "Perform flattening of the input in compact form.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=\"http://www.w3.org/ns/json-ld#flattened http://www.w3.org/ns/json-ld#compacted\"", + "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#context\"", + "contentType": "application/ld+json" + }, + "input": "http/0012-in.jsonld", + "context": "http/0012-context.jsonld", + "expect": "http/0012-out.jsonld" + }, { + "@id": "#t0013", + "@type": ["jld:PositiveEvaluationTest", "jld:HttpTest"], + "name": "Return framed input using the specified frame with application/ld+json;profile=http://www.w3.org/ns/json-ld#framed", + "purpose": "Perform flattening of the input in compact form.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=http://www.w3.org/ns/json-ld#framed", + "httpLink": "; rel=\"http://www.w3.org/ns/json-ld#frame\"", + "contentType": "application/ld+json" + }, + "input": "http/0013-in.jsonld", + "frame": "http/0013-frame.jsonld", + "expect": "http/0013-out.jsonld" + }, { + "@id": "#t0014", + "@type": ["jld:NegativeEvaluationTest", "jld:HttpTest"], + "name": "Return status 406 with application/ld+json;profile=http://www.w3.org/ns/json-ld#framed", + "purpose": "Do not respond to invalid profile parameters (missing frame).", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=http://www.w3.org/ns/json-ld#framed", + "contentType": "text/plain" + }, + "input": "http/0014-in.jsonld", + "expect": 406 + }, { + "@id": "#t0015", + "@type": ["jld:NegativeEvaluationTest", "jld:HttpTest"], + "name": "Return status 406 with application/ld+json;profile=\"http://www.w3.org/ns/json-ld#framed http://www.w3.org/ns/json-ld#expanded\"", + "purpose": "Do not respond to invalid profile parameters.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=\"http://www.w3.org/ns/json-ld#framed http://www.w3.org/ns/json-ld#expanded\"", + "contentType": "text/plain" + }, + "input": "http/0015-in.jsonld", + "expect": 406 + }, { + "@id": "#t0016", + "@type": ["jld:NegativeEvaluationTest", "jld:HttpTest"], + "name": "Return status 406 with application/ld+json;profile=\"http://www.w3.org/ns/json-ld#expanded http://www.w3.org/ns/json-ld#framed\"", + "purpose": "Do not respond to invalid profile parameters.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=\"http://www.w3.org/ns/json-ld#expanded http://www.w3.org/ns/json-ld#framed\"", + "contentType": "text/plain" + }, + "input": "http/0016-in.jsonld", + "expect": 406 + }, { + "@id": "#t0017", + "@type": ["jld:NegativeEvaluationTest", "jld:HttpTest"], + "name": "Return status 406 with application/ld+json;profile=\"http://www.w3.org/ns/json-ld#framed http://www.w3.org/ns/json-ld#compacted\"", + "purpose": "Do not respond to invalid profile parameters.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=\"http://www.w3.org/ns/json-ld#framed http://www.w3.org/ns/json-ld#compacted\"", + "contentType": "text/plain" + }, + "input": "http/0017-in.jsonld", + "expect": 406 + }, { + "@id": "#t0018", + "@type": ["jld:NegativeEvaluationTest", "jld:HttpTest"], + "name": "Return status 406 with application/ld+json;profile=\"http://www.w3.org/ns/json-ld#compacted http://www.w3.org/ns/json-ld#framed\"", + "purpose": "Do not respond to invalid profile parameters.", + "option": { + "specVersion": "json-ld-1.1", + "httpAccept": "application/ld+json;profile=\"http://www.w3.org/ns/json-ld#compacted http://www.w3.org/ns/json-ld#framed\"", + "contentType": "text/plain" + }, + "input": "http/0018-in.jsonld", + "expect": 406 + } + ] +} diff --git a/tests/http/0001-in.jsonld b/tests/http/0001-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0001-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0001-out.jsonld b/tests/http/0001-out.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0001-out.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0002-in.jsonld b/tests/http/0002-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0002-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0002-out.jsonld b/tests/http/0002-out.jsonld new file mode 100644 index 00000000..c827ad65 --- /dev/null +++ b/tests/http/0002-out.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": ["http://example.org/vocab#Library"], + "http://example.org/vocab#contains": [{"@id": "http://example.org/library/the-republic"}] + }, { + "@id": "http://example.org/library/the-republic", + "@type": ["http://example.org/vocab#Book"], + "http://purl.org/dc/elements/1.1/creator": [{"@value": "Plato"}], + "http://purl.org/dc/elements/1.1/title": [{"@value": "The Republic"}], + "http://example.org/vocab#contains": [{ + "@id": "http://example.org/library/the-republic#introduction", + "@type": ["http://example.org/vocab#Chapter"], + "http://purl.org/dc/elements/1.1/description": [{"@value": "An introductory chapter on The Republic."}], + "http://purl.org/dc/elements/1.1/title": [{"@value": "The Introduction"}] + }] + } +] \ No newline at end of file diff --git a/tests/http/0003-in.jsonld b/tests/http/0003-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0003-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0003-out.jsonld b/tests/http/0003-out.jsonld new file mode 100644 index 00000000..b65a0aaa --- /dev/null +++ b/tests/http/0003-out.jsonld @@ -0,0 +1,24 @@ +{ + "@context": "https://w3c.github.io/json-ld-api/tests/http/default-context.jsonld", + "@graph": [ + { + "@id": "http://example.org/library", + "@type": "ex:Library", + "ex:contains": { + "@id": "http://example.org/library/the-republic" + } + }, + { + "@id": "http://example.org/library/the-republic", + "@type": "ex:Book", + "dc:creator": "Plato", + "dc:title": "The Republic", + "ex:contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "ex:Chapter", + "dc:description": "An introductory chapter on The Republic.", + "dc:title": "The Introduction" + } + } + ] +} \ No newline at end of file diff --git a/tests/http/0004-context.jsonld b/tests/http/0004-context.jsonld new file mode 100644 index 00000000..285fed92 --- /dev/null +++ b/tests/http/0004-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "dc": "http://purl.org/dc/elements/1.1/", + "ex": "http://example.org/vocab#" + } +} \ No newline at end of file diff --git a/tests/http/0004-in.jsonld b/tests/http/0004-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0004-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0004-out.jsonld b/tests/http/0004-out.jsonld new file mode 100644 index 00000000..22d1bd01 --- /dev/null +++ b/tests/http/0004-out.jsonld @@ -0,0 +1,24 @@ +{ + "@context": "https://w3c.github.io/json-ld-api/tests/http/0004-context.jsonld", + "@graph": [ + { + "@id": "http://example.org/library", + "@type": "ex:Library", + "ex:contains": { + "@id": "http://example.org/library/the-republic" + } + }, + { + "@id": "http://example.org/library/the-republic", + "@type": "ex:Book", + "dc:creator": "Plato", + "dc:title": "The Republic", + "ex:contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "ex:Chapter", + "dc:description": "An introductory chapter on The Republic.", + "dc:title": "The Introduction" + } + } + ] +} \ No newline at end of file diff --git a/tests/http/0005-context.jsonld b/tests/http/0005-context.jsonld new file mode 100644 index 00000000..285fed92 --- /dev/null +++ b/tests/http/0005-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "dc": "http://purl.org/dc/elements/1.1/", + "ex": "http://example.org/vocab#" + } +} \ No newline at end of file diff --git a/tests/http/0005-in.jsonld b/tests/http/0005-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0005-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0005-out.jsonld b/tests/http/0005-out.jsonld new file mode 100644 index 00000000..de871330 --- /dev/null +++ b/tests/http/0005-out.jsonld @@ -0,0 +1,24 @@ +{ + "@context": "https://w3c.github.io/json-ld-api/tests/http/0005-context.jsonld", + "@graph": [ + { + "@id": "http://example.org/library", + "@type": "ex:Library", + "ex:contains": { + "@id": "http://example.org/library/the-republic" + } + }, + { + "@id": "http://example.org/library/the-republic", + "@type": "ex:Book", + "dc:creator": "Plato", + "dc:title": "The Republic", + "ex:contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "ex:Chapter", + "dc:description": "An introductory chapter on The Republic.", + "dc:title": "The Introduction" + } + } + ] +} \ No newline at end of file diff --git a/tests/http/0007-in.jsonld b/tests/http/0007-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0007-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0007-out.jsonld b/tests/http/0007-out.jsonld new file mode 100644 index 00000000..fc27b1d6 --- /dev/null +++ b/tests/http/0007-out.jsonld @@ -0,0 +1,20 @@ +[ + { + "@id": "http://example.org/library", + "@type": ["http://example.org/vocab#Library"], + "http://example.org/vocab#contains": [{"@id": "http://example.org/library/the-republic"}] + }, + { + "@id": "http://example.org/library/the-republic", + "@type": ["http://example.org/vocab#Book"], + "http://purl.org/dc/elements/1.1/creator": [{"@value": "Plato"}], + "http://purl.org/dc/elements/1.1/title": [{"@value": "The Republic"}], + "http://example.org/vocab#contains": [{"@id": "http://example.org/library/the-republic#introduction"}] + }, + { + "@id": "http://example.org/library/the-republic#introduction", + "@type": ["http://example.org/vocab#Chapter"], + "http://purl.org/dc/elements/1.1/description": [{"@value": "An introductory chapter on The Republic."}], + "http://purl.org/dc/elements/1.1/title": [{"@value": "The Introduction"}] + } +] \ No newline at end of file diff --git a/tests/http/0008-in.jsonld b/tests/http/0008-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0008-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0008-out.jsonld b/tests/http/0008-out.jsonld new file mode 100644 index 00000000..839f14d6 --- /dev/null +++ b/tests/http/0008-out.jsonld @@ -0,0 +1,27 @@ +{ + "@context": "https://w3c.github.io/json-ld-api/tests/http/default-context.jsonld", + "@graph": [ + { + "@id": "http://example.org/library", + "@type": "ex:Library", + "ex:contains": { + "@id": "http://example.org/library/the-republic" + } + }, + { + "@id": "http://example.org/library/the-republic", + "@type": "ex:Book", + "dc:creator": "Plato", + "dc:title": "The Republic", + "ex:contains": { + "@id": "http://example.org/library/the-republic#introduction" + } + }, + { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "ex:Chapter", + "dc:description": "An introductory chapter on The Republic.", + "dc:title": "The Introduction" + } + ] +} \ No newline at end of file diff --git a/tests/http/0009-in.jsonld b/tests/http/0009-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0009-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0009-out.jsonld b/tests/http/0009-out.jsonld new file mode 100644 index 00000000..839f14d6 --- /dev/null +++ b/tests/http/0009-out.jsonld @@ -0,0 +1,27 @@ +{ + "@context": "https://w3c.github.io/json-ld-api/tests/http/default-context.jsonld", + "@graph": [ + { + "@id": "http://example.org/library", + "@type": "ex:Library", + "ex:contains": { + "@id": "http://example.org/library/the-republic" + } + }, + { + "@id": "http://example.org/library/the-republic", + "@type": "ex:Book", + "dc:creator": "Plato", + "dc:title": "The Republic", + "ex:contains": { + "@id": "http://example.org/library/the-republic#introduction" + } + }, + { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "ex:Chapter", + "dc:description": "An introductory chapter on The Republic.", + "dc:title": "The Introduction" + } + ] +} \ No newline at end of file diff --git a/tests/http/0010-context.jsonld b/tests/http/0010-context.jsonld new file mode 100644 index 00000000..dcd11f87 --- /dev/null +++ b/tests/http/0010-context.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@vocab": "http://purl.org/dc/elements/1.1/", + "ex": "http://example.org/vocab#", + "id": "@id", + "type": "@type", + "contains": {"@id": "ex:contains", "@type": "@id"}, + "title": "dc:title", + "creator": "dc:creator" + } +} \ No newline at end of file diff --git a/tests/http/0010-in.jsonld b/tests/http/0010-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0010-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0010-out.jsonld b/tests/http/0010-out.jsonld new file mode 100644 index 00000000..a16fddf3 --- /dev/null +++ b/tests/http/0010-out.jsonld @@ -0,0 +1,23 @@ +{ + "@context": "https://w3c.github.io/json-ld-api/tests/http/0010-context.jsonld", + "@graph": [ + { + "id": "http://example.org/library", + "type": "ex:Library", + "contains": "http://example.org/library/the-republic" + }, + { + "id": "http://example.org/library/the-republic", + "type": "ex:Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "contains": "http://example.org/library/the-republic#introduction" + }, + { + "id": "http://example.org/library/the-republic#introduction", + "type": "ex:Chapter", + "description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + ] +} \ No newline at end of file diff --git a/tests/http/0011-context.jsonld b/tests/http/0011-context.jsonld new file mode 100644 index 00000000..dcd11f87 --- /dev/null +++ b/tests/http/0011-context.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@vocab": "http://purl.org/dc/elements/1.1/", + "ex": "http://example.org/vocab#", + "id": "@id", + "type": "@type", + "contains": {"@id": "ex:contains", "@type": "@id"}, + "title": "dc:title", + "creator": "dc:creator" + } +} \ No newline at end of file diff --git a/tests/http/0011-in.jsonld b/tests/http/0011-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0011-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0011-out.jsonld b/tests/http/0011-out.jsonld new file mode 100644 index 00000000..96c71c72 --- /dev/null +++ b/tests/http/0011-out.jsonld @@ -0,0 +1,23 @@ +{ + "@context": "https://w3c.github.io/json-ld-api/tests/http/0011-context.jsonld", + "@graph": [ + { + "id": "http://example.org/library", + "type": "ex:Library", + "contains": "http://example.org/library/the-republic" + }, + { + "id": "http://example.org/library/the-republic", + "type": "ex:Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "contains": "http://example.org/library/the-republic#introduction" + }, + { + "id": "http://example.org/library/the-republic#introduction", + "type": "ex:Chapter", + "description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + ] +} \ No newline at end of file diff --git a/tests/http/0012-context.jsonld b/tests/http/0012-context.jsonld new file mode 100644 index 00000000..dcd11f87 --- /dev/null +++ b/tests/http/0012-context.jsonld @@ -0,0 +1,11 @@ +{ + "@context": { + "@vocab": "http://purl.org/dc/elements/1.1/", + "ex": "http://example.org/vocab#", + "id": "@id", + "type": "@type", + "contains": {"@id": "ex:contains", "@type": "@id"}, + "title": "dc:title", + "creator": "dc:creator" + } +} \ No newline at end of file diff --git a/tests/http/0012-in.jsonld b/tests/http/0012-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0012-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0012-out.jsonld b/tests/http/0012-out.jsonld new file mode 100644 index 00000000..66d402e1 --- /dev/null +++ b/tests/http/0012-out.jsonld @@ -0,0 +1,23 @@ +{ + "@context": "https://w3c.github.io/json-ld-api/tests/http/0012-context.jsonld", + "@graph": [ + { + "id": "http://example.org/library", + "type": "ex:Library", + "contains": "http://example.org/library/the-republic" + }, + { + "id": "http://example.org/library/the-republic", + "type": "ex:Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "contains": "http://example.org/library/the-republic#introduction" + }, + { + "id": "http://example.org/library/the-republic#introduction", + "type": "ex:Chapter", + "description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + ] +} \ No newline at end of file diff --git a/tests/http/0013-frame.jsonld b/tests/http/0013-frame.jsonld new file mode 100644 index 00000000..16faf5bb --- /dev/null +++ b/tests/http/0013-frame.jsonld @@ -0,0 +1,13 @@ +{ + "@context": { + "dc": "http://purl.org/dc/elements/1.1/", + "ex": "http://example.org/vocab#" + }, + "@type": "ex:Library", + "ex:contains": { + "@type": "ex:Book", + "ex:contains": { + "@type": "ex:Chapter" + } + } +} \ No newline at end of file diff --git a/tests/http/0013-in.jsonld b/tests/http/0013-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0013-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0013-out.jsonld b/tests/http/0013-out.jsonld new file mode 100644 index 00000000..09edc277 --- /dev/null +++ b/tests/http/0013-out.jsonld @@ -0,0 +1,24 @@ +{ + "@context": { + "dc": "http://purl.org/dc/elements/1.1/", + "ex": "http://example.org/vocab#" + }, + "@graph": [ + { + "@id": "http://example.org/library", + "@type": "ex:Library", + "ex:contains": { + "@id": "http://example.org/library/the-republic", + "@type": "ex:Book", + "dc:creator": "Plato", + "dc:title": "The Republic", + "ex:contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "ex:Chapter", + "dc:description": "An introductory chapter on The Republic.", + "dc:title": "The Introduction" + } + } + } + ] +} \ No newline at end of file diff --git a/tests/http/0014-in.jsonld b/tests/http/0014-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0014-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0015-in.jsonld b/tests/http/0015-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0015-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0016-in.jsonld b/tests/http/0016-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0016-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0017-in.jsonld b/tests/http/0017-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0017-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/0018-in.jsonld b/tests/http/0018-in.jsonld new file mode 100644 index 00000000..830d5709 --- /dev/null +++ b/tests/http/0018-in.jsonld @@ -0,0 +1,18 @@ +[ + { + "@id": "http://example.org/library", + "@type": "http://example.org/vocab#Library", + "http://example.org/vocab#contains": {"@id": "http://example.org/library/the-republic"} + }, { + "@id": "http://example.org/library/the-republic", + "@type": "http://example.org/vocab#Book", + "http://purl.org/dc/elements/1.1/creator": "Plato", + "http://purl.org/dc/elements/1.1/title": "The Republic", + "http://example.org/vocab#contains": { + "@id": "http://example.org/library/the-republic#introduction", + "@type": "http://example.org/vocab#Chapter", + "http://purl.org/dc/elements/1.1/description": "An introductory chapter on The Republic.", + "http://purl.org/dc/elements/1.1/title": "The Introduction" + } + } +] \ No newline at end of file diff --git a/tests/http/default-context.jsonld b/tests/http/default-context.jsonld new file mode 100644 index 00000000..285fed92 --- /dev/null +++ b/tests/http/default-context.jsonld @@ -0,0 +1,6 @@ +{ + "@context": { + "dc": "http://purl.org/dc/elements/1.1/", + "ex": "http://example.org/vocab#" + } +} \ No newline at end of file diff --git a/tests/manifest.jsonld b/tests/manifest.jsonld index fd7dfce2..9b1d3b3c 100644 --- a/tests/manifest.jsonld +++ b/tests/manifest.jsonld @@ -9,6 +9,7 @@ "expand-manifest.jsonld", "flatten-manifest.jsonld", "fromRdf-manifest.jsonld", + "http-manifest.jsonld", "remote-doc-manifest.jsonld", "toRdf-manifest.jsonld" ] diff --git a/tests/mk_vocab.rb b/tests/mk_vocab.rb new file mode 100755 index 00000000..5e1b9357 --- /dev/null +++ b/tests/mk_vocab.rb @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby +# Generate vocab.jsonld and vocab.html from vocab.ttl and vocab_template. +# +# Generating vocab.jsonld is equivalent to running the following: +# +# jsonld --compact --context vocab_context.jsonld --input-format ttl vocab.ttl -o vocab.jsonld +require 'linkeddata' +require 'haml' + +File.open("vocab.jsonld", "w") do |f| + r = RDF::Repository.load("vocab.ttl") + 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'] + o[RDF::RDFS.comment.to_s].first['@value'] = c.strip.gsub(/\s+/m, ' ') + end + JSON::LD::API.compact(expanded, File.open("vocab_context.jsonld")) do |compacted| + # Create vocab.jsonld + f.write(compacted.to_json(JSON::LD::JSON_STATE)) + + # Create vocab.html using vocab_template.haml and compacted vocabulary + template = File.read("vocab_template.haml") + + html = Haml::Engine.new(template, format: :html5).render(self, + ontology: compacted['@graph'].detect {|o| o['@id'] == "https://json-ld.org/test-suite/vocab#"}, + classes: compacted['@graph'].select {|o| o['@type'] == "rdfs:Class"}.sort_by {|o| o['rdfs:label']}, + properties: compacted['@graph'].select {|o| o['@type'] == "rdf:Property"}.sort_by {|o| o['rdfs:label']}, + source: compacted.to_json(JSON::LD::JSON_STATE) + ) + File.open("vocab.html", "w") {|fh| fh.write html} + end + end +end diff --git a/tests/vocab.html b/tests/vocab.html new file mode 100644 index 00000000..16bdb12d --- /dev/null +++ b/tests/vocab.html @@ -0,0 +1,400 @@ + + + +Test case manifest vocabulary extensions + + + + +

Test case manifest vocabulary extensions

+

W3C

+

+Alternate versions of the test vocabulary definition exist in +Turtle +and JSON-LD. +

+
+

Test Case Classes

+
+
Compact Evaluation Test
+

A CompactTest modifies either a PositiveEvaluationTest, NegativeEvaluationTest, PositiveSyntaxTest or NegativeSyntaxTest.

+
+
Expand Evaluation Test
+

A ExpandTest modifies either a PositiveEvaluationTest, NegativeEvaluationTest, PositiveSyntaxTest or NegativeSyntaxTest.

+
+
Flatten Evaluation Test
+

A FlattenTest modifies either a PositiveEvaluationTest, NegativeEvaluationTest, PositiveSyntaxTest or NegativeSyntaxTest.

+
+
Frame Evaluation Test
+

A FrameTest modifies either a PositiveEvaluationTest, NegativeEvaluationTest, PositiveSyntaxTest or NegativeSyntaxTest.

+
+
From RDF Evaluation Test
+

A FromRDFTest modifies either a PositiveEvaluationTest, NegativeEvaluationTest, PositiveSyntaxTest or NegativeSyntaxTest.

+
+
HTTP Evaluation Test
+

An HttpTest modifies either a PositiveEvaluationTest or NegativeEvaluationTest.

+
+
Negative Syntax Test
+

A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action. Negative syntax tests are tests of which the result should be a parser error.

+
+
Positive Evaluation Test
+

A Positive Evaluation test is successful when the result of processing the input file specified as mf:action (aliased as "input" in test manifest) exactly matches the output file specified as mf:result (aliased as "expect" in test manifest) using the comparison defined in another class. The specifics of invoking test, including the interpretation of options (:option) and other input files are specified through another class.

+
+
Positive Evaluation Test
+

A Negative Evaluation test is successful when the result of processing the input file specified as mf:action (aliased as "input" in test manifest) results in the error identified by the literal value of mf:result (aliased as "expect" in test manifest). The specifics of invoking test, including the interpretation of options (:option) and other input files are specified through another class. See the README for more details on running tests.

+
+
Positive Syntax Test
+

A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action.

+
+
Processor Options
+

Options passed to the test runner to affect invocation of the appropriate API method.

+
+
Superclass of all JSON-LD tests
+

All JSON-LD tests have an input file referenced using mf:action (aliased as "input" in test manifest). Positive and Negative Evaluation Tests also have a result file referenced using mf:result (aliased as "expect" in test manifest). Other tests may take different inputs and options as defined for each test class. Tests should be run with the processingMode option set to "json-ld-1.1", unless specified explicitly as a test option.

+
+
To RDF Evaluation Test
+

A ToRDFTest modifies either a PositiveEvaluationTest, NegativeEvaluationTest, PositiveSyntaxTest or NegativeSyntaxTest.

+
+
+
+
+

Test Case Properties

+
+
HTTP Accept
+

An HTTP Accept header.

+
+
HTTP link
+

An HTTP Link header to be added to the result of requesting the input file.

+
+
HTTP status
+

The HTTP status code that must be returned when the input file is requested. This is typically used along with the redirectTo property.

+
+
base
+

The base IRI to use when expanding or compacting the document. If set, this overrides the input document's IRI.

+
+
compact arrays
+

If set to true, the JSON-LD processor replaces arrays with just one element with that element during compaction. If set to false, all arrays will remain arrays even if they have just one element.

+
+
compact to relative
+

If set to false, the JSON-LD processor will not attempt to compact using document-relative IRIs.

+
+
content type
+

The HTTP Content-Type used for the input file, in case it is a non-registered type.

+
+
expand context
+

A context that is used to initialize the active context when expanding a document.

+
+
input
+

A context that is used for transforming the input document.

+
+
input
+

Secondary input file

+
+
input
+

A frame that is used for transforming the input document.

+
+
option
+

Options affecting processing

+
+
processing mode
+

If set to "json-ld-1.1", the JSON-LD processor must produce exactly the same results as the algorithms defined in this specification. If set to another value, the JSON-LD processor is allowed to extend or modify the algorithms defined in this specification to enable application-specific optimizations. The definition of such optimizations is beyond the scope of this specification and thus not defined. Consequently, different implementations may implement different optimizations. Developers must not define modes beginning with json-ld as they are reserved for future versions of this specification.

+
+
produce generalized RDF
+

Unless the produce generalized RDF flag is set to true, RDF triples containing a blank node predicate are excluded from output.

+
+
redirect to
+

The location of a URL for redirection. A request made of the input file must be redirected to the designated URL.

+
+
spec version
+

Indicates the JSON-LD version to which the test applies, rather than the specific processing mode. Values are "json-ld-1.0", and "json-ld-1.1". If not set, the test is presumed to be valid for all versions of JSON-LD. In cases where results differ between spec versions for the same test, the test will have both a "1.0" and "1.1" version, for example.

+
+
use RDF types
+

If the use rdf type flag is set to true, statements with an rdf:type predicate will not use @type, but will be transformed as a normal property.

+
+
use native types
+

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.

+
+
+
+
+W3C Linked JSON Community Group +
+ + diff --git a/tests/vocab.jsonld b/tests/vocab.jsonld new file mode 100644 index 00000000..49e17464 --- /dev/null +++ b/tests/vocab.jsonld @@ -0,0 +1,276 @@ +{ + "@context": { + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "dc": "http://purl.org/dc/elements/1.1/", + "mf": "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "jld": "https://json-ld.org/test-suite/vocab#", + "jld:Test": { + "@type": "@id" + }, + "dc:identifier": { + "@type": "@id" + }, + "rdfs:subClassOf": { + "@type": "@id" + }, + "rdfs:domain": { + "@type": "@id" + }, + "rdfs:range": { + "@type": "@id" + } + }, + "@graph": [ + { + "@id": "jld:FromRDFTest", + "@type": "rdfs:Class", + "rdfs:label": "From RDF Evaluation Test", + "rdfs:subClassOf": "jld:Test", + "rdfs:comment": "A `FromRDFTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`." + }, + { + "@id": "jld:Test", + "@type": "rdfs:Class", + "rdfs:label": "Superclass of all JSON-LD tests", + "rdfs:comment": "All JSON-LD tests have an input file referenced using `mf:action` (aliased as \"input\" in test manifest). Positive and Negative Evaluation Tests also have a result file referenced using `mf:result` (aliased as \"expect\" in test manifest). Other tests may take different inputs and options as defined for each test class. Tests should be run with the processingMode option set to \"json-ld-1.1\", unless specified explicitly as a test option." + }, + { + "@id": "jld:processingMode", + "@type": "rdf:Property", + "rdfs:label": "processing mode", + "rdfs:domain": "jld:Option", + "rdfs:comment": "If set to \"json-ld-1.1\", the JSON-LD processor must produce exactly the same results as the algorithms defined in this specification. If set to another value, the JSON-LD processor is allowed to extend or modify the algorithms defined in this specification to enable application-specific optimizations. The definition of such optimizations is beyond the scope of this specification and thus not defined. Consequently, different implementations may implement different optimizations. Developers must not define modes beginning with json-ld as they are reserved for future versions of this specification.", + "rdfs:range": "xsd:string" + }, + { + "@id": "jld:Option", + "@type": "rdfs:Class", + "rdfs:label": "Processor Options", + "rdfs:comment": "Options passed to the test runner to affect invocation of the appropriate API method." + }, + { + "@id": "jld:frame", + "@type": "rdf:Property", + "rdfs:subPropertyOf": { + "@id": "jld:input" + }, + "rdfs:domain": "jld:Test", + "rdfs:comment": "A frame that is used for transforming the input document.", + "rdfs:range": "rdfs:Resource", + "rdfs:label": "input" + }, + { + "@id": "jld:input", + "@type": "rdf:Property", + "rdfs:label": "input", + "rdfs:domain": "jld:Test", + "rdfs:comment": "Secondary input file", + "rdfs:range": "rdfs:Resource" + }, + { + "@id": "jld:option", + "@type": "rdf:Property", + "rdfs:label": "option", + "rdfs:domain": "jld:Test", + "rdfs:comment": "Options affecting processing", + "rdfs:range": "jld:Option" + }, + { + "@id": "jld:FlattenTest", + "@type": "rdfs:Class", + "rdfs:label": "Flatten Evaluation Test", + "rdfs:subClassOf": "jld:Test", + "rdfs:comment": "A `FlattenTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`." + }, + { + "@id": "jld:PositiveEvaluationTest", + "@type": "rdfs:Class", + "rdfs:label": "Positive Evaluation Test", + "rdfs:subClassOf": "jld:Test", + "rdfs:comment": "A Positive Evaluation test is successful when the result of processing the input file specified as `mf:action` (aliased as \"input\" in test manifest) exactly matches the output file specified as `mf:result` (aliased as \"expect\" in test manifest) using the comparison defined in another class. The specifics of invoking test, including the interpretation of options (`:option`) and other input files are specified through another class." + }, + { + "@id": "jld:NegativeSyntaxTest", + "@type": "rdfs:Class", + "rdfs:label": "Negative Syntax Test", + "rdfs:subClassOf": "jld:Test", + "rdfs:comment": "A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action. Negative syntax tests are tests of which the result should be a parser error." + }, + { + "@id": "https://json-ld.org/test-suite/vocab#", + "dc:date": "2013-09-23", + "dc:identifier": "https://json-ld.org/test-suite/vocab#", + "dc:creator": "Gregg Kellogg", + "dc:publisher": "W3C Linked JSON Community Group", + "dc:description": "Test case manifest vocabulary extensions", + "rdfs:comment": "Manifest vocabulary for JSON-LD test cases", + "dc:title": "Test case manifest vocabulary extensions" + }, + { + "@id": "jld:compactArrays", + "@type": "rdf:Property", + "rdfs:label": "compact arrays", + "rdfs:domain": "jld:Option", + "rdfs:comment": "If set to `true`, the JSON-LD processor replaces arrays with just one element with that element during compaction. If set to false, all arrays will remain arrays even if they have just one element.", + "rdfs:range": "xsd:boolean" + }, + { + "@id": "jld:FrameTest", + "@type": "rdfs:Class", + "rdfs:label": "Frame Evaluation Test", + "rdfs:subClassOf": "jld:Test", + "rdfs:comment": "A `FrameTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`." + }, + { + "@id": "jld:useRdfType", + "@type": "rdf:Property", + "rdfs:label": "use RDF types", + "rdfs:domain": "jld:Option", + "rdfs:comment": "If the _use rdf type_ flag is set to `true`, statements with an `rdf:type` predicate will not use `@type`, but will be transformed as a normal property.", + "rdfs:range": "xsd:boolean" + }, + { + "@id": "jld:httpLink", + "@type": "rdf:Property", + "rdfs:label": "HTTP link", + "rdfs:domain": "jld:Option", + "rdfs:comment": "An HTTP Link header to be added to the result of requesting the input file.", + "rdfs:range": "xsd:boolean" + }, + { + "@id": "jld:HttpTest", + "@type": "rdfs:Class", + "rdfs:label": "HTTP Evaluation Test", + "rdfs:subClassOf": "jld:Test", + "rdfs:comment": "An `HttpTest` modifies either a `PositiveEvaluationTest` or `NegativeEvaluationTest`." + }, + { + "@id": "jld:expandContext", + "@type": "rdf:Property", + "rdfs:label": "expand context", + "rdfs:domain": "jld:Option", + "rdfs:comment": "A context that is used to initialize the active context when expanding a document.", + "rdfs:range": "rdfs:Resource" + }, + { + "@id": "jld:NegativeEvaluationTest", + "@type": "rdfs:Class", + "rdfs:label": "Positive Evaluation Test", + "rdfs:subClassOf": "jld:Test", + "rdfs:comment": "A Negative Evaluation test is successful when the result of processing the input file specified as `mf:action` (aliased as \"input\" in test manifest) results in the error identified by the literal value of `mf:result` (aliased as \"expect\" in test manifest). The specifics of invoking test, including the interpretation of options (`:option`) and other input files are specified through another class. See the [README](https://w3c.github.io/json-ld-api/tests/) for more details on running tests." + }, + { + "@id": "jld:context", + "@type": "rdf:Property", + "rdfs:subPropertyOf": { + "@id": "jld:input" + }, + "rdfs:domain": "jld:Test", + "rdfs:comment": "A context that is used for transforming the input document.", + "rdfs:range": "rdfs:Resource", + "rdfs:label": "input" + }, + { + "@id": "jld:PositiveSyntaxTest", + "@type": "rdfs:Class", + "rdfs:label": "Positive Syntax Test", + "rdfs:subClassOf": "jld:Test", + "rdfs:comment": "A type of test specifically for syntax testing. Syntax tests are not required to have an associated result, only an action." + }, + { + "@id": "jld:base", + "@type": "rdf:Property", + "rdfs:label": "base", + "rdfs:domain": "jld:Option", + "rdfs:comment": "The base IRI to use when expanding or compacting the document. If set, this overrides the input document's IRI.", + "rdfs:range": "rdfs:Resource" + }, + { + "@id": "jld:contentType", + "@type": "rdf:Property", + "rdfs:label": "content type", + "rdfs:domain": "jld:Option", + "rdfs:comment": "The HTTP Content-Type used for the input file, in case it is a non-registered type.", + "rdfs:range": "xsd:boolean" + }, + { + "@id": "jld:useNativeTypes", + "@type": "rdf:Property", + "rdfs:label": "use native types", + "rdfs:domain": "jld:Option", + "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:range": "xsd:boolean" + }, + { + "@id": "jld:httpAccept", + "@type": "rdf:Property", + "rdfs:label": "HTTP Accept", + "rdfs:domain": "jld:Option", + "rdfs:comment": "An HTTP Accept header.", + "rdfs:range": "xsd:boolean" + }, + { + "@id": "jld:ExpandTest", + "@type": "rdfs:Class", + "rdfs:label": "Expand Evaluation Test", + "rdfs:subClassOf": "jld:Test", + "rdfs:comment": "A `ExpandTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`." + }, + { + "@id": "jld:redirectTo", + "@type": "rdf:Property", + "rdfs:label": "redirect to", + "rdfs:domain": "jld:Option", + "rdfs:comment": "The location of a URL for redirection. A request made of the input file must be redirected to the designated URL.", + "rdfs:range": "xsd:boolean" + }, + { + "@id": "jld:ToRDFTest", + "@type": "rdfs:Class", + "rdfs:label": "To RDF Evaluation Test", + "rdfs:subClassOf": "jld:Test", + "rdfs:comment": "A `ToRDFTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`." + }, + { + "@id": "jld:compactToRelative", + "@type": "rdf:Property", + "rdfs:label": "compact to relative", + "rdfs:domain": "jld:Option", + "rdfs:comment": "If set to `false`, the JSON-LD processor will not attempt to compact using document-relative IRIs.", + "rdfs:range": "xsd:boolean" + }, + { + "@id": "jld:httpStatus", + "@type": "rdf:Property", + "rdfs:label": "HTTP status", + "rdfs:domain": "jld:Option", + "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:range": "xsd:boolean" + }, + { + "@id": "jld:CompactTest", + "@type": "rdfs:Class", + "rdfs:label": "Compact Evaluation Test", + "rdfs:subClassOf": "jld:Test", + "rdfs:comment": "A `CompactTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, `PositiveSyntaxTest` or `NegativeSyntaxTest`." + }, + { + "@id": "jld:produceGeneralizedRdf", + "@type": "rdf:Property", + "rdfs:label": "produce generalized RDF", + "rdfs:domain": "jld:Option", + "rdfs:comment": "Unless the produce generalized RDF flag is set to true, RDF triples containing a blank node predicate are excluded from output.", + "rdfs:range": "xsd:boolean" + }, + { + "@id": "jld:specVersion", + "@type": "rdf:Property", + "rdfs:label": "spec version", + "rdfs:domain": "jld:Option", + "rdfs:comment": "Indicates the JSON-LD version to which the test applies, rather than the specific processing mode. Values are \"json-ld-1.0\", and \"json-ld-1.1\". If not set, the test is presumed to be valid for all versions of JSON-LD. In cases where results differ between spec versions for the same test, the test will have both a \"1.0\" and \"1.1\" version, for example.", + "rdfs:range": "xsd:string" + } + ] +} \ No newline at end of file diff --git a/tests/vocab.ttl b/tests/vocab.ttl new file mode 100644 index 00000000..ac7fe66f --- /dev/null +++ b/tests/vocab.ttl @@ -0,0 +1,287 @@ +# Test vocabulary for the JSON-LD test suite. +# This vocabulary defines classes an properties which extend +# the test-manifest vocabulary at . + +@prefix rdfs: . +@prefix rdf: . +@prefix dc: . +@prefix mf: . +@prefix xsd: . +@prefix : . + +: rdfs:comment "Manifest vocabulary for JSON-LD test cases" ; + dc:creator "Gregg Kellogg" ; + dc:publisher "W3C Linked JSON Community Group" ; + dc:title "Test case manifest vocabulary extensions" ; + dc:description "Test case manifest vocabulary extensions" ; + dc:date "2013-09-23" ; + dc:identifier : . + +## ---- Test Case Classes --- + +:Test a rdfs:Class ; + rdfs:label "Superclass of all JSON-LD tests" ; + rdfs:comment """ + All JSON-LD tests have an input file referenced using + `mf:action` (aliased as "input" in test manifest). + Positive and Negative Evaluation Tests also have a result file + referenced using `mf:result` (aliased as "expect" in test manifest). + Other tests may take different inputs and options as defined for each test class. + Tests should be run with the processingMode option set to "json-ld-1.1", + unless specified explicitly as a test option. + """ . + +:PositiveEvaluationTest a rdfs:Class ; + rdfs:label "Positive Evaluation Test" ; + rdfs:subClassOf :Test ; + rdfs:comment """ + A Positive Evaluation test is successful when the result of processing + the input file specified as `mf:action` (aliased as "input" in test manifest) + exactly matches the output file specified as + `mf:result` (aliased as "expect" in test manifest) using the comparison defined in + another class. The specifics of invoking test, including the interpretation of options + (`:option`) and other input files are specified through another class. + """ . + +:NegativeEvaluationTest a rdfs:Class ; + rdfs:label "Positive Evaluation Test" ; + rdfs:subClassOf :Test ; + rdfs:comment """ + A Negative Evaluation test is successful when the result of processing + the input file specified as `mf:action` (aliased as "input" in test manifest) + results in the error identified by the literal value of + `mf:result` (aliased as "expect" in test manifest). + The specifics of invoking test, including + the interpretation of options (`:option`) and other input files are + specified through another class. + See the [README](https://w3c.github.io/json-ld-api/tests/) for more details on running tests. + """ . + +:PositiveSyntaxTest a rdfs:Class ; + rdfs:subClassOf :Test ; + rdfs:label "Positive Syntax Test" ; + rdfs:comment """ + A type of test specifically for syntax testing. + Syntax tests are not required to have an associated result, only an action. + """ . + +:NegativeSyntaxTest a rdfs:Class ; + rdfs:subClassOf :Test ; + rdfs:label "Negative Syntax Test" ; + rdfs:comment """ + A type of test specifically for syntax testing. + Syntax tests are not required to have an associated result, only an action. + Negative syntax tests are tests of which the result should be a parser error. + """ . + +:CompactTest a rdfs:Class ; + rdfs:subClassOf :Test ; + rdfs:label "Compact Evaluation Test" ; + rdfs:comment """ + A `CompactTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, + `PositiveSyntaxTest` or `NegativeSyntaxTest`. + """ . + +:ExpandTest a rdfs:Class ; + rdfs:subClassOf :Test ; + rdfs:label "Expand Evaluation Test" ; + rdfs:comment """ + A `ExpandTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, + `PositiveSyntaxTest` or `NegativeSyntaxTest`. + """ . + +:FlattenTest a rdfs:Class ; + rdfs:subClassOf :Test ; + rdfs:label "Flatten Evaluation Test" ; + rdfs:comment """ + A `FlattenTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, + `PositiveSyntaxTest` or `NegativeSyntaxTest`. + """ . + +:FrameTest a rdfs:Class ; + rdfs:subClassOf :Test ; + rdfs:label "Frame Evaluation Test" ; + rdfs:comment """ + A `FrameTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, + `PositiveSyntaxTest` or `NegativeSyntaxTest`. + """ . + +:FromRDFTest a rdfs:Class ; + rdfs:subClassOf :Test ; + rdfs:label "From RDF Evaluation Test" ; + rdfs:comment """ + A `FromRDFTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, + `PositiveSyntaxTest` or `NegativeSyntaxTest`. + """ . + +:HttpTest a rdfs:Class ; + rdfs:subClassOf :Test ; + rdfs:label "HTTP Evaluation Test" ; + rdfs:comment """ + An `HttpTest` modifies either a `PositiveEvaluationTest` or `NegativeEvaluationTest`. + """ . + +:ToRDFTest a rdfs:Class ; + rdfs:subClassOf :Test ; + rdfs:label "To RDF Evaluation Test" ; + rdfs:comment """ + A `ToRDFTest` modifies either a `PositiveEvaluationTest`, `NegativeEvaluationTest`, + `PositiveSyntaxTest` or `NegativeSyntaxTest`. + """ . + +:Option a rdfs:Class ; + rdfs:label "Processor Options" ; + rdfs:comment "Options passed to the test runner to affect invocation of the appropriate API method." . + +## ---- Property declarations for each test ---- + +:input a rdf:Property ; + rdfs:label "input"; + rdfs:comment "Secondary input file" ; + rdfs:domain :Test ; + rdfs:range rdfs:Resource . + +:context a rdf:Property ; + rdfs:label "context"; + rdfs:comment "A context that is used for transforming the input document." ; + rdfs:domain :Test ; + rdfs:range rdfs:Resource . + +:frame a rdf:Property ; + rdfs:label "input"; + rdfs:comment "A frame that is used for transforming the input document." ; + rdfs:domain :Test ; + rdfs:range rdfs:Resource . + +:option a rdf:Property ; + rdfs:label "option"; + rdfs:comment "Options affecting processing" ; + rdfs:domain :Test ; + rdfs:range :Option . + +:base a rdf:Property ; + rdfs:label "base"; + rdfs:comment """ + The base IRI to use when expanding or compacting the document. + If set, this overrides the input document's IRI. + """ ; + rdfs:domain :Option ; + rdfs:range rdfs:Resource . + +:compactArrays a rdf:Property ; + rdfs:label "compact arrays"; + rdfs:comment """ + If set to `true`, the JSON-LD processor replaces arrays with just one element + with that element during compaction. + If set to false, all arrays will remain arrays even if they have just one element. + """ ; + rdfs:domain :Option ; + rdfs:range xsd:boolean . + +:compactToRelative a rdf:Property ; + rdfs:label "compact to relative"; + rdfs:comment """ + If set to `false`, the JSON-LD processor will not attempt to compact using document-relative IRIs. + """ ; + rdfs:domain :Option ; + rdfs:range xsd:boolean . + +:expandContext a rdf:Property ; + rdfs:label "expand context"; + rdfs:comment "A context that is used to initialize the active context when expanding a document." ; + rdfs:domain :Option ; + rdfs:range rdfs:Resource . + +:processingMode a rdf:Property ; + rdfs:label "processing mode"; + rdfs:comment """ + If set to "json-ld-1.1", the JSON-LD processor must produce exactly the same results as + the algorithms defined in this specification. + If set to another value, the JSON-LD processor is allowed to extend or modify + the algorithms defined in this specification to enable application-specific optimizations. + The definition of such optimizations is beyond the scope of this specification and thus not defined. + Consequently, different implementations may implement different optimizations. + Developers must not define modes beginning with json-ld as they are reserved for future versions of this specification. + """ ; + rdfs:domain :Option ; + rdfs:range xsd:string . + +:produceGeneralizedRdf a rdf:Property ; + rdfs:label "produce generalized RDF"; + rdfs:comment "Unless the produce generalized RDF flag is set to true, RDF triples containing a blank node predicate are excluded from output." ; + rdfs:domain :Option ; + rdfs:range xsd:boolean . + +:useNativeTypes a rdf:Property ; + rdfs:label "use native types"; + 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 :Option ; + rdfs:range xsd:boolean . + +:useRdfType a rdf:Property ; + rdfs:label "use RDF types"; + rdfs:comment """ + If the _use rdf type_ flag is set to `true`, statements with an `rdf:type` predicate + will not use `@type`, but will be transformed as a normal property. + """ ; + rdfs:domain :Option ; + rdfs:range xsd:boolean . + +:contentType a rdf: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 :Option ; + rdfs:range xsd:boolean . + +:redirectTo a rdf: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 :Option ; + rdfs:range xsd:boolean . + +:httpAccept a rdf:Property ; + rdfs:label "HTTP Accept"; + rdfs:comment """ + An HTTP Accept header. + """ ; + rdfs:domain :Option ; + rdfs:range xsd:boolean . + +:httpLink a rdf:Property ; + rdfs:label "HTTP link"; + rdfs:comment """ + An HTTP Link header to be added to the result of requesting the input file. + """ ; + rdfs:domain :Option ; + rdfs:range xsd:boolean . + +:httpStatus a rdf: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 :Option ; + rdfs:range xsd:boolean . + +:specVersion a rdf:Property ; + rdfs:label "spec version"; + rdfs:comment """ + Indicates the JSON-LD version to which the test applies, rather than the + specific processing mode. Values are "json-ld-1.0", and "json-ld-1.1". If not set, the + test is presumed to be valid for all versions of JSON-LD. In cases where + results differ between spec versions for the same test, the test will have + both a "1.0" and "1.1" version, for example. + """ ; + rdfs:domain :Option ; + rdfs:range xsd:string . diff --git a/tests/vocab_context.jsonld b/tests/vocab_context.jsonld new file mode 100644 index 00000000..5d70a83f --- /dev/null +++ b/tests/vocab_context.jsonld @@ -0,0 +1,15 @@ +{ + "@context": { + "rdfs": "http://www.w3.org/2000/01/rdf-schema#", + "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + "dc": "http://purl.org/dc/elements/1.1/", + "mf": "http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#", + "xsd": "http://www.w3.org/2001/XMLSchema#", + "jld": "https://json-ld.org/test-suite/vocab#", + "jld:Test": {"@type": "@id"}, + "dc:identifier": {"@type": "@id"}, + "rdfs:subClassOf": {"@type": "@id"}, + "rdfs:domain": {"@type": "@id"}, + "rdfs:range": {"@type": "@id"} + } +} \ No newline at end of file diff --git a/tests/vocab_template.haml b/tests/vocab_template.haml new file mode 100644 index 00000000..9c2243e1 --- /dev/null +++ b/tests/vocab_template.haml @@ -0,0 +1,39 @@ +%html{lang: :en} + %head + %meta{charset: 'utf-8'} + %title<= ontology['dc:title'] + %link{href: "http://www.w3.org/StyleSheets/2016/base.css", rel: :stylesheet} + %script{type: 'application/ld+json'} + = source + %body + %h1<=ontology['dc:title'] + %p< + %a{href: 'http://www.w3.org/'}< + %img(src="http://www.w3.org/Icons/w3c_home" alt="W3C" height="48" width="72") + %p + Alternate versions of the test vocabulary definition exist in + %a(rel="alternate" href="vocab.ttl")<="Turtle" + and + = " " + %a(rel="alternate" href="vocab.jsonld")<>="JSON-LD" + = "." + %section + %h2<="Test Case Classes" + %dl + - classes.each do |cls| + %dt< + %strong<~cls["rdfs:label"] + %dd< + :markdown + #{cls["rdfs:comment"].to_s.gsub(/^\s+/, '')} + %section + %h2<="Test Case Properties" + %dl + - properties.each do |prop| + %dt< + %strong<~prop["rdfs:label"] + %dd< + :markdown + #{prop["rdfs:comment"].to_s.gsub(/^\s+/, '')} + %footer + %span<= ontology["dc:publisher"]