Hi Rob,
assuming you're on 7.2, ADS now supports a new API that includes functions like tbs.createAssetCollection which you could theoretically use to create a clone which you later tbs.deleteAssetCollection().
hi
havent been able to find in the docs or examples, but suspect I may be missing something.
I have a DataGraph I want to publish to two different explorer instances - but with different data in each. Some other things may happen - custom review steps - so its going to be in ADS.
So I need an ADS script capable of (say) cloning and modifying an asset collection then pushing the two graphs to two different Explorer instances. Looking at the calls the endpoint and username is picked up from the server config - for a default location.
How should one invoke such services in ADS - is it a matter of building up my own utility library on top of jquery or does something else exist?
Publishing to Explorer is not part of that API (yet). ADS can
make generic web API calls using IO.http() in case you want to
simulate the network traffic that you see, e.g. to invoke the
sendProjects service by hand. That's not an elegant solution, but
from what I see a necessary hack for now. I am not 100% up to date
on the web services but will follow-up here if my colleagues have
a better idea.
Is there any advice re respecting permissions of the user, or allowing the script to do something i dont want the user to do normally ?
ADS scripts cannot switch users, so you'd need to invoke this from a user with sufficient permissions.
Holger
CheersRob
--
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 topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/1a94dfe9-4d1b-4ed6-946d-75adc72e2ed7n%40googlegroups.com.
Hi Rob,
assuming you're on 7.2, ADS now supports a new API that includes functions like tbs.createAssetCollection which you could theoretically use to create a clone which you later tbs.deleteAssetCollection().
On 2022-05-02 3:22 pm, Rob Atkinson wrote:
hi
havent been able to find in the docs or examples, but suspect I may be missing something.
I have a DataGraph I want to publish to two different explorer instances - but with different data in each. Some other things may happen - custom review steps - so its going to be in ADS.
So I need an ADS script capable of (say) cloning and modifying an asset collection then pushing the two graphs to two different Explorer instances. Looking at the calls the endpoint and username is picked up from the server config - for a default location.
How should one invoke such services in ADS - is it a matter of building up my own utility library on top of jquery or does something else exist?
Publishing to Explorer is not part of that API (yet). ADS can make generic web API calls using IO.http() in case you want to simulate the network traffic that you see, e.g. to invoke the sendProjects service by hand. That's not an elegant solution, but from what I see a necessary hack for now. I am not 100% up to date on the web services but will follow-up here if my colleagues have a better idea.
Maybe try graph.swp('teamwork:PublishProjectToNamedExplorer', { ... })
HTH
Holger
tbs.createAssetCollection
is there a way to get access to details without a 7.2 install?
and for general service invocation...
looking for documentation on these i can find graph.swp in the scriptAPI
Thanks Holger
I'm still on 7.1 for now - though after project initial build will have option to upgrade to 7.2 :-(
for the "supported in 7.2" API
I guess my best guess would be to create a proxy function to mirror this 7.2 function.tbs.createAssetCollection
is there a way to get access to details without a 7.2 install?
and for general service invocation...
looking for documentation on these i can find graph.swp in the scriptAPI
but I need then to dive further into
@param {?object} [params] - name-value pairs for the arguments of the element, typically as GraphNodes
so I went looking for the Teamwork functions reference - I notice a lot of the different doc entry points have been cleaned up (a Good Thing) so I'll start with a quick question as to where I would find such documentation now?
The most comprehensive documentation for SWP elements is to just open them in the editor, i.e. with TopBraid EDG Studio just open teamwork.ui.ttlx and you'll see

So it would be something like
graph.swp('teamwork:PublishProjectToNamedExplorer', { projectGraph: 'urn:x-evn-master:mygraph', userName: 'robXY', ... })
The ui:prototype above may answer your other questions.
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/7d43627f-1b6b-403b-8aef-5a3ada815d57n%40googlegroups.com.
_______________________________________________________
|
You received this message because you are subscribed to a topic in the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/topbraid-users/7Lla6sBnK28/unsubscribe.
To unsubscribe from this group and all its topics, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/ce16892d-622a-d192-b8f1-695042de6e80%40topquadrant.com.
The main future-proof pattern would be to use the tbs namespace introduced with 7.2. Where this is not possible (such as here), viewing the SWP and looking at their source code remains the best bet for users with sufficient skills. It's a bit like an open source project, in that sense.
With 7.2 we have introduced the ability to define API functions that are backed by SWP scripts, such as
tbs:createAssetCollection
a ui:JSONService ;
dash:apiStatus dash:Stable ;
dash:canWrite true ;
dash:contextFree true ;
spin:constraint [
a spl:Argument ;
spl:optional true ;
spl:predicate arg:defaultNamespace ;
spl:valueType xsd:string ;
rdfs:comment "The default namespace that shall be used for
new resources." ;
] ;
spin:constraint [
a spl:Argument ;
spl:optional true ;
spl:predicate arg:description ;
spl:valueType xsd:string ;
rdfs:comment "The human-readable description of the new
asset collection." ;
] ;
spin:constraint [
a spl:Argument ;
spl:optional true ;
spl:predicate arg:id ;
spl:valueType xsd:string ;
rdfs:comment """An optional internal identifier of the asset
collection. If none is provided then the system will auto-generate
an id from the name.
If you do provide an id, note that it must follow strict naming
conventions: it must start with a letter and then consist only of
letters, digits or the underscore. The letters are typically
lower-case.""" ;
] ;
spin:constraint [
a spl:Argument ;
spl:predicate arg:name ;
spl:valueType xsd:string ;
rdfs:comment "The human-readable name of the asset
collection." ;
] ;
spin:constraint [
a spl:Argument ;
spl:predicate arg:typeLabel ;
spl:valueType xsd:string ;
rdfs:comment "The (singular) label of the collection type,
e.g. 'Ontology'." ;
] ;
ui:prototype """
<ui:group let:projectType="{=
tbs:assetCollectionTypeWithLabel(?typeLabel) }">
<ui:if ui:condition="{= (!bound(?typeLabel)) ||
(!bound(?projectType)) }">
<ui:throw ui:message="Cannot resolve asset collection
type with label {= ?typeLabel }" ui:statusCode="{= 400 }"/>
</ui:if>
<ui:else let:owlImports="{#
SELECT (GROUP_CONCAT(?import) AS ?result)
WHERE {
GRAPH ui:graph {
?projectType teamwork:owlImports ?import .
} .
} }">
<teamwork:createProject arg:comment="{= ?description }"
arg:defaultNamespace="{= ?defaultNamespace }" arg:name="{= ?name
}" arg:owlImports="{= ?owlImports }" arg:projectType="{=
?projectType }" id="{= ?id }">
<ui:group let:projectGraph="{=
tbs:assetCollectionURI(?graphId) }">
<teamwork:CreateProjectPlugins
arg:projectGraph="{= ?projectGraph }" arg:teamGraph="{=
teamwork:teamGraph(?projectGraph) }"/>
</ui:group>
<ui:return ui:result="{= ?graphId }"/>
</teamwork:createProject>
</ui:else>
</ui:group>
"""^^ui:Literal ;
ui:responseValueType xsd:string ;
rdfs:comment "Creates a new asset collection of a given type.
The new collection will have the current user as manager and no
other role assignments." ;
rdfs:label "create asset collection" ;
rdfs:subClassOf ui:JSONServices ;
.
which then get exposed as Web services and ADS built-ins, see https://www.topquadrant.com/doc/7.2/ext/points.html#ext-services-swp
A possible approach then would be that users that need extra
"stable" features can submit patches to tbs.ui.ttlx, e.g. to add
the service to upload to explorer which wasn't on our radar yet -
there are just so many different things you can do with EDG... We
would put such patches into the next release (which would be every
3 months) as dash:Experimental and dash:Stable one version later,
after which it will be handled with more backward-compatibility
attention.
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAOBWeKu_qeCQofGCZiNRLJtU_1Q_dTuC9yCfOSLY%2B4_GkUJPDA%40mail.gmail.com.
_______________________________________________________
|
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/cdcc5033-d41a-21c3-6436-fb37e8b9bd77%40topquadrant.com.
In the example in the docs the ADS API would be a JavaScript
function
uiservice.ExampleJSONService('World')
to produce the Hello World JSON output. We are using the
namespace tbs, e.g. tbs.createAssetCollection with the same
mechanism.
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAOBWeKs9oTB_9N%2BwB4M19p0EJ_hQ3qHrtchMEBqDSib2sC06VA%40mail.gmail.com.
_______________________________________________________
|
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/48bb2213-be42-edf1-c80f-5e543314e06f%40topquadrant.com.
Not sure what you mean. You can see the generated source code using the Script API Viewer panel. SWP-based ADS functions will internally simply use graph.swp().
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAOBWeKvEaMKy_ZgF%3Dr-CE7N7XE-zYoTs9zt-GWWd9NFEy6ciDg%40mail.gmail.com.