Skip to content

Collections: use SHACL Advanced Features for ordering (and filtering?) #209

@tpluscode

Description

@tpluscode

The query:order and query:filter annotations of collections should be replaced with SHACL AF Node expressions

Ordering

</articles>
  a api:ArticleCollection ;
- query:order (
-   [ query:path schema:title ]
-   [ query:path schema:dateCreated ; query:direction ldp:Descending ]
+ sh:orderBy (
+   [ sh:path schema:title ]
+   [ sh:path schema:dateCreated ; sh:desc true ]
  ) ;
.

Filtering

Both should be possible, current use with code:, as well as declaratively with SHACL AF

</api/shape>
  a hydra:IriTemplate ;
  hydra:template "{?targetNode}" ;
  hydra:mapping 
  [
    hydra:variable "targetNode" ;
    hydra:property sh:targetNode ;
    query:filter
-   [
-     a code:EcmaScriptModule ;
-     code:link <file:filters/shape.js#byTargetNode> ;
-   ] ;
+   [
+     sh:union (
+       [ sh:path sh:targetNode query:value ]
+       [ 
+          sh:nodes [ sh:path sh:targetClass ]
+          sh:path [ sh:inversePath rdf:type ]
+       ]
+     )
  ] ;
.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions