IO.serializeRDF

56 views
Skip to first unread message

Steve Ray

unread,
Jun 23, 2022, 10:36:34 AM6/23/22
to TopBraid Suite Users
Hi,
I have until recently been successfully using IO.serializeRDF in a dash:ResourceService. I'm running TBC-ME 7.0 for reasons I will explain below.

However, I'm now getting an error message when I call it. My current hypothesis:

1. The EDG collection that contains my code used to also include a graph "DASH Data Shapes Vocabulary", but the last time I rebuilt my workspace, that graph mysteriously no longer appears in the available graphs to include. Is it possible that IO.serializeRDF is thus not visible?


In a possibly related problem, I also no longer see teamwork.topbraidlive.org in my TBC-ME workspace in versions higher than 7.0, and my SWP scripts depended on it. Hence, until I figure out how to adapt, I am stuck running 7.0 for my services.

Help, please!


Steve


Holger Knublauch

unread,
Jun 23, 2022, 7:05:54 PM6/23/22
to topbrai...@googlegroups.com


On 2022-06-24 12:36 am, Steve Ray wrote:
Hi,
I have until recently been successfully using IO.serializeRDF in a dash:ResourceService. I'm running TBC-ME 7.0 for reasons I will explain below.
However, I'm now getting an error message when I call it. My current hypothesis:
1. The EDG collection that contains my code used to also include a graph "DASH Data Shapes Vocabulary", but the last time I rebuilt my workspace, that graph mysteriously no longer appears in the available graphs to include. Is it possible that IO.serializeRDF is thus not visible?

To check whether dash is really not imported you could run a query such as

SELECT DISTINCT ?g { ?x owl:imports ?g }

in the SPARQL query panel. Under normal circumstances there is always some subgraph in your EDG graphs that will owl:import dash.

Even if not, IO.serializeRDF should be there. I checked that it was introduced with TB 7.0.0.

What error message do you get when you invoke it?

In a possibly related problem, I also no longer see teamwork.topbraidlive.org in my TBC-ME workspace in versions higher than 7.0, and my SWP scripts depended on it. Hence, until I figure out how to adapt, I am stuck running 7.0 for my services.

Yeah, TBC 7.1 had been further simplified and decoupled from EDG. If you're a typical TBC user that has used TBC for a long time, there is really no reason to upgrade to that version.

For the latest features such as ADS improvements, EDG Studio is a much better choice as it evolves alongside the EDG product. However that requires a different license altogether.

Holger


Help, please!


Steve


--
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/CAGUep87iDuzZ2P1%3DYn05XKDaXAfAZKxz5mv4amsBfOZ%3DRfX1Fw%40mail.gmail.com.

Steve Ray

unread,
Jun 24, 2022, 10:13:29 AM6/24/22
to TopBraid Suite Users
Holger,
Here's the error message I receive (I'm using Postman to send the web service request)

Cannot evaluate Script:org.topbraid.core.servlet.HttpErrorException: Failed service request /qudt_owl_schema/qudt/TurtleSnippet/URI/http://qudt.org/schema/qudt/Unit: TypeError: (intermediate value).serializeRDF is not a function

I have attached a json file containing the results of the owl:imports query you suggested. You will see I added a few extra EDG graphs in the hope of bringing in io.serializeRDF. I don't see any dash graph, except for the GraphQL one.

Finally, I also just did a recursive search of my workspace to see if I could find any occurrence of "serializeRDF" that yielded zero hits. Where does the function definition reside?

Steve




export.json

Steve Ray

unread,
Jun 24, 2022, 11:18:03 AM6/24/22
to TopBraid Suite Users
Holger, in case it helps, here's the service I defined.


qudt:TurtleSnippet

  rdf:type dash:ResourceService ;

  dash:js """function collectTriples(subject, triples) {

    graph.triples(subject, null, null, true).forEach(t => {

        triples.push(t);

        if(t.object.isBlankNode()) {

            collectTriples(t.object, triples);

        }

    })

}


let triples = [];

collectTriples(focusNode, triples);

IO.serializeRDF(triples);""" ;

  dash:responseContentType "text/turtle" ;

  rdfs:label "Turtle Snippet" ;

.



Steve




On Thu, Jun 23, 2022 at 7:05 PM Holger Knublauch <hol...@topquadrant.com> wrote:

Holger Knublauch

unread,
Jun 25, 2022, 8:55:09 PM6/25/22
to topbrai...@googlegroups.com

Hi Steve,

I have no explanation why it wouldn't find that function. So I would suggest we take it step by step.

When you enter IO. in the script editor, does it look like this?

The IO functions are defined in the file TopBraid\SHACL\js\io.js - can you see the function there? Maybe the file is from an older workspace from an older TopBraid version.

You should also see the definition when you open the Script API viewer:

HTH
Holger

Steve Ray

unread,
Jun 27, 2022, 11:40:47 AM6/27/22
to topbrai...@googlegroups.com
Holger,
Thanks for all your help. I finally got things working again with TBC-ME 7.0 by completely reinstalling it from the original zip file. Deleting and recreating the workspace wasn't enough. Whatever gremlin was in there was finally eliminated, and now the IO javascript calls are back, and my ADS service works again.

Thanks again,
Steve




Reply all
Reply to author
Forward
0 new messages