1.1.0 • Published 5 years ago

glxy-apollo-be-cms-services v1.1.0

Weekly downloads
3
License
-
Repository
-
Last release
5 years ago

Apollo CMS Moleculer Services

Search examples

Search concepts

call apollo-be.cms.osearch '{"profile":"concepts","q":{"term":"Mil","language":"nl","scheme":"http://wolterskluwer.be/pr/lc/topics"},"$limit":10}'
call apollo-be.cms.osearch '{"profile":"concepts","q":{"term":"gewest","language":"nl","scheme":"http://brons.wkb.int/klasseregister"},"$limit":10}'

With profile "lyra-concepts-by-package"

call apollo-be.cms.search --profile "lyra-concepts-by-package" --q "3840da1a-18c6-4306-a3f7-d4e245fc71af"

With profile "lyra-content-by-package"

call apollo-be.cms.search --profile "lyra-content-by-package" --q "3840da1a-18c6-4306-a3f7-d4e245fc71af"

With profile "document-by-id"

call apollo-be.cms.search '{"profile":"document-by-id","q":"111","$limit":10}'

With profile "questions-by-topic"

call apollo-be.cms.search '{"profile":"questions-by-topic","q":"tt35","$limit":10}'

With profile "document-by-id-and-part"

# search on akte + teller
call apollo-be.cms.search '{"profile":"document-by-id-and-part","q":"6087-2","$limit":10}'
# search on akte + title
call apollo-be.cms.search '{"profile":"document-by-id-and-part","q":"6087 2","$limit":10}'

Envelopes

Create an envelope with properties

call apollo-be.cms.core.createEnvelope '{"envelopeUri":"/wkbe/pr/lc/questions/test","properties":{"id":"test","type":"questions"}}'

Delete an envelope

call apollo-be.cms.core.deleteEnvelope --envelopeUri /wkbe/pr/lc/questions/test

Classification examples

Update classification

Précreate a test envelope

call apollo-be.cms.core.createEnvelope --envelopeUri /wkbe/test/lc/classification/update

Add classification

call apollo-be.cms.classification.update '{"envelopeUri":"/wkbe/test/lc/classification/update", "attachmentUri": "/wkbe/test/lc/classification/update.rdf", "profile": "pr.metadata","add":{"http://wolterskluwer.be/test/lc/classification/update":{"http://www.w3.org/2004/02/skos/core#prefLabel":[{"value": "update","type": "literal", "datatype": "http://www.w3.org/2001/XMLSchema#string"}]}}}'

Remove old and add new

call apollo-be.cms.classification.update '{"envelopeUri":"/wkbe/test/lc/classification/update", "attachmentUri": "/wkbe/test/lc/classification/update.rdf", "profile": "pr.metadata","remove":{"http://wolterskluwer.be/test/lc/classification/update":{"http://www.w3.org/2004/02/skos/core#prefLabel":[{"value": "update","type": "literal", "datatype": "http://www.w3.org/2001/XMLSchema#string"}]}},"add":{"http://wolterskluwer.be/test/lc/classification/update":{"http://www.w3.org/2004/02/skos/core#prefLabel":[{"value": "new-label","type": "literal", "datatype": "http://www.w3.org/2001/XMLSchema#string"}]}}}'

Remove matching

# regex patterns can be used for subject and object
call apollo-be.cms.classification.update '{"envelopeUri": "/wkbe/pr/brons/docs/law/1068", "attachmentUri": "http://lyra.be/editorial.metadata/brons/law/1068.rdf", "profile": "editorial.metadata", "removeMatching": {"^http://wolterskluwer.be/pr/brons/law/1068(#.*)?": {"http://schema.lyra.be/classificationLevel": ".*", "http://schema.lyra.be/dlcStatus": ".*", "http://schema.lyra.be/dlcPublished": ".*", "http://schema.lyra.be/displayTitle": ".*"}}}'

Change concept's order

call apollo-be.cms.classification.setConceptOrder --conceptUri http://wolterskluwer.be/pr/lc/topics/0000000254 --order 1

Classification exists

Check if classification uris are valid (existing in Marklogic as triple), before updating classification. Returns a boolean.

call apollo-be.cms.classification.exists --classificationUri 'http://wolterskluwer.be/pr/lc/categories/11' --schemeUri 'http://wolterskluwer.be/pr/lc/categories'

Add classification to a law-part

call apollo-be.cms.classification.update '{"envelopeUri":"/wkbe/pr/brons/docs/law/111", "attachmentUri": "wkbe/pr/brons/docs/law/111#pr.metadata", "profile": "pr.metadata","add":{"http://wolterskluwer.be/pr/brons/law/111#15":{"http://www.w3.org/2004/02/skos/core#hasSubject":[{"value": "http://wolterskluwer.be/pr/lc/questions/1","type": "uri"}]}}}'

Update related concepts

call apollo-be.cms.classification.updateRelatedConcepts '{"envelopeUri":"/wkbe/pr/wkbe-topics.skos.rdf","subject":"http://wolterskluwer.be/pr/lc/topics/0000000041","scheme":"http://wolterskluwer.be/pr/lc/domains","predicate":"http://schema.wolterskluwer.be/hasDomain","uris":["http://wolterskluwer.be/pr/lc/domains/e","http://wolterskluwer.be/pr/lc/domains/gdpr"],"attachmentUri":"/wkbe/pr/lc/topics.skos.rdf","profile":"pr.metadata"}'

Get related concepts

call apollo-be.cms.classification.getRelatedConcepts --subject http://wolterskluwer.be/pr/lc/topics/0000000041 --scheme http://wolterskluwer.be/pr/lc/domains

Classification Validation

Should return { existence: true, 'no-descendants': true }

call apollo-be.cms.classification.validate '{"schemeUri":"http://data.wolterskluwer.com/wkbe/kos/region","uris":["http://data.wolterskluwer.com/wkbe/kos/region/be/v","http://data.wolterskluwer.com/wkbe/kos/region/be/w"],"options":["existence","no-descendants"]}'

Should return { existence: true, 'no-descendants': false }

call apollo-be.cms.classification.validate '{"schemeUri":"http://data.wolterskluwer.com/wkbe/kos/region","uris":["http://data.wolterskluwer.com/wkbe/kos/region/be","http://data.wolterskluwer.com/wkbe/kos/region/be/w"],"options":["existence","no-descendants"]}'

Replace Classification Data

call apollo-be.cms.classification.replaceObjects '{"envelopeUri":"/wkbe/pr/brons/docs/law/1068","attachmentUri":"/orig/brons/law/1068.rdf","profile":"orig.metadata","triples":{"http://wolterskluwer.be/pr/brons/law/1068":{"http://schema.wolterskluwer.be/region":[{"value":"http://data.wolterskluwer.com/wkbe/kos/region/be-nl","type":"uri"}]}}}'

Get Classification Data by Namespace

call apollo-be.cms.classification.getByNamespace '{"envelopeUri":"/wkbe/pr/brons/docs/law/1068","subject":"http://wolterskluwer.be/pr/brons/law/1068","namespace":"http://schema.lyra.be/"}'

Core examples

Generate an envelope-uri

call apollo-be.cms.core.generateUri --baseUri /wkbe/pr/lc/questions

Convert an envelope-uri to a content-uri (to be used for example in classification)

call apollo-be.cms.core.getContentUri --envelopeUri /wkbe/pr/lc/questions/1

Convert an content-uri to a envelope-uri

call apollo-be.cms.core.getEnvelopeUri --contentUri http://wolterskluwer.be/pr/lc/questions/00001240

Create an envelope

call apollo-be.cms.core.createEnvelope --envelopeUri /wkbe/pr/lc/questions/1

Add attachment

call apollo-be.cms.core.addAttachment --envelopeUri /wkbe/pr/lc/questions/0000000989 --attachmentUri /editorial/lc/questions/0000000001.json --profile editorial.document --content '{"content":[{"lang":"nl", "val":"Opgeheven.\nZijn de ondergrondse leidingen beschermd d.m.v. een bekleding gevormd door minstens 2 lagen jute doordrenkt met asfalt en door een laag warm aangebrachte asfalt, of met gelijk welke andere bekleding die op gebied van bescherming tegen invreting gelijkwaardige hoedanigheden bezit?"}], "modDate":"2015-02-10T16:43:21.775Z", "id":"0000000989", "_links":{"responsibles":{"id":"ex", "href":"/ext/ct6/hse/responsibles/ex"}, "articles":[{"id":"11413-T623", "href":"/ext/ct6/hse/articles/11413-T623"}], "self":{"id":"0000000989", "href":"/ext/ct6/hse/questions/0000000989"}, "categories":{"id":"301", "href":"/ext/ct6/hse/categories/301"}}, "sortOrder":1013, "pubDate":"2013-10-29T12:34:48.540Z"}'

Get attachment

call apollo-be.cms.core.getAttachment --envelopeUri /wkbe/pr/lyra/docs/extquestions/0000000989 --attachmentUri /editorial/lyra/extquestions/0000000989#content
call apollo-be.cms.core.getAttachment --envelopeUri /wkbe/pr/brons/docs/doc/84813 --attachmentUri /orig/brons/doc/84813.xml

Get a relation id/uri

call apollo-be.cms.core.getRelationUri --source "http://wolterskluwer.be/pr/lc/questions/00001240" --target "http://wolterskluwer.be/pr/brons/law/111#2" --type "lawpart"

Remodeling examples

Trigger envelopes for remodeling (from sync)

call apollo-be.cms.remodeling.trigger --source lc --collection /orig/cst/extquestions --sync true
call apollo-be.cms.remodeling.trigger --source brons --collection /orig/brons/law --sync true

Trigger envelopes for remodeling (no sync)

call apollo-be.cms.remodeling.trigger --source lc --collection /wkbe/pr/lc/questions

(TODO) Trigger envelopes for remodeling by serialized cst-query

call apollo-be.cms.remodeling.trigger --source lc --cst-query 'cts:and-query((cts:collection-query("/wkbe/pr/lc"), ...))'

Remodel triggered envelopes

call apollo-be.cms.remodeling.remodel --$limit 10

Remodel one or more specific uri's

call apollo-be.cms.remodeling.remodelUris '{"uris":["/wkbe/pr/lc/questions/0000001002"],"sync":true}'

List triggered envelopes

call apollo-be.cms.remodeling.list