Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions descriptors/ModuleDescriptor-template.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,20 @@
"methods": [
"POST"
],
"pathPattern": "/cyclops/sets/{setName}",
"pathPattern": "/cyclops/sets/{setName}/add",
"permissionsRequired": [
"cyclops.sets.modify"
],
"permissionsDesired": [
"cyclops.sets.add-objects",
"cyclops.sets.remove-objects"
]
},
],
},
{
"methods": [
"POST"
],
"pathPattern": "/cyclops/sets/{setName}/remove",
"permissionsRequired": [
"cyclops.sets.remove-objects",
],
},
{
"methods": [
"POST"
Expand Down Expand Up @@ -141,19 +146,13 @@
"permissionName": "cyclops.sets.delete",
"displayName": "CYCLOPS: Delete set"
},
{
"permissionName": "cyclops.sets.modify",
"displayName": "CYCLOPS: Add/remove objects to/from set"
},
{
"permissionName": "cyclops.sets.add-objects",
"displayName": "CYCLOPS: Add objects to set (UNIMPLEMENTED)",
"subPermissions": ["cyclops.sets.modify"]
},
{
"permissionName": "cyclops.sets.remove-objects",
"displayName": "CYCLOPS: Remove objects from set (UNIMPLEMENTED)",
"subPermissions": ["cyclops.sets.modify"]
},
{
"permissionName": "cyclops.sets.modify-tags",
Expand Down
4 changes: 2 additions & 2 deletions htdocs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@
<li><button class="link-button" onclick="deleteObject('/cyclops/sets/test.mike')">delete set "test.mike"</button></li>
<li><a href="/cyclops/sets/test.mike?fields=%2A&cond=143100000%20%3C%3D%20age%20AND%20age%20%3C%3D%20201400000&filter=jurassic&tag=dino,ptero&sort=author,title&offset=20&limit=10">retrieve from set "test.mike"</a></li>
<li><a href="/cyclops/sets/test.mike?fields=%2A&cond=title='rings' or author='lewis'&sort=author&offset=20&limit=10">retrieve from set "test.mike" using only supported params</a></li>
<li><button class="link-button" onclick="postData('/cyclops/sets/test.mike', { op: 'add', from: 'allobjects', cond: 'date >= 2025-01-01', filter: 'jurassic', tag: 'dino,ptero' })">add objects to set "test.mike"</button></li>
<li><button class="link-button" onclick="postData('/cyclops/sets/test.mike', { op: 'remove', cond: 'date < 2025-01-01', filter: 'cretaceous', omitTag: 'ptero,croc' })">remove objects from set "test.mike"</button></li>
<li><button class="link-button" onclick="postData('/cyclops/sets/test.mike/add', { from: 'allobjects', cond: 'date >= 2025-01-01', filter: 'jurassic', tag: 'dino,ptero' })">add objects to set "test.mike"</button></li>
<li><button class="link-button" onclick="postData('/cyclops/sets/test.mike/remove', { cond: 'date < 2025-01-01', filter: 'cretaceous', omitTag: 'ptero,croc' })">remove objects from set "test.mike"</button></li>
<li><button class="link-button" onclick="postData('/cyclops/sets/test.mike/tag/dino', { op: 'add', cond: 'title LIKE %saur', filter: 'jurassic' })">add tag "dino" to records in set "test.mike"</button></li>
<li><button class="link-button" onclick="postData('/cyclops/sets/test.mike/tag/dino', { op: 'remove', cond: 'author LIKE %taylor%', filter: 'cretaceous' })">remove tag "dino" from records in set "test.mike"</button></li>
</ul>
Expand Down
7 changes: 4 additions & 3 deletions ramls/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ schemalint:
z-schema set-schema.json
z-schema sets-schema.json
z-schema retrieve-schema.json
z-schema addremoveobjects-schema.json
z-schema addobjects-schema.json
z-schema removeobjects-schema.json
z-schema addremovetag-schema.json

examplelint:
Expand All @@ -30,8 +31,8 @@ examplelint:
z-schema set-schema.json examples/set-example.json
z-schema sets-schema.json examples/show-sets-example.json
z-schema retrieve-schema.json examples/retrieve-example.json
z-schema addremoveobjects-schema.json examples/addobject-example.json
z-schema addremoveobjects-schema.json examples/removeobject-example.json
z-schema addobjects-schema.json examples/addobject-example.json
z-schema removeobjects-schema.json examples/removeobject-example.json
z-schema addremovetag-schema.json examples/addtag-example.json
z-schema addremovetag-schema.json examples/removetag-example.json

Expand Down
23 changes: 11 additions & 12 deletions ramls/addremoveobjects-schema.json → ramls/addobjects-schema.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "A request to add objects to, or remove objects from, a set",
"description": "A request to add objects to a set",
"type": "object",
"properties": {
"op": {
"type": "string",
"description": "Operation to perform: add or remove",
"enum": ["add", "remove"]
},
"from": {
"type": "string",
"description": "Name of the set from which records are to be added to this one. Mandatory for 'add', prohibited for 'delete'"
"description": "Name of the set from which records are to be added to this one"
},
"cond": {
"type": "string",
"description": "An SQL-like WHERE condition specifying the selection of records included in the operation"
"description": "An SQL-like WHERE condition specifying the selection of records to be added"
},
"filter": {
"type": "string",
"description": "The name of a filter to be applied to selection of records included in the operation"
"description": "The name of a filter to be applied to selection of records to be added"
},
"tag": {
"type": "string",
"description": "A comma-separated list of the names of tags, specifying that only those selected records with any of the tags will be be included in the operation"
"description": "A comma-separated list of the names of tags, specifying that only those selected records with any of the tags will be added"
},
"omitTag": {
"type": "string",
"description": "A comma-separated list of the names of tags, specifying that only those selected records without any of the tags will be be included in the operation"
"description": "A comma-separated list of the names of tags, specifying that only those selected records without any of the tags will be be added"
},
"limit": {
"type": "string",
"description": "A maximum number of objects that will be added to the set"
}
},
"additionalProperties": false,
"required": [
"op"
"from"
]
}
33 changes: 20 additions & 13 deletions ramls/cyclops.raml
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,31 @@ documentation:
application/json:
type: !include retrieve-schema.json
example: !include examples/retrieve-example.json
post:
description: "add objects to, or remove objects from, a set"
body:
application/json:
type: !include addremoveobjects-schema.json
examples:
add:
value: !include examples/addobject-example.json
remove:
value: !include examples/removeobject-example.json
responses:
204:
description: No content is returned.
delete:
description: "Delete a set"
responses:
204:
description: No content is returned.
/add:
post:
description: "add objects to a set"
body:
application/json:
type: !include addobjects-schema.json
example: !include examples/addobject-example.json
responses:
204:
description: No content is returned.
/remove:
post:
description: "remove objects from a set"
body:
application/json:
type: !include removeobjects-schema.json
example: !include examples/removeobject-example.json
responses:
204:
description: No content is returned.
/tag:
/{tagName}:
uriParameters:
Expand Down
4 changes: 2 additions & 2 deletions ramls/examples/addobject-example.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"op": "add",
"from": "mike",
"cond": "date >= \"2025-01-01\"",
"filter": "jurassic",
"tag": "dino,ptero",
"omitTag": "croc"
"omitTag": "croc",
"limit": "200"
}
1 change: 0 additions & 1 deletion ramls/examples/removeobject-example.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"op": "remove",
"cond": "date < \"2025-01-01\"",
"filter": "cretaceous",
"tag": "dino",
Expand Down
24 changes: 24 additions & 0 deletions ramls/removeobjects-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "A request to remove objects from a set",
"type": "object",
"properties": {
"cond": {
"type": "string",
"description": "An SQL-like WHERE condition specifying the selection of records to be deleted"
},
"filter": {
"type": "string",
"description": "The name of a filter to be applied to selection of records to be deleted"
},
"tag": {
"type": "string",
"description": "A comma-separated list of the names of tags, specifying that only those selected records with any of the tags will be deleted"
},
"omitTag": {
"type": "string",
"description": "A comma-separated list of the names of tags, specifying that only those selected records without any of the tags will be deleted"
}
},
"additionalProperties": false
}