<ui:group let:extension=".ttl"
let:myGraphU="{= ui:graphWithImports(IRI(?graph)) }"
let:myInstance="{= IRI(?instance) }"
let:newPath="{= CONCAT("/generatedFiles/", xsd:string(?folder), "/") }">
<ui:debug>
<span>Inside VersionlessIndividual. Value of ?newPath is {= ?newPath }</span>
</ui:debug>
<ui:dumpScope ui:message="AAA:VersionlessIndividual, newPath= {= ?newPath }"/>
<ui:group let:localName="{= afn:localname(?myInstance) }">
<ui:group let:newFile="{= CONCAT(?newPath, ?localName, ?extension) }">
<ui:dumpResultSet ui:message="AAA:VersionlessGraph, newUnit= " ui:resultSet="{= ?instance }"/>
<ui:setContext ui:silentTransactions="true">
<ui:setContext ui:queryGraph="ui:tempGraph">
<!-- Clear out the working graph-->
<ui:update ui:updateQuery="{!
DELETE {
GRAPH ui:tempGraph {
?s ?p ?o .
} .
}
WHERE {
?s ?p ?o .
} }"/>
<ui:update ui:updateQuery="{!
INSERT {
GRAPH ui:tempGraph {
?myInstance ?p ?o .
} .
}
WHERE {
GRAPH ?myGraphU {
?myInstance ?p ?o .
} .
} }"/>
<ui:return/>
</ui:setContext>
</ui:setContext>
</ui:group>
</ui:group>
</ui:group>
...which produces the following file:

I want all the stuff inside the [] to show up as well!
Hi Steve,
you could just use SPARQL DESCRIBE queries, which will compute the graph for a resource including its depending blank nodes, e.g.
DESCRIBE <http://topquadrant.com/ns/examples/geography#Country>
via the SPARQL endpoint.
Holger
--
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/CAGUep85DXyHFA%3DwmgdArgZnw-k6EHPJ5AsRDwYsHBT65sU2csg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/94b728c4-5723-9bf7-a406-01990f7a7b2f%40topquadrant.com.
On the server that hosts your namespace, can't you set up a rewrite that generates
http://mytopbraid...:8083/tbl/sparql?query=DESCRIBE%20<XY>
where you replace XY with the URL-encoded URI of the resource that was requested? See e.g.
https://httpd.apache.org/docs/2.4/rewrite/remapping.html
but this sounds like a problem someone must have solved before.
Given that you plan to call a SWP service, how do you currently
redirect the URLs to invoke said service?
You cannot use DESCRIBE in ui:TurtleService and I am not aware of a magic property that would get all depending triples of the concise bounded description. SPARQL is not good at recursion.
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAGUep872hEg4vbd8cnFczKWedgPjUTsMa%2BAhx-3cjQ5E55zkWg%40mail.gmail.com.
To take this one step further, EDG supports using SHACL to provide view options in the UI.
it strikes me this is equally relevant to the serialisation of a specific object in TTL (or anything else).
Is there an equivalent service that can do this?
One option that occurred to me would be to create a graphQL template based on a nodeshape - then the result (currently serialised as json) could perhaps be serialised as json-ld and ttl
GraphQL is not good at recursion - it can only produce JSON that has a similar structure to the query clauses. So a query with depth 3 can only go 3 levels of bnodes deep. In cases like OWL rdfs:subClassOf ... owl:Restriction ... where the structure of the classes is difficult to predict it will be an overkill to first try to build such a complex GraphQL query.
In SWP this can be achieved through a recursive helper element
that walks objects as long as they are blank nodes and collects
all triples in the ui:tempGraph. In Active Data Shapes (ADS) such
recursion is easily done because it's JavaScript, yet ADS doesn't
have a simple way to produce Turtle yet.
This also leads to the question of how to best work with blank nodes in SHACL
this seems to be bypassed in the UI - it does this traversal with a function.
query: "query getSuitableViewShapes($uri: ID!) {↵ resources(uri: $uri) {↵
Is there any way of doing something similar with a user defined shape that can traverse blank nodes?
Potentially yes, and I probably prototyped something along those lines at some stage.
In cases like our form editors and viewers, the system only
fetches the top-level triples and if it's a blank node then each
widget may make additional requests to walk the structure. For
many types of blank nodes we also already have string/label
renderers.
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/d0f07d25-9c0d-404b-a944-0321affd7a9an%40googlegroups.com.
In Active Data Shapes (ADS) such recursion is easily done because it's JavaScript, yet ADS doesn't have a simple way to produce Turtle yet.
This info is now outdated. I have just added a quick new function IO.serializeRDF to ADS for 7.0, and it can be used to produce any subgraphs including the concise bounded description as follows:

This can be combined with the newly added support for defining ADS Web services in 7.0:
http://datashapes.org/active/service.html#response-rdf
and then be called like this:

BTW the query behind the Source Code panel can also be used for
this particular task, which is why I am showing it in the first
screenshot. However, I wanted to come up with a more general
solution here.
HTH
Holger
--
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/c5947d28-d86c-af45-0942-320535adef69%40topquadrant.com.
There is an undocumented SPARQL function
BIND (<http://datashapes.org/generic#getTurtleSourceCode>(?this) AS ?src)
that corresponds to what the Source Code panel of the EDG editor
shows. The Linked Data community may not be happy because this
only produces TTL, not RDF/XML though.
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAGUep85FMUhYzd1D-ojFieP8wnDvzf8CbJb_0hrdsV38r5A_Yg%40mail.gmail.com.

--
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/c5947d28-d86c-af45-0942-320535adef69%40topquadrant.com.
Hi Steve,
you were really close, mate. When you enter URLs from the Swagger
UI, it will do the URL-encoding for you, so just use URI and then
http://qudt.org/schema/qudt/Unit as second param and it will work.
As written, it would have been double-escaped.
This however assumes that you change the dash:js to
graph.triples(focusNode, null, null)
because the engine will only return Turtle if the result of the
JS is an array of triples. Just doing "focusNode" would not have
been an array. (You can of course produce the array differently -
the above graph.triples() function was just the quickest way. Note
this won't include transitive bnodes, but I sent you that snippet
in case you need it earlier in this thread.
HTH
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAGUep87Drqs5SB6A-Dh6SPmAW7Qq2mD960KDne0vZ1o%2BR09sKQ%40mail.gmail.com.
@prefix ADS_QUDT-WEBSITE-v2-1: <http://r2.qudt.org/website/ADS_QUDT-WEBSITE-v2-1#> . @prefix afn: <http://jena.hpl.hp.com/ARQ/function#> . @prefix arg: <http://spinrdf.org/arg#> . @prefix constant: <http://qudt.org/vocab/constant/> . @prefix creativecommons: <http://creativecommons.org/ns#> . @prefix dash: <http://datashapes.org/dash#> . @prefix dc: <http://purl.org/dc/elements/1.1/> . @prefix dct: <http://purl.org/dc/terms/> . @prefix dcterms: <http://purl.org/dc/terms/> . @prefix dtype: <http://www.linkedmodel.org/schema/dtype#> . @prefix edg: <http://edg.topbraid.solutions/model/> . @prefix fn: <http://www.w3.org/2005/xpath-functions#> . @prefix functions: <http://qudt.org/2.1/schema/extensions/functions#> . @prefix graphql: <http://datashapes.org/graphql#> . @prefix imports: <http://qudt.org/2.1/schema/extensions/imports#> . @prefix mc: <http://www.linkedmodel.org/owl/schema/core#> . @prefix metadata: <http://topbraid.org/metadata#> . @prefix owl: <http://www.w3.org/2002/07/owl#> . @prefix prefix: <http://qudt.org/vocab/prefix/> . @prefix prov: <http://www.w3.org/ns/prov#> . @prefix qkdv: <http://qudt.org/vocab/dimensionvector/> . @prefix quantitykind: <http://qudt.org/vocab/quantitykind/> . @prefix qudt: <http://qudt.org/schema/qudt/> . @prefix qudt.type: <http://qudt.org/vocab/type/> . @prefix qudt_owl_schema: <http://example.org/ontologies/QUDT_OWL_Schema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix sh: <http://www.w3.org/ns/shacl#> . @prefix skos: <http://www.w3.org/2004/02/skos/core#> . @prefix skosxl: <http://www.w3.org/2008/05/skos-xl#> . @prefix smf: <http://topbraid.org/sparqlmotionfunctions#> . @prefix sou: <http://qudt.org/vocab/sou/> . @prefix sp: <http://spinrdf.org/sp#> . @prefix spif: <http://spinrdf.org/spif#> . @prefix spin: <http://spinrdf.org/spin#> . @prefix spl: <http://spinrdf.org/spl#> . @prefix swa: <http://topbraid.org/swa#> . @prefix teamwork: <http://topbraid.org/teamwork#> . @prefix teamworkconstraints: <http://topbraid.org/teamworkconstraints#> . @prefix tosh: <http://topbraid.org/tosh#> . @prefix unit: <http://qudt.org/vocab/unit/> . @prefix vaem: <http://www.linkedmodel.org/schema/vaem#> . @prefix voag: <http://voag.linkedmodel.org/schema/voag#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . qudt:acronym rdf:type owl:DatatypeProperty ; rdfs:isDefinedBy <http://qudt.org/2.1/schema/qudt> ; rdfs:label "acronym" ; rdfs:range xsd:string ; .
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/4e091f50-cdc3-6c1f-d41d-6c8d8452a648%40topquadrant.com.
This is great - it works!The one "hack" I had to do in my service file was to declare various other owl entities as NodeShapes. I tried just declaring rdfs:Resource as a NodeShape, hoping all the subClasses would inherit the NodeShapeness, but that did not work. So instead, I have added lines like the following in my service file:
owl:ObjectPropertyrdf:type sh:NodeShape ;dash:resourceService qudt:TurtleSnippet ;.owl:DatatypePropertyrdf:type sh:NodeShape ;dash:resourceService qudt:TurtleSnippet ;.rdf:Propertyrdf:type sh:NodeShape ;dash:resourceService qudt:TurtleSnippet ;.qudt:Unitrdf:type sh:NodeShape ;dash:resourceService qudt:TurtleSnippet ;.
I recognize that I'm trying to get the benefit of ADS while servicing "pure" OWL ontologies, without altering the OWL schema file, but it works.
One final question - the output lists an enormous number of prefix declarations, most of which are not relevant to the entity. Does the service just dump all defined prefixes? Any way I can throttle that?
No, the algorithm isn't smart enough to analyze which prefixes
are actually used. If that's bothering you, you could first build
the string with IO.serializeRDF(triples) and then delete certain
lines. That is quite a hack though. In the end it's just cosmetic
I guess - the receiving apps shouldn't bother.
Holger
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/CAGUep84kbGf35kBnywaa-9B_FBV%2BeReLAfifCQ-6djPiPB%2BFsQ%40mail.gmail.com.