From d8cab238d36c7678523a4c44533c7f9f4c33d872 Mon Sep 17 00:00:00 2001 From: Pieter Colpaert Date: Mon, 17 Feb 2025 15:28:48 +0100 Subject: [PATCH 01/18] Added first test cases for init --- .github/workflows/Build-test-spec.yml | 29 +++++++++++++ 04-tests.bs | 61 +++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 .github/workflows/Build-test-spec.yml create mode 100644 04-tests.bs diff --git a/.github/workflows/Build-test-spec.yml b/.github/workflows/Build-test-spec.yml new file mode 100644 index 0000000..acf7f18 --- /dev/null +++ b/.github/workflows/Build-test-spec.yml @@ -0,0 +1,29 @@ +name: Build TREE discovery spec +on: + workflow_dispatch: {} + pull_request: {} + push: + branches: [master] +jobs: + main: + name: Build, Validate and Deploy + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v3 + - uses: w3c/spec-prod@v2 + with: + TOOLCHAIN: bikeshed + + # Modify as appropriate + GH_PAGES_BRANCH: gh-pages + + # if your doc isn’t in the root folder, + # or Bikeshed otherwise can’t find it: + SOURCE: 04-tests.bs + + # output filename defaults to your input + # with .html extension instead, + # but if you want to customize it: + DESTINATION: tests.html diff --git a/04-tests.bs b/04-tests.bs new file mode 100644 index 0000000..54e1408 --- /dev/null +++ b/04-tests.bs @@ -0,0 +1,61 @@ +
+Title: TREE client tests
+Shortname: tests
+Level: 1
+Status: w3c/CG-DRAFT
+Markup Shorthands: markdown yes
+URL: https://w3id.org/tree/specification/tests
+Repository: https://github.com/treecg/specification
+Mailing List: public-treecg@w3.org
+Mailing List Archives: https://lists.w3.org/Archives/Public/public-treecg/
+Editor: Pieter Colpaert, https://pietercolpaert.be
+Abstract:
+	A set of tests for testing compliance of clients to the TREE specification.
+
+ +# Tests # {#overview} + +## 01. Initialization ## {#01} + +This test is about a function `initialization(url)`. The function will return a the collection and the URL of the root node. + +We’ll test this with various URLs containing different contents. + +### 01.1 The URL to a rootnode without redirects ### {#01.1} + +File url `test01.1.ttl` + +```turtle +@prefix tree: . + tree:view . +``` + +Returns: + * Collection: + * Root node: + +### 01.2 The URL to a collection without redirects ### {#01.2} + +File url `test01.2.ttl#collection` + +```turtle +@prefix tree: . + tree:view . +``` + +Returns: + * Collection: + * Root node: + +### 01.3 The URL to a rootnode before redirects ### {#01.1} + +File url `test01.3` should redirect to `test01.3.ttl` + +```turtle +@prefix tree: . + tree:view . +``` + +Returns: + * Collection: + * Root node: From 1f4f7a2fc7c06489229a9c3519310ae7c1f164ad Mon Sep 17 00:00:00 2001 From: Pieter Colpaert Date: Mon, 17 Feb 2025 15:30:01 +0100 Subject: [PATCH 02/18] Correct title --- .github/workflows/Build-test-spec.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Build-test-spec.yml b/.github/workflows/Build-test-spec.yml index acf7f18..b6df631 100644 --- a/.github/workflows/Build-test-spec.yml +++ b/.github/workflows/Build-test-spec.yml @@ -1,4 +1,4 @@ -name: Build TREE discovery spec +name: Build TREE tests spec on: workflow_dispatch: {} pull_request: {} From 85b979a1123c57e826a7dba88262251dc00ce881 Mon Sep 17 00:00:00 2001 From: Pieter Colpaert Date: Mon, 17 Feb 2025 15:33:19 +0100 Subject: [PATCH 03/18] Minor fixes --- 04-tests.bs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/04-tests.bs b/04-tests.bs index 54e1408..11a6238 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -31,8 +31,8 @@ File url `test01.1.ttl` ``` Returns: - * Collection: - * Root node: + * Collection: `` + * Root node: `` ### 01.2 The URL to a collection without redirects ### {#01.2} @@ -44,10 +44,10 @@ File url `test01.2.ttl#collection` ``` Returns: - * Collection: - * Root node: + * Collection: `` + * Root node: `` -### 01.3 The URL to a rootnode before redirects ### {#01.1} +### 01.3 The URL to a rootnode before redirects ### {#01.3} File url `test01.3` should redirect to `test01.3.ttl` @@ -57,5 +57,5 @@ File url `test01.3` should redirect to `test01.3.ttl` ``` Returns: - * Collection: - * Root node: + * Collection: `` + * Root node: `` From 2c00a26cf2cb0be8fa935f62dda4244c63dc8cc8 Mon Sep 17 00:00:00 2001 From: Pieter Colpaert Date: Mon, 24 Feb 2025 15:25:24 +0100 Subject: [PATCH 04/18] Test cases further worked out --- 04-tests.bs | 95 +++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 81 insertions(+), 14 deletions(-) diff --git a/04-tests.bs b/04-tests.bs index 11a6238..09d5d50 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -15,47 +15,114 @@ Abstract: # Tests # {#overview} -## 01. Initialization ## {#01} +## 1. Initialization ## {#1} + +Purpose: Ensuring that it is unambiguous yet user friendly way of knowing the identifier of the collection, as well as the current page of the collection’s view. This test is about a function `initialization(url)`. The function will return a the collection and the URL of the root node. We’ll test this with various URLs containing different contents. -### 01.1 The URL to a rootnode without redirects ### {#01.1} +### 1.1 The URL to a rootnode without redirects ### {#1.1} -File url `test01.1.ttl` +File url `test1.1.ttl` ```turtle @prefix tree: . - tree:view . + tree:view . ``` Returns: * Collection: `` - * Root node: `` + * Root node: `` -### 01.2 The URL to a collection without redirects ### {#01.2} +### 1.2 The URL to a collection without redirects ### {#1.2} -File url `test01.2.ttl#collection` +File url `test1.2.ttl#collection` ```turtle @prefix tree: . - tree:view . + tree:view . ``` Returns: - * Collection: `` - * Root node: `` + * Collection: `` + * Root node: `` -### 01.3 The URL to a rootnode before redirects ### {#01.3} +### 1.3 The URL to a rootnode before redirects ### {#1.3} -File url `test01.3` should redirect to `test01.3.ttl` +File url `test1.3` should redirect to `test1.3.ttl` ```turtle @prefix tree: . - tree:view . + tree:view . ``` Returns: * Collection: `` - * Root node: `` + * Root node: `` + +TODO: Search forms + +## 2. Members ## {#2} + +Goal: Once we have the container URL, we must ensure we know what the members of the collection mentioned in this page are. + +### 2.1 Finding member IRIs ### {#2.1} + +File url `` + +Operation: Finding the set of members in ``. + +```turtle +@prefix tree: . + tree:view ; + tree:member , , _:b0 . +``` + +Returns: + * 2 member identifiers ``, `` and a blank node member. + +### 2.2 Empty page ### {#2.2} + +File url `` + +Operation: Finding the set of members in ``. + +```turtle +@prefix tree: . + tree:view . +``` + +Returns: an empty set. + +## 3. Extracting members ## {#3} + +Goal: Checking whether your implementation will extract the right set of quads + + +### 3.1 Star pattern ### {#3.1} + +File url `` + +Operation: Finding all quads that belong to ``. + +```turtle +@prefix tree: . +@prefix ex: . + tree:view ; + tree:member . + ex:p ex:o . +``` + +Returns: an array with 1 quad ` ex:p ex:o`. + +TODO: take more tests from the extract cbd shape repository + +## 4. Pruning relations ## {#4} + +TODO: These test cases will get more complex + +## 5. Using search forms ## {#5} + +TODO: Search forms \ No newline at end of file From d41525288f88102d94da3b2547277b20ffdc495e Mon Sep 17 00:00:00 2001 From: Pieter Colpaert Date: Mon, 3 Mar 2025 14:19:15 +0100 Subject: [PATCH 05/18] Remove chapter numbers --- 04-tests.bs | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/04-tests.bs b/04-tests.bs index 09d5d50..b0336ba 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -15,7 +15,7 @@ Abstract: # Tests # {#overview} -## 1. Initialization ## {#1} +## Initialization ## {#1} Purpose: Ensuring that it is unambiguous yet user friendly way of knowing the identifier of the collection, as well as the current page of the collection’s view. @@ -23,7 +23,7 @@ This test is about a function `initialization(url)`. The function will return a We’ll test this with various URLs containing different contents. -### 1.1 The URL to a rootnode without redirects ### {#1.1} +### The URL to a rootnode without redirects ### {#1.1} File url `test1.1.ttl` @@ -36,7 +36,7 @@ Returns: * Collection: `` * Root node: `` -### 1.2 The URL to a collection without redirects ### {#1.2} +### The URL to a collection without redirects ### {#1.2} File url `test1.2.ttl#collection` @@ -49,7 +49,7 @@ Returns: * Collection: `` * Root node: `` -### 1.3 The URL to a rootnode before redirects ### {#1.3} +### The URL to a rootnode before redirects ### {#1.3} File url `test1.3` should redirect to `test1.3.ttl` @@ -64,11 +64,11 @@ Returns: TODO: Search forms -## 2. Members ## {#2} +## Members ## {#2} Goal: Once we have the container URL, we must ensure we know what the members of the collection mentioned in this page are. -### 2.1 Finding member IRIs ### {#2.1} +### Finding member IRIs ### {#2.1} File url `` @@ -83,7 +83,7 @@ Operation: Finding the set of members in ``. Returns: * 2 member identifiers ``, `` and a blank node member. -### 2.2 Empty page ### {#2.2} +### Empty page ### {#2.2} File url `` @@ -96,12 +96,12 @@ Operation: Finding the set of members in ``. Returns: an empty set. -## 3. Extracting members ## {#3} +## Extracting members ## {#3} Goal: Checking whether your implementation will extract the right set of quads -### 3.1 Star pattern ### {#3.1} +### Star pattern ### {#3.1} File url `` @@ -119,10 +119,10 @@ Returns: an array with 1 quad ` ex:p ex:o`. TODO: take more tests from the extract cbd shape repository -## 4. Pruning relations ## {#4} +## Pruning relations ## {#4} TODO: These test cases will get more complex -## 5. Using search forms ## {#5} +## Using search forms ## {#5} TODO: Search forms \ No newline at end of file From 8c2e50b6c8d4539c8a34998b9f5e8a7bc8e43b1d Mon Sep 17 00:00:00 2001 From: Pieter Colpaert Date: Mon, 31 Mar 2025 12:24:44 +0200 Subject: [PATCH 06/18] Update 04-tests.bs Co-authored-by: Ieben Smessaert --- 04-tests.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/04-tests.bs b/04-tests.bs index b0336ba..1c517d8 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -17,7 +17,7 @@ Abstract: ## Initialization ## {#1} -Purpose: Ensuring that it is unambiguous yet user friendly way of knowing the identifier of the collection, as well as the current page of the collection’s view. +Purpose: Ensuring that there is an unambiguous yet user friendly way of knowing the identifier of the collection, as well as the current page of the collection’s view. This test is about a function `initialization(url)`. The function will return a the collection and the URL of the root node. From cb1c0f564c2cbef5962c208a182f158368f41496 Mon Sep 17 00:00:00 2001 From: Pieter Colpaert Date: Mon, 31 Mar 2025 12:24:54 +0200 Subject: [PATCH 07/18] Update 04-tests.bs Co-authored-by: Ieben Smessaert --- 04-tests.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/04-tests.bs b/04-tests.bs index 1c517d8..4656e64 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -19,7 +19,7 @@ Abstract: Purpose: Ensuring that there is an unambiguous yet user friendly way of knowing the identifier of the collection, as well as the current page of the collection’s view. -This test is about a function `initialization(url)`. The function will return a the collection and the URL of the root node. +This test is about a function `initialization(url)`. The function will return the URL of the collection and the URL of the root node. We’ll test this with various URLs containing different contents. From d8919afd3eebfb3682061fec3e2b15650b384b81 Mon Sep 17 00:00:00 2001 From: Pieter Colpaert Date: Mon, 31 Mar 2025 12:26:36 +0200 Subject: [PATCH 08/18] Apply suggestions from code review Co-authored-by: Ieben Smessaert --- 04-tests.bs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/04-tests.bs b/04-tests.bs index 4656e64..57f3ca2 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -25,7 +25,9 @@ We’ll test this with various URLs containing different contents. ### The URL to a rootnode without redirects ### {#1.1} -File url `test1.1.ttl` +**Test:** Initializing with the URL to a rootnode without redirects returns the Collection URL and Root node URL + +File URL `test1.1.ttl` ```turtle @prefix tree: . From 8f7835ff8b7986a5f5210de2a256b7d83c902fa2 Mon Sep 17 00:00:00 2001 From: Pieter Colpaert Date: Mon, 31 Mar 2025 12:53:11 +0200 Subject: [PATCH 09/18] Further tests based on code review --- 04-tests.bs | 73 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 24 deletions(-) diff --git a/04-tests.bs b/04-tests.bs index 57f3ca2..bdce8bc 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -8,63 +8,88 @@ URL: https://w3id.org/tree/specification/tests Repository: https://github.com/treecg/specification Mailing List: public-treecg@w3.org Mailing List Archives: https://lists.w3.org/Archives/Public/public-treecg/ -Editor: Pieter Colpaert, https://pietercolpaert.be +Editor: + - Pieter Colpaert, https://pietercolpaert.be + - Xueying Deng Abstract: A set of tests for testing compliance of clients to the TREE specification. # Tests # {#overview} +In the test snippets below, the URL will always be relative. You can decide your own base IRI for all of the HTTP requests and relative IRIs in your test framework. + ## Initialization ## {#1} Purpose: Ensuring that there is an unambiguous yet user friendly way of knowing the identifier of the collection, as well as the current page of the collection’s view. This test is about a function `initialization(url)`. The function will return the URL of the collection and the URL of the root node. -We’ll test this with various URLs containing different contents. +We will test this with various URLs containing different contents. -### The URL to a rootnode without redirects ### {#1.1} +### The URL to a root node without redirects ### {#1.1} -**Test:** Initializing with the URL to a rootnode without redirects returns the Collection URL and Root node URL +**Test:** Initializing with the URL to a root node without redirects returns the Collection URL and Root node URL. -File URL `test1.1.ttl` +File URL `test1.1.ttl`. ```turtle @prefix tree: . tree:view . ``` -Returns: +The test executes an HTTP request to `test1.1.ttl`. The algorithm returns: * Collection: `` * Root node: `` ### The URL to a collection without redirects ### {#1.2} -File url `test1.2.ttl#collection` +**Test:** Initializing with the URL to a collection IRI without redirects returns the Collection IRI and root node URL. + +Contents of the file `test1.2.ttl`: ```turtle @prefix tree: . - tree:view . + tree:view . ``` -Returns: - * Collection: `` +The test executes an HTTP request to `test1.2.ttl#Collection`. The algorithm returns: + * Collection: `` * Root node: `` -### The URL to a rootnode before redirects ### {#1.3} +### The URL to a root node before redirects ### {#1.3} + +**Test:** Initializing with the URL to a collection IRI that results in a redirect, still returns the Collection IRI and root node URL. -File url `test1.3` should redirect to `test1.3.ttl` +File url `test1.3` that provides a `303 See Other` redirect to `test1.3.ttl`. ```turtle @prefix tree: . tree:view . ``` -Returns: +The test executes an HTTP request to `test1.3`. The algorithm returns: * Collection: `` * Root node: `` -TODO: Search forms +The same test MUST be repeated with a `301` response code. + +### The URL that does not match ### {#1.4} + +**Test:** Initializing with a URL that does not match a collection or a root node must result into an exception. + +File url `test1.4.ttl`: + +```turtle +@prefix tree: . + tree:view . +``` + +The test executes an HTTP request to `test1.4.ttl#NonExistingNodeOrCollection`. The algorithm returns an exception that indicates the requested root node or collection is not described in the response. + +### Search Forms ### {#1.x} + +This is yet to be defined: the search forms should also be extracted. ## Members ## {#2} @@ -72,9 +97,9 @@ Goal: Once we have the container URL, we must ensure we know what the members of ### Finding member IRIs ### {#2.1} -File url `` +**Test:** Finding both named node and blank node member terms in a page. -Operation: Finding the set of members in ``. +File url `` contains: ```turtle @prefix tree: . @@ -82,21 +107,19 @@ Operation: Finding the set of members in ``. tree:member , , _:b0 . ``` -Returns: - * 2 member identifiers ``, `` and a blank node member. +The test suite executes the function to find all member identifiers in the page `` of the collection `` and returns 2 member identifiers ``, `` and a blank node member. ### Empty page ### {#2.2} -File url `` +**Test:** Finding no member terms in a page when there are none. -Operation: Finding the set of members in ``. +File url `` ```turtle @prefix tree: . tree:view . ``` - -Returns: an empty set. +The test to find the set of members in the page `` of the collection `` returns an empty set. ## Extracting members ## {#3} @@ -105,6 +128,8 @@ Goal: Checking whether your implementation will extract the right set of quads ### Star pattern ### {#3.1} +**Test:** Finding all quads that belong to a member based on a simple star pattern. + File url `` Operation: Finding all quads that belong to ``. @@ -119,7 +144,7 @@ Operation: Finding all quads that belong to ``. Returns: an array with 1 quad ` ex:p ex:o`. -TODO: take more tests from the extract cbd shape repository +TODO: take more tests from the [extract cbd shape repository](https://github.com/TREEcg/extract-cbd-shape) ## Pruning relations ## {#4} @@ -127,4 +152,4 @@ TODO: These test cases will get more complex ## Using search forms ## {#5} -TODO: Search forms \ No newline at end of file +TODO: Search forms From 5a5af5ff9ab7a3ec46960152069f69d0c2b16dce Mon Sep 17 00:00:00 2001 From: Xueying Deng Date: Thu, 22 May 2025 16:11:22 +0200 Subject: [PATCH 10/18] feat: update test specification - Restructured the documentation to create a narrative. - Addressed my concern regarding the comment left in [issue #141](https://github.com/TREEcg/specification/issues/141), questioning whether this specification is ONLY focused on client behavior. - OFC, a work in progress --- 04-tests.bs | 57 +++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 40 insertions(+), 17 deletions(-) diff --git a/04-tests.bs b/04-tests.bs index bdce8bc..300630d 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -1,5 +1,5 @@ +# Overview # {#overview} -# Tests # {#overview} +The TREE specification follows the [RFC 2119](https://www.rfc-editor.org/rfc2119.txt) norms for defining conformance requirements. +This document lists all conformance points from the TREE specification, and provides corresponding test cases, test environments, and expected results for implementations. + + +## Conformance ## {#conformance} + +The conformance points in this document are based on the [TREE specification](https://w3c.github.io/treecg/specification/) and are intended for testing implementations of the TREE specification. +Conformance points are divided into two categories: **MUST** and **SHOULD**. + +Each conformance point is described in detail, including the expected behavior of the implementation and the test cases used to verify compliance. + +- **MUST** conformance points are mandatory for all implementations. Implementations that do not meet these requirements are not considered compliant with the specification. +- **SHOULD** conformance points are optional but recommended. Implementations that do not meet these requirements may still be considered compliant, but may not provide the same level of functionality or interoperability. + + +## MUST Conformance Points## {#must} + + -## Initialization ## {#1} +### Initialization ### {#1} Purpose: Ensuring that there is an unambiguous yet user friendly way of knowing the identifier of the collection, as well as the current page of the collection’s view. @@ -27,7 +50,7 @@ This test is about a function `initialization(url)`. The function will return th We will test this with various URLs containing different contents. -### The URL to a root node without redirects ### {#1.1} +#### The URL to a root node without redirects #### {#1.1} **Test:** Initializing with the URL to a root node without redirects returns the Collection URL and Root node URL. @@ -42,7 +65,7 @@ The test executes an HTTP request to `test1.1.ttl`. The algorithm returns: * Collection: `` * Root node: `` -### The URL to a collection without redirects ### {#1.2} +#### The URL to a collection without redirects #### {#1.2} **Test:** Initializing with the URL to a collection IRI without redirects returns the Collection IRI and root node URL. @@ -57,7 +80,7 @@ The test executes an HTTP request to `test1.2.ttl#Collection`. The algorithm ret * Collection: `` * Root node: `` -### The URL to a root node before redirects ### {#1.3} +#### The URL to a root node before redirects #### {#1.3} **Test:** Initializing with the URL to a collection IRI that results in a redirect, still returns the Collection IRI and root node URL. @@ -74,7 +97,7 @@ The test executes an HTTP request to `test1.3`. The algorithm returns: The same test MUST be repeated with a `301` response code. -### The URL that does not match ### {#1.4} +#### The URL that does not match #### {#1.4} **Test:** Initializing with a URL that does not match a collection or a root node must result into an exception. @@ -87,15 +110,15 @@ File url `test1.4.ttl`: The test executes an HTTP request to `test1.4.ttl#NonExistingNodeOrCollection`. The algorithm returns an exception that indicates the requested root node or collection is not described in the response. -### Search Forms ### {#1.x} +#### Search Forms #### {#1.x} This is yet to be defined: the search forms should also be extracted. -## Members ## {#2} +### Members ## {#2} Goal: Once we have the container URL, we must ensure we know what the members of the collection mentioned in this page are. -### Finding member IRIs ### {#2.1} +#### Finding member IRIs #### {#2.1} **Test:** Finding both named node and blank node member terms in a page. @@ -109,7 +132,7 @@ File url `` contains: The test suite executes the function to find all member identifiers in the page `` of the collection `` and returns 2 member identifiers ``, `` and a blank node member. -### Empty page ### {#2.2} +#### Empty page #### {#2.2} **Test:** Finding no member terms in a page when there are none. @@ -121,12 +144,12 @@ File url `` ``` The test to find the set of members in the page `` of the collection `` returns an empty set. -## Extracting members ## {#3} +### Extracting members ### {#3} Goal: Checking whether your implementation will extract the right set of quads -### Star pattern ### {#3.1} +#### Star pattern #### {#3.1} **Test:** Finding all quads that belong to a member based on a simple star pattern. @@ -146,10 +169,10 @@ Returns: an array with 1 quad ` ex:p ex:o`. TODO: take more tests from the [extract cbd shape repository](https://github.com/TREEcg/extract-cbd-shape) -## Pruning relations ## {#4} +### Pruning relations ### {#4} TODO: These test cases will get more complex -## Using search forms ## {#5} +### Using search forms ### {#5} TODO: Search forms From 6d213bee21e97e2e2c4af56f91921a43d08c1060 Mon Sep 17 00:00:00 2001 From: Xueying Deng Date: Thu, 19 Jun 2025 16:37:11 +0200 Subject: [PATCH 11/18] Update 04-tests.bs --- 04-tests.bs | 219 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 131 insertions(+), 88 deletions(-) diff --git a/04-tests.bs b/04-tests.bs index 300630d..4430029 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -22,157 +22,200 @@ This document lists all conformance points from the TREE specification, and prov ## Conformance ## {#conformance} The conformance points in this document are based on the [TREE specification](https://w3c.github.io/treecg/specification/) and are intended for testing implementations of the TREE specification. + +As TREE is based on hypermedia, the conformance is designed for HTTP-based implementation, the test cases are designed to be executed over HTTP(s), and the expected results are based on the HTTP(s) responses. + Conformance points are divided into two categories: **MUST** and **SHOULD**. -Each conformance point is described in detail, including the expected behavior of the implementation and the test cases used to verify compliance. +Each conformance point is described in detail, including the expected behavior of the implementation. The test cases used to verify compliance are also provided. - **MUST** conformance points are mandatory for all implementations. Implementations that do not meet these requirements are not considered compliant with the specification. - **SHOULD** conformance points are optional but recommended. Implementations that do not meet these requirements may still be considered compliant, but may not provide the same level of functionality or interoperability. - + ## MUST Conformance Points## {#must} +### TREE basic elements ### {#1.1} + +- When there is a `tree:view` in the payload of the current HTTP response, the subject of the `tree:view` must be a `tree:Collection` + +```turtle +@prefix sh: . +@prefix tree: . +@prefix rdf: . + +# SHACL Node Shape to validate that any subject having tree:view must be a tree:Collection + +<#TreeViewSubjectMustBeCollectionShape> + a sh:NodeShape ; + sh:targetSubjectsOf tree:view ; + sh:property [ + sh:path rdf:type ; + sh:hasValue tree:Collection ; + sh:message "Subjects that have a tree:view must be a tree:Collection." ; + ] . + +``` + +- When there is a `tree:member` in the payload of the current HTTP response, the subject of the `tree:member` must be a `tree:Collection` or a `tree:RootNode` +- When there is a `tree:Relation` in the payload of the current HTTP response, the subject of the `tree:Relation` must also point to a `tree:path` + +### Initialization ### {#1.2} +### The member extraction algorithm ### {#1.3} +### Traversing the search tree ### {#1.4} +### Pruning branches ### {#1.5} + + + +## SHOULD Conformance Points## {#must} + +### Initialization ### {#2.1} +### The member extraction algorithm ### {#2.2} +### Traversing the search tree ### {#2.3} +### Pruning branches ### {#2.4} + +// In the test snippets below, the URL will always be relative. You can decide your own base IRI for all of the HTTP requests and relative IRIs in your test framework. -### Initialization ### {#1} -Purpose: Ensuring that there is an unambiguous yet user friendly way of knowing the identifier of the collection, as well as the current page of the collection’s view. +// ### Initialization ### {#1} -This test is about a function `initialization(url)`. The function will return the URL of the collection and the URL of the root node. +// Purpose: Ensuring that there is an unambiguous yet user friendly way of knowing the identifier of the collection, as well as the current page of the collection’s view. -We will test this with various URLs containing different contents. +// This test is about a function `initialization(url)`. The function will return the URL of the collection and the URL of the root node. -#### The URL to a root node without redirects #### {#1.1} +// We will test this with various URLs containing different contents. -**Test:** Initializing with the URL to a root node without redirects returns the Collection URL and Root node URL. +// #### The URL to a root node without redirects #### {#1.1} -File URL `test1.1.ttl`. +// **Test:** Initializing with the URL to a root node without redirects returns the Collection URL and Root node URL. -```turtle -@prefix tree: . - tree:view . -``` +// File URL `test1.1.ttl`. -The test executes an HTTP request to `test1.1.ttl`. The algorithm returns: - * Collection: `` - * Root node: `` +// ```turtle +// @prefix tree: . +// tree:view . +// ``` -#### The URL to a collection without redirects #### {#1.2} +// The test executes an HTTP request to `test1.1.ttl`. The algorithm returns: +// * Collection: `` +// * Root node: `` -**Test:** Initializing with the URL to a collection IRI without redirects returns the Collection IRI and root node URL. +// #### The URL to a collection without redirects #### {#1.2} -Contents of the file `test1.2.ttl`: +// **Test:** Initializing with the URL to a collection IRI without redirects returns the Collection IRI and root node URL. -```turtle -@prefix tree: . - tree:view . -``` +// Contents of the file `test1.2.ttl`: -The test executes an HTTP request to `test1.2.ttl#Collection`. The algorithm returns: - * Collection: `` - * Root node: `` +// ```turtle +// @prefix tree: . +// tree:view . +// ``` -#### The URL to a root node before redirects #### {#1.3} +// The test executes an HTTP request to `test1.2.ttl#Collection`. The algorithm returns: +// * Collection: `` +// * Root node: `` -**Test:** Initializing with the URL to a collection IRI that results in a redirect, still returns the Collection IRI and root node URL. +// #### The URL to a root node before redirects #### {#1.3} -File url `test1.3` that provides a `303 See Other` redirect to `test1.3.ttl`. +// **Test:** Initializing with the URL to a collection IRI that results in a redirect, still returns the Collection IRI and root node URL. -```turtle -@prefix tree: . - tree:view . -``` +// File url `test1.3` that provides a `303 See Other` redirect to `test1.3.ttl`. -The test executes an HTTP request to `test1.3`. The algorithm returns: - * Collection: `` - * Root node: `` +// ```turtle +// @prefix tree: . +// tree:view . +// ``` -The same test MUST be repeated with a `301` response code. +// The test executes an HTTP request to `test1.3`. The algorithm returns: +// * Collection: `` +// * Root node: `` -#### The URL that does not match #### {#1.4} +// The same test MUST be repeated with a `301` response code. -**Test:** Initializing with a URL that does not match a collection or a root node must result into an exception. +// #### The URL that does not match #### {#1.4} -File url `test1.4.ttl`: +// **Test:** Initializing with a URL that does not match a collection or a root node must result into an exception. -```turtle -@prefix tree: . - tree:view . -``` +// File url `test1.4.ttl`: -The test executes an HTTP request to `test1.4.ttl#NonExistingNodeOrCollection`. The algorithm returns an exception that indicates the requested root node or collection is not described in the response. +// ```turtle +// @prefix tree: . +// tree:view . +// ``` -#### Search Forms #### {#1.x} +// The test executes an HTTP request to `test1.4.ttl#NonExistingNodeOrCollection`. The algorithm returns an exception that indicates the requested root node or collection is not described in the response. -This is yet to be defined: the search forms should also be extracted. +// #### Search Forms #### {#1.x} -### Members ## {#2} +// This is yet to be defined: the search forms should also be extracted. -Goal: Once we have the container URL, we must ensure we know what the members of the collection mentioned in this page are. +// ### Members ## {#2} -#### Finding member IRIs #### {#2.1} +// Goal: Once we have the container URL, we must ensure we know what the members of the collection mentioned in this page are. -**Test:** Finding both named node and blank node member terms in a page. +// #### Finding member IRIs #### {#2.1} -File url `` contains: +// **Test:** Finding both named node and blank node member terms in a page. -```turtle -@prefix tree: . - tree:view ; - tree:member , , _:b0 . -``` +// File url `` contains: -The test suite executes the function to find all member identifiers in the page `` of the collection `` and returns 2 member identifiers ``, `` and a blank node member. +// ```turtle +// @prefix tree: . +// tree:view ; +// tree:member , , _:b0 . +// ``` -#### Empty page #### {#2.2} +// The test suite executes the function to find all member identifiers in the page `` of the collection `` and returns 2 member identifiers ``, `` and a blank node member. -**Test:** Finding no member terms in a page when there are none. +// #### Empty page #### {#2.2} -File url `` +// **Test:** Finding no member terms in a page when there are none. -```turtle -@prefix tree: . - tree:view . -``` -The test to find the set of members in the page `` of the collection `` returns an empty set. +// File url `` -### Extracting members ### {#3} +// ```turtle +// @prefix tree: . +// tree:view . +// ``` +// The test to find the set of members in the page `` of the collection `` returns an empty set. -Goal: Checking whether your implementation will extract the right set of quads +// ### Extracting members ### {#3} +// Goal: Checking whether your implementation will extract the right set of quads -#### Star pattern #### {#3.1} -**Test:** Finding all quads that belong to a member based on a simple star pattern. +// #### Star pattern #### {#3.1} -File url `` +// **Test:** Finding all quads that belong to a member based on a simple star pattern. -Operation: Finding all quads that belong to ``. +// File url `` -```turtle -@prefix tree: . -@prefix ex: . - tree:view ; - tree:member . - ex:p ex:o . -``` +// Operation: Finding all quads that belong to ``. + +// ```turtle +// @prefix tree: . +// @prefix ex: . +// tree:view ; +// tree:member . +// ex:p ex:o . +// ``` -Returns: an array with 1 quad ` ex:p ex:o`. +// Returns: an array with 1 quad ` ex:p ex:o`. -TODO: take more tests from the [extract cbd shape repository](https://github.com/TREEcg/extract-cbd-shape) +// TODO: take more tests from the [extract cbd shape repository](https://github.com/TREEcg/extract-cbd-shape) -### Pruning relations ### {#4} +// ### Pruning relations ### {#4} -TODO: These test cases will get more complex +// TODO: These test cases will get more complex -### Using search forms ### {#5} +// ### Using search forms ### {#5} -TODO: Search forms +// TODO: Search forms +--> \ No newline at end of file From 4b3b299aa2d322400eb5bbf718121bb80f101803 Mon Sep 17 00:00:00 2001 From: Xueying Deng Date: Thu, 19 Jun 2025 17:03:09 +0200 Subject: [PATCH 12/18] Update 04-tests.bs --- 04-tests.bs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/04-tests.bs b/04-tests.bs index 4430029..ae75409 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -60,7 +60,33 @@ Each conformance point is described in detail, including the expected behavior o - When there is a `tree:member` in the payload of the current HTTP response, the subject of the `tree:member` must be a `tree:Collection` or a `tree:RootNode` - When there is a `tree:Relation` in the payload of the current HTTP response, the subject of the `tree:Relation` must also point to a `tree:path` -### Initialization ### {#1.2} +### Search TREE ### {#1.2} +- During the construction of the complete RDF graph of the search tree at any point in the traversal, the inbound link to any tree:Node via a tree:Relation can originate from only one other tree:Node. + +```turtle +@prefix sh: . +@prefix tree: . +@prefix ex: . + +ex:NodeInboundUniquenessShape + a sh:NodeShape ; + sh:targetClass tree:Node ; + sh:sparql [ + a sh:SPARQLConstraint ; + sh:message "Each tree:Node must not be the target of more than one tree:Relation.tree:node link from another node." ; + sh:select """ + SELECT ?this (COUNT(?sourceNode) AS ?inboundCount) + WHERE { + ?sourceNode tree:relation ?relation . + ?relation tree:node ?this . + FILTER (?sourceNode != ?this) + } + GROUP BY ?this + HAVING (COUNT(?sourceNode) > 1) + """ ; + ] . + +```` ### The member extraction algorithm ### {#1.3} ### Traversing the search tree ### {#1.4} ### Pruning branches ### {#1.5} From b3b47fb0c4913eeaedd5d9a79d0b14100539b745 Mon Sep 17 00:00:00 2001 From: XD Date: Fri, 20 Jun 2025 14:22:14 +0200 Subject: [PATCH 13/18] Update 04-tests.bs --- 04-tests.bs | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/04-tests.bs b/04-tests.bs index ae75409..670d14b 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -10,7 +10,7 @@ Mailing List: public-treecg@w3.org Mailing List Archives: https://lists.w3.org/Archives/Public/public-treecg/ Editor: - Pieter Colpaert, https://pietercolpaert.be - - Xueying Deng + - Xueying Deng, https://xdxxxdx.github.io/ Abstract: The TREE test specification aims to provide enough resource that for a TREE implementation to be able to test itself against the TREE specification.This test specification will be continuously updated to align with changes and improvements in the TREE specification. # Overview # {#overview} @@ -61,7 +61,7 @@ Each conformance point is described in detail, including the expected behavior o - When there is a `tree:Relation` in the payload of the current HTTP response, the subject of the `tree:Relation` must also point to a `tree:path` ### Search TREE ### {#1.2} -- During the construction of the complete RDF graph of the search tree at any point in the traversal, the inbound link to any tree:Node via a tree:Relation can originate from only one other tree:Node. +- At any point in the TREE, each `tree:Node` may have at most one inbound link via a `tree:Relation` from another `tree:Node`. ```turtle @prefix sh: . @@ -73,7 +73,7 @@ ex:NodeInboundUniquenessShape sh:targetClass tree:Node ; sh:sparql [ a sh:SPARQLConstraint ; - sh:message "Each tree:Node must not be the target of more than one tree:Relation.tree:node link from another node." ; + sh:message "Each tree:Node must not be the target of more than one tree:Relation, tree:node link from another node." ; sh:select """ SELECT ?this (COUNT(?sourceNode) AS ?inboundCount) WHERE { @@ -87,19 +87,20 @@ ex:NodeInboundUniquenessShape ] . ```` -### The member extraction algorithm ### {#1.3} -### Traversing the search tree ### {#1.4} -### Pruning branches ### {#1.5} - - +- Whenever `tree:GreaterThanRelation` is used as a comparator within the TREE, the values pointed by `tree:path` in the members MUST be compared using the rules defined in the [SPARQL algebra functions](https://www.w3.org/TR/sparql11-query/#expressions). + -## Conformance ## {#conformance} +# Conformance Points # {#conformance-points} The conformance points in this document are based on the [TREE specification](https://w3c.github.io/treecg/specification/) and are intended for testing implementations of the TREE specification. -As TREE is based on hypermedia, the conformance is designed for HTTP-based implementation, the test cases are designed to be executed over HTTP(s), and the expected results are based on the HTTP(s) responses. +TREE conformance is designed for HTTP-based implementations; all test cases are expected to be executed over HTTP(s), and results are determined from the HTTP(s) responses. Since TREE is an RDF (Resource Description Framework) specification, all response payloads must use standard RDF serialization formats, such as Turtle, RDF/XML, or JSON-LD. -Conformance points are divided into two categories: **MUST** and **SHOULD**. -Each conformance point is described in detail, including the expected behavior of the implementation. The test cases used to verify compliance are also provided. + -- **MUST** conformance points are mandatory for all implementations. Implementations that do not meet these requirements are not considered compliant with the specification. -- **SHOULD** conformance points are optional but recommended. Implementations that do not meet these requirements may still be considered compliant, but may not provide the same level of functionality or interoperability. + - -## MUST Conformance Points## {#must} +## TREE basic elements ## {#1.1} + +### Subject of `tree:view` must be a `tree:Collection` ### {#1.1.1} +**Description:** When there is a `tree:view` in the payload of the current HTTP(s) response, the subject of the `tree:view` must be a `tree:Collection` + +**SHACL shape against the HTTP(s) response:** +```turtle +@prefix sh: . +@prefix tree: . -### TREE basic elements ### {#1.1} +tree:ViewSubjectConstraintShape + a sh:NodeShape ; + sh:targetSubjectsOf tree:view ; + sh:class tree:Collection ; + sh:message "Subject of tree:view must be a tree:Collection" . -- When there is a `tree:view` in the payload of the current HTTP response, the subject of the `tree:view` must be a `tree:Collection` +``` +### Subject of `tree:member` must be either a `tree:Collection` or a `tree:RootNode` ### {#1.1.2} +**Description:** If a `tree:member` property appears in the payload of the current HTTP(s) response, its subject MUST be either a `tree:Collection` or a `tree:RootNode`. +**SHACL shape against the HTTP(s) response:** ```turtle @prefix sh: . @prefix tree: . -@prefix rdf: . -# SHACL Node Shape to validate that any subject having tree:view must be a tree:Collection +tree:MemberSubjectConstraintShape + a sh:NodeShape ; + sh:targetSubjectsOf tree:member ; + sh:or ( + [ sh:class tree:Collection ] + [ sh:class tree:RootNode ] + ) ; + sh:message "Subject of tree:member must be either a tree:Collection or a tree:RootNode" . + +``` +### `tree:Relation` properties ### {#1.1.3} + +**Description:** If a `tree:Relation` appears in the payload of the current HTTP(s) response, it MUST have a `tree:path` property and a `tree:node` property which pointing to another `tree:Node`. + `tree:Relation` is a superclass for all TREE-supported relation types (such as `tree:GreaterThanRelation`, `tree:LessThanRelation`, `tree:GreaterThanOrEqualToRelation`, etc.). + For the complete list of subclasses of `tree:Relation`, see [tree.ttl](https://github.com/TREEcg/specification/blob/master/tree.ttl). + +**SHACL shape against the HTTP(s) response:** +```turtle +@prefix sh: . +@prefix tree: . -<#TreeViewSubjectMustBeCollectionShape> +tree:RelationConstraintShape a sh:NodeShape ; - sh:targetSubjectsOf tree:view ; + sh:targetClass tree:Relation ; + sh:property [ + sh:path tree:path ; + sh:minCount 1 ; + sh:message "tree:Relation must have a tree:path property" + ] ; sh:property [ - sh:path rdf:type ; - sh:hasValue tree:Collection ; - sh:message "Subjects that have a tree:view must be a tree:Collection." ; + sh:path tree:node ; + sh:minCount 1 ; + sh:class tree:Node ; + sh:message "tree:Relation must have a tree:node property pointing to a tree:Node" ] . +``` + +### Initialization of TREE structure via `tree:view` after dereferencing ### {#1.1.4} +**Description:** When a `tree:view` triple exists in the payload of the final HTTP(s) response (after following all redirects), the final IRI MUST be the object of a `tree:view` triple whose subject is a `tree:Collection`. This ensures that dereferencing a resource leads to a valid TREE view associated with a collection. + +**SHACL shape against the HTTP(s) response:** + +```turtle +@prefix sh: . +@prefix tree: . +tree:ViewObjectConstraintShape + a sh:NodeShape ; + sh:targetObjectsOf tree:view ; + sh:sparql [ + sh:select """ + SELECT $this + WHERE { + ?collection a tree:Collection . + ?collection tree:view $this . + } + """ ; + sh:message "The final IRI must be the object of a tree:view triple whose subject is a tree:Collection" + ] . ``` - -- When there is a `tree:member` in the payload of the current HTTP response, the subject of the `tree:member` must be a `tree:Collection` or a `tree:RootNode` -- When there is a `tree:Relation` in the payload of the current HTTP response, the subject of the `tree:Relation` must also point to a `tree:path` +## Search TREE ## {#1.2} + +### `tree:Node` inbound link uniqueness ### {#1.2.1} +**Description:** During traversal of the TREE structure, each `tree:Node` MUST NOT be the target of more than one inbound `tree:Relation` (i.e., via the `tree:node` property) from a different `tree:Node`. In other words, no `tree:Node` should have more than one parent node. This requirement ensures that the TREE remains a valid tree structure, where each node has at most one parent. -### Search TREE ### {#1.2} -- At any point in the TREE, each `tree:Node` may have at most one inbound link via a `tree:Relation` from another `tree:Node`. +**SHACL shape against the RDF graph:** ```turtle @prefix sh: . @@ -87,24 +146,18 @@ ex:NodeInboundUniquenessShape ] . ```` -- Whenever `tree:GreaterThanRelation` is used as a comparator within the TREE, the values pointed by `tree:path` in the members MUST be compared using the rules defined in the [SPARQL algebra functions](https://www.w3.org/TR/sparql11-query/#expressions). - \ No newline at end of file +--> From ade9082ba0a3687a4da4eb03a46c40e48f52ad8d Mon Sep 17 00:00:00 2001 From: XD Date: Thu, 31 Jul 2025 17:04:49 +0200 Subject: [PATCH 16/18] feat: delete redundancy --- 04-tests.bs | 2 +- 04-tests.html | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/04-tests.bs b/04-tests.bs index 7df98f1..e65dfe9 100644 --- a/04-tests.bs +++ b/04-tests.bs @@ -93,7 +93,7 @@ tree:RelationConstraintShape ``` ### Initialization of TREE structure via `tree:view` after dereferencing ### {#1.1.4} -**Description:** When a `tree:view` triple exists in the payload of the final HTTP(s) response (after following all redirects), the final IRI MUST be the object of a `tree:view` triple whose subject is a `tree:Collection`. This ensures that dereferencing a resource leads to a valid TREE view associated with a collection. +**Description:** When a `tree:view` triple exists in the payload of the final HTTP(s) response (after following all redirects), the final IRI MUST be the object of a `tree:view` triple whose subject is a `tree:Collection`. **SHACL shape against the HTTP(s) response:** diff --git a/04-tests.html b/04-tests.html index 31b14d2..a828852 100644 --- a/04-tests.html +++ b/04-tests.html @@ -8,7 +8,7 @@ - + - - - - - - - -
-

-

-

TREE Test Specification

-

Draft Community Group Report, -

-
- More details about this document -
-
-
This version: -
https://w3id.org/tree/specification/tests -
Feedback: -
public-treecg@w3.org with subject line “[tests] … message topic …” (archives) -
Issue Tracking: -
GitHub -
Editors: -
-
- Pieter Colpaert -
- Xueying Deng -
-
-
-
- -
-
-
-

Abstract

-

The TREE test specification aims to provide resource that for a TREE implementation to be able to test itself against the TREE specification.This test specification will be continuously updated to align with changes and improvements in the TREE specification.

-
-

Status of this document

-
-

-
-
- -
-

1. Overview

-

The TREE specification follows the RFC 2119 norms for defining conformance requirements. -This document outlines the minimum conformance requirements from the TREE specification and provides corresponding test cases to verify the compliance.

-

2. Conformance Points

-

The conformance points in this document are based on the TREE specification and are intended for testing implementations of the TREE specification.

-

TREE conformance is designed for HTTP-based implementations; all test cases are expected to be executed over HTTP(s), and results are determined from the HTTP(s) responses. Since TREE is an RDF (Resource Description Framework) specification, all response payloads must use standard RDF serialization formats, such as Turtle, RDF/XML, or JSON-LD.

-

2.1. TREE basic elements

-

2.1.1. Subject of tree:view must be a tree:Collection

- -Description: When there is a tree:view in the payload of the current HTTP(s) response, the subject of the tree:view must be a tree:Collection - - -

SHACL shape against the HTTP(s) response:

-
@prefix sh: <http://www.w3.org/ns/shacl#> .
-@prefix tree: <https://w3id.org/tree#> .
-
-tree:ViewSubjectConstraintShape
-    a sh:NodeShape ;
-    sh:targetSubjectsOf tree:view ;
-    sh:class tree:Collection ;
-    sh:message "Subject of tree:view must be a tree:Collection" .
-
-
-

2.1.2. Subject of tree:member must be either a tree:Collection or a tree:RootNode

- -Description: If a tree:member property appears in the payload of the current HTTP(s) response, its subject MUST be either a tree:Collection or a tree:RootNode. - - -

SHACL shape against the HTTP(s) response:

-
@prefix sh: <http://www.w3.org/ns/shacl#> .
-@prefix tree: <https://w3id.org/tree#> .
-
-tree:MemberSubjectConstraintShape
-    a sh:NodeShape ;
-    sh:targetSubjectsOf tree:member ;
-    sh:or (
-        [ sh:class tree:Collection ]
-        [ sh:class tree:RootNode ]
-    ) ;
-    sh:message "Subject of tree:member must be either a tree:Collection or a tree:RootNode" .
-
-
-

2.1.3. tree:Relation properties

-

Description: If a tree:Relation appears in the payload of the current HTTP(s) response, it MUST have a tree:path property and a tree:node property which pointing to another tree:Node. - tree:Relation is a superclass for all TREE-supported relation types (such as tree:GreaterThanRelation, tree:LessThanRelation, tree:GreaterThanOrEqualToRelation, etc.). - For the complete list of subclasses of tree:Relation, see tree.ttl.

-

SHACL shape against the HTTP(s) response:

-
@prefix sh: <http://www.w3.org/ns/shacl#> .
-@prefix tree: <https://w3id.org/tree#> .
-
-tree:RelationConstraintShape
-    a sh:NodeShape ;
-    sh:targetClass tree:Relation ;
-    sh:property [
-        sh:path tree:path ;
-        sh:minCount 1 ;
-        sh:message "tree:Relation must have a tree:path property"
-    ] ;
-    sh:property [
-        sh:path tree:node ;
-        sh:minCount 1 ;
-        sh:class tree:Node ;
-        sh:message "tree:Relation must have a tree:node property pointing to a tree:Node"
-    ] .
-
-

2.1.4. Initialization of TREE structure via tree:view after dereferencing

- -Description: When a tree:view triple exists in the payload of the final HTTP(s) response (after following all redirects), the final IRI MUST be the object of a tree:view triple whose subject is a tree:Collection. - - -

SHACL shape against the HTTP(s) response:

-
@prefix sh: <http://www.w3.org/ns/shacl#> .
-@prefix tree: <https://w3id.org/tree#> .
-
-tree:ViewObjectConstraintShape
-    a sh:NodeShape ;
-    sh:targetObjectsOf tree:view ;
-    sh:sparql [
-        sh:select """
-            SELECT $this
-            WHERE {
-                ?collection a tree:Collection .
-                ?collection tree:view $this .
-            }
-        """ ;
-        sh:message "The final IRI must be the object of a tree:view triple whose subject is a tree:Collection"
-    ] .
-
-

2.2. Search TREE

-

2.2.1. tree:Node inbound link uniqueness

- -Description: During traversal of the TREE structure, each tree:Node MUST NOT be the target of more than one inbound tree:Relation (i.e., via the tree:node property) from a different tree:Node. In other words, no tree:Node should have more than one parent node. This requirement ensures that the TREE remains a valid tree structure, where each node has at most one parent. - - -

SHACL shape against the RDF graph:

-
@prefix sh: <http://www.w3.org/ns/shacl#> .
-@prefix tree: <https://w3id.org/tree#> .
-@prefix ex: <http://example.org/> .
-
-ex:NodeInboundUniquenessShape
-    a sh:NodeShape ;
-    sh:targetClass tree:Node ;
-    sh:sparql [
-        a sh:SPARQLConstraint ;
-        sh:message "Each tree:Node must not be the target of more than one tree:Relation, tree:node link from another node." ;
-        sh:select """
-            SELECT ?this (COUNT(?sourceNode) AS ?inboundCount)
-            WHERE {
-                ?sourceNode tree:relation ?relation .
-                ?relation tree:node ?this .
-                FILTER (?sourceNode != ?this)
-            }
-            GROUP BY ?this
-            HAVING (COUNT(?sourceNode) > 1)
-        """ ;
-    ] .
-   
-
-

2.2.2. tree:GreaterThanRelation

- -Description: When traversing a TREE structure by following tree:Relation links (after making one or more HTTP(s) requests and aggregating the resulting RDF graphs), if a tree:GreaterThanRelation is present, then for each member referenced by the relation, the value of the property specified by tree:path MUST be greater than the value specified in the relation, according to the comparison rules defined in the SPARQL algebra functions. This ensures that the tree:GreaterThanRelation accurately represents a "greater than" relationship as defined by SPARQL semantics. - - - -

2.2.3. xsd:dateTime literals without a timezone comparisons

- -Description: When traversing a TREE structure, if an implementation employs xsd:dateTime literals without an explicit timezone, it MUST treat these values as representing the entire range from that date and time at UTC-14:00 (inclusive) to UTC+14:00 (exclusive). Comparisons involving such xsd:dateTime values MUST be performed as interval comparisons: a value without a timezone matches if and only if the comparison holds for at least one instant within this interval. Implementations MUST NOT assume any default timezone or offset for such values. - - - - - - -
-
-

Conformance

-

Document conventions

-

Conformance requirements are expressed - with a combination of descriptive assertions - and RFC 2119 terminology. - The key words “MUST”, “MUST NOT”, “REQUIRED”, “SHALL”, “SHALL NOT”, “SHOULD”, “SHOULD NOT”, “RECOMMENDED”, “MAY”, and “OPTIONAL” - in the normative parts of this document - are to be interpreted as described in RFC 2119. - However, for readability, - these words do not appear in all uppercase letters in this specification. - -

-

All of the text of this specification is normative - except sections explicitly marked as non-normative, examples, and notes. [RFC2119] - -

-

Examples in this specification are introduced with the words “for example” - or are set apart from the normative text - with class="example", - like this: - -

-
- - -

This is an example of an informative example. -

-
-

Informative notes begin with the word “Note” - and are set apart from the normative text - with class="note", - like this: - -

-

Note, this is an informative note.

-
- -

References

-

Normative References

-
-
[RFC2119] -
S. Bradner. Key words for use in RFCs to Indicate Requirement Levels. March 1997. Best Current Practice. URL: https://datatracker.ietf.org/doc/html/rfc2119 -
\ No newline at end of file