Hi Sanjeev,

I took another look at this and have attached a version that should work out of the box.

HTH
Holger


On 2021-11-27 11:45 am, Holger Knublauch wrote:

ECA rules will only execute after changes to an existing asset collection, but you will need something to execute while the asset collection is being created.

For this we have a notion of project constructors. See the rdfs:comment at teamwork:projectConstructor. Basically you need to define an SWP file that links defines an SWP element, e.g. ex:MyMethod as subclass of ui:Methods that adds the extra teamwork:viewer triples, and then add

    taxonomies:ProjectType teamwork:projectConstructor ex:MyMethod

to make sure it gets executed whenever a new Taxonomy gets created.

The ui:prototype of ex:MyMethod could be as simple as

<ui:group let:teamGraph="{= teamwork:currentTeamGraph() }">
    <ui:setContext ui:queryGraph="{= ?teamGraph }">
        <ui:update ui:updateQuery="{! INSERT { ?teamGraph teamwork:viewer <WHOEVER> } WHERE { } }"/>
    </ui:setContext>
</ui:group>

(This is untested)

HTH
Holger


On 2021-11-26 10:43 pm, [email protected] wrote:
Hi,
     There is requirement to add an user as Viewer automatically in the background whenever a brand new Taxonomy is created in Enterprise Data Governance (EDG). For this can the Event Condition Action Framework be used? If yes then please share an example Rule for adding an user automatically to a new Taxonomy.

Thanks,
Sanjeev
--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/e49cedbb-cbdb-4506-94fa-135d29c2344bn%40googlegroups.com <https://groups.google.com/d/msgid/topbraid-users/e49cedbb-cbdb-4506-94fa-135d29c2344bn%40googlegroups.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "TopBraid 
Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/93e23e2b-9be0-44b9-f87e-61a4b675b027%40topquadrant.com.
# baseURI: 
http://extensionsamples.topbraid.org/projectconstructors/projectconstructorexample
# imports: http://evn.topbraidlive.org/evnprojects
# imports: http://teamwork.topbraidlive.org/ontologyprojects
# prefix: ex

@prefix acjob: <http://evn.topbraidlive.org/tagger/acjob#> .
@prefix acjob3: <http://evn.topbraidlive.org/tagger/acjob#> .
@prefix acpp: <http://topbraid.org/nlp/autoclassifier-preproc#> .
@prefix acpp1: <http://topbraid.org/nlp/autoclassifier-preproc#> .
@prefix adminguide: <http://server.topbraidlive.org/doc/adminguide#> .
@prefix afn: <http://jena.hpl.hp.com/ARQ/function#> .
@prefix apf: <http://jena.apache.org/ARQ/property#> .
@prefix arg: <http://spinrdf.org/arg#> .
@prefix autotagger: <http://evn.topbraidlive.org/autotagger#> .
@prefix cfg: <http://server.topbraidlive.org/web/2009/config#> .
@prefix charts: <http://uispin.org/charts#> .
@prefix compliance: <http://topbraid.org/compliance#> .
@prefix composite: <http://www.topbraid.org/2007/05/composite.owl#> .
@prefix concept-importer: <http://topbraid.org/concept-importer#> .
@prefix conceptmatch: <http://topbraid.org/conceptmatch#> .
@prefix config: <http://server.topbraidlive.org/dynamic/config#> .
@prefix config-importers: <http://edg.topbraidlive.org/config/importers#> .
@prefix contact: <http://www.w3.org/2000/10/swap/pim/contact#> .
@prefix core-soa: <http://www.semanticweb.org/ontologies/2010/01/core-soa.owl#> 
.
@prefix corpus: <http://topbraid.org/corpus#> .
@prefix corpusprojects: <http://topbraid.org/corpus-projects#> .
@prefix crosswalk: <http://topbraid.org/crosswalk#> .
@prefix crosswalk.spin: <http://topbraid.org/crosswalk.spin#> .
@prefix crosswalkapp: <http://topbraid.org/swa/crosswalkapp#> .
@prefix crosswalkprojects: 
<http://teamwork.topbraidlive.org/crosswalkprojects#> .
@prefix css: <http://uispin.org/css#> .
@prefix daml: <http://www.daml.org/2001/03/daml+oil#> .
@prefix dash: <http://datashapes.org/dash#> .
@prefix dashboard: <http://example.org/dashboard#> .
@prefix datagraph: 
<http://teamwork.topbraidlive.org/datagraph/datagraphprojects#> .
@prefix dataset: <http://teamwork.topbraidlive.org/dataset#> .
@prefix datasetapp: <http://topbraid.org/swa/datasetapp#> .
@prefix datasetviewer: <http://topbraid.org/swa/datasetviewer#> .
@prefix datatype: <http://qudt.org/vocab/datatype/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix dcam: <http://purl.org/dc/dcam/> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix ddl: <http://edg.topbraidlive.org/1.0/importers/ddl#> .
@prefix debug-swa: <http://debug.topbraidlive.org/1.0/swa/> .
@prefix default: <http://uispin.org/default#> .
@prefix defaultapp: <http://topbraid.org/swa/defaultapp#> .
@prefix deployProjectToServer: 
<http://server.topbraidlive.org/doc/deployProjectToServer#> .
@prefix devguide: <http://evn.topbraidlive.org/evndoc.www/devguide#> .
@prefix doap: <http://usefulinc.com/ns/doap#> .
@prefix doc: <http://www.w3.org/2000/10/swap/pim/doc#> .
@prefix document: <http://topbraid.org/document#> .
@prefix documents: <http://edg.topbraid.solutions/1.0/shapes/documents#> .
@prefix dtype: <http://www.linkedmodel.org/schema/dtype#> .
@prefix ecp-ui: <https://graph.link/ecp/shapes/registryUI/> .
@prefix ecpcdf: <https://graph.link/ecp/schema/CDF/> .
@prefix ecpcmp: <https://graph.link/ecp/schema/CMP/> .
@prefix ecpert: <https://graph.link/ecp/schema/ERT/> .
@prefix edg: <http://edg.topbraid.solutions/model/> .
@prefix edg-config: <http://edg.ext.topbraidlive.org/schema/config/importers#> .
@prefix edg-importer: <http://edg.topbraidlive.org/importer/> .
@prefix edg-qa: <http://edg.topbraidlive.org/utility/qa/> .
@prefix edg.avro: <http://edg.topbraidlive.org/avro/> .
@prefix edg.c: <http://edg.topbraid.solutions/controller/> .
@prefix edg.doc: <http://edg.topbraid.solutions/doc/> .
@prefix edg.global: <urn:x-evn-global:> .
@prefix edg.glossary: <http://edg.topbraid.solutions/glossary/> .
@prefix edg.reactivegram: <http://edg.topbraid.solutions/diagram/reactivegram/> 
.
@prefix edg.sqoop: <http://edg.topbraid.solutions/model/sqoop/> .
@prefix edg.v: <http://edg.topbraid.solutions/view/> .
@prefix edg.xform.html: <http://edg.topbraid.solutions/transfrom/html/> .
@prefix edgproduct: <http://edg.topbraidlive.org/edgproduct#> .
@prefix eeh-lib: <http://www.environmenthub.no/spin/1.0/eeh-lib#> .
@prefix eeh-reportlib: <http://www.environmenthub.no/spin/1.0/eeh-reportlib#> .
@prefix egl-align: <https://edg.graph.link/shapes/alignment#> .
@prefix egl-lib: <https://edg.graph.link/1.0/lib/functions#> .
@prefix elements: <http://purl.org/dc/elements/1.1/> .
@prefix email: <http://topbraid.org/email#> .
@prefix evn: <http://topbraid.org/evn/evn#> .
@prefix evnAdminIndex: <http://evn.topbraidlive.org/evnAdminIndex#> .
@prefix evnIntro: <http://evn.topbraidlive.org/evndoc.www/evnIntro#> .
@prefix evndoc: <http://evn.topbraidlive.org/evndoc.www/evndoc#> .
@prefix evnimport: <http://evn.topbraidlive.org/uispin/evnimport#> .
@prefix evninstallguide: 
<http://teamwork.topbraidlive.org/doc/evninstallguide#> .
@prefix evnui: <http://evn.topbraidlive.org/ui#> .
@prefix ex: 
<http://extensionsamples.topbraid.org/projectconstructors/projectconstructorexample#>
 .
@prefix extjs: <http://uispin.com/extjs#> .
@prefix flow: <http://www.w3.org/2005/01/wf/flow#> .
@prefix fn: <http://www.w3.org/2005/xpath-functions#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix formTemplate: <http://teamwork.topbraidlive.org/system/formTemplate#> .
@prefix forms: <http://www.topbraid.org/2007/01/forms.owl#> .
@prefix frbr: <http://purl.org/vocab/frbr/core#> .
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix geosparql: <http://www.opengis.net/ont/geosparql#> .
@prefix gettingstarted: 
<http://evn.topbraidlive.org/evndoc.www/gettingstarted#> .
@prefix glossary: <http://evn.topbraidlive.org/evndoc.www/glossary#> .
@prefix governance: <http://topbraid.org/teamworkgovernance.ui#> .
@prefix gr: <http://purl.org/goodrelations/v1#> .
@prefix graphql: <http://datashapes.org/graphql#> .
@prefix graphql.search: <http://teamwork.topbraidlive.org/graphql.search#> .
@prefix html: <http://uispin.org/html#> .
@prefix imported: <http://topbraid.org/imported#> .
@prefix inference: <http://www.topbraid.org/2007/06/inference.owl#> .
@prefix jdbc: <http://edg.topbraidlive.org/1.0/importers/jdbc#> .
@prefix json: <http://topbraid.org/json#> .
@prefix kennedys: <http://topbraid.org/examples/kennedys#> .
@prefix let: <http://uispin.org/let#> .
@prefix letrs: <http://uispin.org/letrs#> .
@prefix lib-importer: <http://edg.topbraid.solutions/importer/lib#> .
@prefix lineage-transform: 
<http://edg.topbraid.solutions/transform/importer/lineage#> .
@prefix list: <http://jena.hpl.hp.com/ARQ/list#> .
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix metadata: <http://topbraid.org/metadata#> .
@prefix metash: <http://datashapes.org/metash#> .
@prefix nlp: <http://topbraid.org/nlp#> .
@prefix o2o: <http://lib.topquadrant.com/owl/srg/o2o#> .
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
@prefix ontologyprojects: <http://teamwork.topbraidlive.org/ontologyprojects#> .
@prefix ontologyviewer: <http://topbraid.org/swa/ontologyviewer#> .
@prefix org: <http://www.w3.org/ns/org#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix permissionGroupMgmt: 
<http://server.topbraidlive.org/doc/permissionGroupMgmt#> .
@prefix pg: <http://server.topbraidlive.org/web/2013/permissiongroups#> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix provo: <http://www.w3.org/ns/prov#> .
@prefix proxy-lineage: <http://edg.topbraid.solutions/proxy/importer/lineage#> .
@prefix quantity: <http://qudt.org/vocab/quantity/> .
@prefix quantitykind: <http://qudt.org/vocab/quantitykind/> .
@prefix qudd: <http://qudt.org/schema/datastructure/> .
@prefix quds: <http://qudt.org/schema/datastructure/> .
@prefix qudt: <http://qudt.org/schema/qudt/> .
@prefix qudt-refdata: <http://qudt.org/vocab/refdata/> .
@prefix qudt.type: <http://qudt.org/vocab/type/> .
@prefix raci: <http://topbraid.org/raci#> .
@prefix raci.spin: <http://topbraid.org/raci.spin#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix rdm: <http://rdm.topbraidlive.org/rdm/> .
@prefix rdmapp: <http://rdm.topbraidlive.org/rdmapp#> .
@prefix rdmfact: <http://topbraid.org/rdmfact#> .
@prefix rdmprojects: <http://rdm.topbraidlive.org/rdmprojects#> .
@prefix rdmviewer: <http://rdm.topbraidlive.org/rdmviewer#> .
@prefix reif: <https://edg.graph.link/1.0/shapes/reification#> .
@prefix s3: <http://topbraid.org/s3#> .
@prefix saf: <http://topbraid.org/saf/> .
@prefix safconfig: <http://topbraid.org/safconfig/> .
@prefix safindex: <http://topbraid.org/safindex#> .
@prefix safm: <http://saf.topbraidlive.org/metaschema/> .
@prefix savedQueries: <http://teamwork.topbraidlive.org/ui/savedQueries#> .
@prefix scheduler: <http://topbraid.org/scheduler#> .
@prefix sd: <http://www.w3.org/ns/sparql-service-description#> .
@prefix search: <http://topbraid.org/search#> .
@prefix search.spin: <http://topbraid.org/search.spin#> .
@prefix server: <http://server.topbraidlive.org/server.ui#> .
@prefix servicedoc: 
<http://server.topbraidlive.org/system-applications/servicedoc#> .
@prefix servicesearch: <http://topbraid.org/swa/servicesearch#> .
@prefix sh: <http://www.w3.org/ns/shacl#> .
@prefix shapesgraph: 
<http://teamwork.topbraidlive.org/shapesgraph/shapesgraphprojects#> .
@prefix sharepoint: <http://topbraid.org/sharepoint#> .
@prefix sharepoint-termstore: 
<http://teamwork.topbraidlive.org/taxonomy/sharepoint-termstore#> .
@prefix sharepoint.spin: <http://topbraid.org/sharepoint.spin#> .
@prefix sioc: <http://rdfs.org/sioc/ns#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix skosapp: <http://evn.topbraidlive.org/uiplugins#> .
@prefix skosshapes: <http://topbraid.org/skos.shapes#> .
@prefix skostemplate: <http://topbraid.org/spin/skostemplates#> .
@prefix skosxl: <http://www.w3.org/2008/05/skos-xl#> .
@prefix sm: <http://topbraid.org/sparqlmotion#> .
@prefix smf: <http://topbraid.org/sparqlmotionfunctions#> .
@prefix sml: <http://topbraid.org/sparqlmotionlib#> .
@prefix soa: <http://www.semanticweb.org/ontologies/2010/01/core-soa.owl#> .
@prefix softwareprojects: 
<http://teamwork.topbraidlive.org/software/softwareprojects#> .
@prefix solr: <http://topbraid.org/solr#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix sparql: <http://datashapes.org/sparql#> .
@prefix sparqlmotionlib-swp: <http://topbraid.org/sparqlmotionlib-swp#> .
@prefix sparqlmotionlib-tbc: <http://topbraid.org/sparqlmotionlib-tbc#> .
@prefix spell: <http://topbraid.org/spellcheckresults#> .
@prefix spif: <http://spinrdf.org/spif#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spin.ui: <http://spinrdf.org/spin.ui#> .
@prefix spinmap: <http://spinrdf.org/spinmap#> .
@prefix spinmapl: <http://topbraid.org/spin/spinmapl#> .
@prefix spinx: <http://spinrdf.org/spinx#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix spl-dynamic-ranges: <http://spinrdf.org/spl-dynamic-ranges#> .
@prefix spr: <http://spinrdf.org/spr#> .
@prefix spra: <http://spinrdf.org/spra#> .
@prefix ss: <http://www.topbraidcomposer.org/owl/2006/08/spreadsheets.owl#> .
@prefix stats: <http://topbraid.org/statistics#> .
@prefix status: <http://topbraid.org/status#> .
@prefix style: <http://uispin.org/style#> .
@prefix suggestions: <http://edg.topbraidlive.org/1.0/spin/suggestions#> .
@prefix svg: <http://uispin.org/svg#> .
@prefix swa: <http://topbraid.org/swa#> .
@prefix swaclasses: <http://topbraid.org/swaclasses#> .
@prefix swadoc: <http://topbraid.org/swadoc#> .
@prefix swaeditor: <http://topbraid.org/swaeditor#> .
@prefix swaowl: <http://topbraid.org/swaowl#> .
@prefix swash: <http://topbraid.org/swash#> .
@prefix swashacl: <http://topbraid.org/swashacl#> .
@prefix swauml: <http://topbraid.org/swauml#> .
@prefix swon: <http://uispin.org/swon#> .
@prefix sxml: <http://topbraid.org/sxml#> .
@prefix tables: <http://topbraid.org/tables#> .
@prefix tablesmap: <http://topbraid.org/spin/tablesmap#> .
@prefix tagger: <http://evn.topbraidlive.org/tagger#> .
@prefix taggerprojects: <http://evn.topbraidlive.org/taggerprojects#> .
@prefix taggerspin: <http://evn.topbraidlive.org/taggerspin#> .
@prefix taggerui: <http://evn.topbraidlive.org/taggerui#> .
@prefix task: <http://topbraid.org/task#> .
@prefix tasks: <http://topbraid.org/tasks#> .
@prefix tasks.spin: <http://topbraid.org/tasks.spin#> .
@prefix taxonomies: <http://evn.topbraidlive.org/evnprojects#> .
@prefix taxonomy: <http://teamwork.topbraidlive.org/taxonomy#> .
@prefix tbgeo: <http://topbraid.org/tbgeo#> .
@prefix tbl: <http://topbraidlive.org/functions#> .
@prefix tbladmin: 
<http://server.topbraidlive.org/system-applications/tbladmin#> .
@prefix tbladmindoc: <http://server.topbraidlive.org/doc/adminguide#> .
@prefix tblinstallguide: <http://server.topbraidlive.org/doc/tblinstallguide#> .
@prefix tblservice: 
<http://server.topbraidlive.org/system-applications/servicesearch/tblservice#> .
@prefix tblshacl: 
<http://server.topbraidlive.org/system-applications/shacl/tblshacl#> .
@prefix tblui: <http://server.topbraidlive.org/tblui#> .
@prefix teaminstallsec: 
<http://teamwork.topbraidlive.org/doc/teamworkInstallGuideSections#> .
@prefix teamwork: <http://topbraid.org/teamwork#> .
@prefix teamworkAdmin: <http://teamwork.topbraidlive.org/doc/teamworkAdmin#> .
@prefix teamworkconfig: 
<http://server.topbraidlive.org/system-applications/teamworkconfig#> .
@prefix teamworkconstraints: <http://topbraid.org/teamworkconstraints#> .
@prefix teamworkdashboard: <http://topbraid.org/teamworkdashboard#> .
@prefix teamworknotifications: <http://topbraid.org/teamworknotifications#> .
@prefix teamworkrules: <http://topbraid.org/teamworkrules#> .
@prefix teamworks3: <http://teamwork.topbraidlive.org/ui/teamworks3#> .
@prefix teamworkscripts: <http://topbraid.org/teamworkscripts#> .
@prefix teamworkupdate: <http://teamworkAPI.topbraid.com/teamworkUpdate#> .
@prefix textindex: <http://topbraid.org/textindex#> .
@prefix tika-importer: <http://teamwork.topbraidlive.org/corpus/tika-importer#> 
.
@prefix tops: <http://www.topbraid.org/tops#> .
@prefix tosh: <http://topbraid.org/tosh#> .
@prefix tosh.ui: <http://topbraid.org/tosh.ui#> .
@prefix tr-org: <http://permid.org/ontology/organization/> .
@prefix tracker: <http://teamwork.topbraidlive.org/ui/tracker#> .
@prefix ui: <http://uispin.org/ui#> .
@prefix uitest: <http://uispin.org/test#> .
@prefix uix: <http://topbraidlive.org/uix#> .
@prefix unit: <http://qudt.org/vocab/unit/> .
@prefix userAdminIndex: <http://evn.topbraidlive.org/userAdminIndex#> .
@prefix userIndex: <http://evn.topbraidlive.org/evndoc.www/userIndex#> .
@prefix userdat: <http://teamwork.topbraidlive.org/ui/userdata> .
@prefix userdata: <http://teamwork.topbraidlive.org/ui/userdata#> .
@prefix usingtagger: <http://evn.topbraidlive.org/taggerdoc.www/usingtagger#> .
@prefix vaem: <http://www.linkedmodel.org/schema/vaem#> .
@prefix victory: <http://edg.topbraid.solutions/victory/> .
@prefix visual: <http://topbraid.org/visual#> .
@prefix voag: <http://voag.linkedmodel.org/voag/> .
@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
@prefix wf: <http://www.w3.org/2005/01/wf/flow#> .
@prefix wot: <http://xmlns.com/wot/0.1/> .
@prefix xhtml: <http://topbraid.org/xhtml#> .
@prefix xhtml1: <http://www.w3.org/1999/xhtml#> .
@prefix xlink: <http://www.w3.org/1999/xlink#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://extensionsamples.topbraid.org/projectconstructors/projectconstructorexample>
  a owl:Ontology ;
  swa:defaultNamespace 
"http://extensionsamples.topbraid.org/projectconstructors/projectconstructorexample#";
 ;
  rdfs:label "ProjectConstructorExample.ui.ttlx" ;
  owl:imports <http://evn.topbraidlive.org/evnprojects> ;
  owl:imports <http://teamwork.topbraidlive.org/ontologyprojects> ;
.
ex:ExampleProjectConstructor
  a ui:Operation ;
  dash:js """let teamGraph = teamwork.currentTeamGraph();
console.log('teamGraph=' + teamGraph);
graph.withDataGraph(teamGraph, () => {
        let prop = graph.namedNode(teamwork.NS + 'viewer');
        graph.add(teamGraph, prop, smf.userWithName('Administrator'));
});""" ;
  ui:prototype """
<ui:group let:teamGraph="{= teamwork:currentTeamGraph() }">
    <ui:setContext ui:queryGraph="{= ?teamGraph }">
        <ui:update ui:updateQuery="{!
                INSERT {
                    ?teamGraph teamwork:viewer ?user .
                }
                WHERE {
                    BIND (smf:userWithName(&quot;Administrator&quot;) AS ?user) 
.
                } }"/>
    </ui:setContext>
</ui:group>
"""^^ui:Literal ;
  rdfs:comment """A script that will be executed when an Ontology asset 
collection is created.

It will assert an extra triple in the TCH graph to make Administrator a 
teamwork:viewer (just for demo purposes).

To try it out, make sure this graph is in the workspace and the workspace has 
been refreshed, then create a new Ontology and look at the Roles tab to confirm 
the viewer role has been added.""" ;
  rdfs:label "Example Project Constructor" ;
  rdfs:subClassOf ui:Operations ;
.
taxonomies:ProjectType
  teamwork:projectConstructor """
<ex:ExampleProjectConstructor/>
"""^^ui:Literal ;
.

Reply via email to