SPARQLMotion Convert RDF To XML doesn't seems to work

31 views
Skip to first unread message

Colin Meerveld

unread,
Feb 27, 2020, 3:37:31 AM2/27/20
to TopBraid Suite Users
Hi,

I try to use a SPARQLMotion script to convert (semantic) xml into a XML document. Unfortunately i am not able to let it work. Here are the main Modules:

export:ApplyTopSPIN
  a sml:ApplyTopSPIN ;
  sm:next export:ConvertRDFToXML ;
  sml:flatten false ;
  sml:predicate spin:rule ;
  sml:replace true ;
  sml:singlePass true ;
  rdfs:label "Apply Inferencing" ;
.
export:ConvertRDFToXML
  a sml:ConvertRDFToXML ;
  sm:outputVariable "archimatexml" ;
  sml:document converter:model ;
  rdfs:label "Convert RDF To XML" ;
.

The expected behavior is that the outputVariable archimatexml has some xml structure but it is always empty. The way it does work is by save the output of export:ApplyTopSPIN to a rdf file. Than i manually select the generated file and choose export > XML from RDF in Composer. Do i miss something?

Cheers,

Colin

Holger Knublauch

unread,
Feb 27, 2020, 4:28:59 AM2/27/20
to topbrai...@googlegroups.com

Hi Colin,

are you sure you want to set sml:replace true? That would remove triples that may be needed, e.g. the imported graphs containing the sxml triples.

It's tricky to help without seeing details. Are you able to package up a minimal executable set of files for us to run and reproduce locally? Feel free to send them to me off-list, if there is private data.

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/8af614c5-7d4a-4475-8ebc-a0e0dab7c802%40googlegroups.com.

Colin Meerveld

unread,
Feb 27, 2020, 5:44:06 AM2/27/20
to TopBraid Suite Users
Hi Holger,

Thanks for helping! I thought sml:replace removed the old inferred data (as you can do manually in composer). This may be the problem and will try it as soon as i am in the office. 

You can find the source on github. It is quite compact. See: https://github.com/btotr/skos2archimate

Thanks,

Colin

To unsubscribe from this group and stop receiving emails from it, send an email to topbrai...@googlegroups.com.

Irene Polikoff

unread,
Feb 27, 2020, 9:53:22 AM2/27/20
to topbrai...@googlegroups.com
Sml:replace removes any data that was provided as input to a step. The output of the step then becomes only data that was produced by the step itself.

Sent from my iPhone
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/cba0b9d7-f761-44df-8c43-3b1104febc5f%40googlegroups.com.

Colin Meerveld

unread,
Feb 27, 2020, 10:50:04 AM2/27/20
to TopBraid Suite Users
I guess that the data produces by the step is sufficient. Anyhow i tried to keep the triples by setting sml:replace to false but it doesn't seems to matter. Any other thoughts?

On Thursday, February 27, 2020 at 3:53:22 PM UTC+1, Irene Polikoff wrote:
Sml:replace removes any data that was provided as input to a step. The output of the step then becomes only data that was produced by the step itself.

Sent from my iPhone

Irene Polikoff

unread,
Feb 27, 2020, 11:16:43 AM2/27/20
to topbrai...@googlegroups.com
I doubt it is sufficient since it only produces new, inferred triples and, as Holger said, other things that may be needed, like at minimum references to included graphs

I can’t offer that much in terms of advise as I don’t have time to debug the code.

You may want to use SM debugger to look at the data in your pipeline after each step. It also helps to start with a very simple, basic transformation script before doing something more complex.

You mentioned saving to a file and then in the next step loading it again? This may be an issue - the file may not be refreshed. I am not sure why you would need this intermediate step.
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/6e289e52-288a-4311-ae12-0992c5f9ff41%40googlegroups.com.

Holger Knublauch

unread,
Feb 27, 2020, 6:07:04 PM2/27/20
to topbrai...@googlegroups.com

Hi Colin,

your script was *almost* correct. The difference (with the attached, fixed, version) is that the sml:document of sml:ConvertRDFToXML needs to point to an instance of sxml:Document which then points at the root element using sxml:root. So I have created a dummy Document such as

converter:TheDocument
  rdf:type sxml:Document ;
  sxml:root converter:model .

and made that the value in the SM module. It now seems to work as expected.

As a further minor change I changed the sml:xml as shown below to be a SPARQL variable expression, which avoids string substitution of the {?...} syntax. I believe that should work better.

HTH
Holger

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/6e289e52-288a-4311-ae12-0992c5f9ff41%40googlegroups.com.
converter.ttl
export.sms.ttl

Colin Meerveld

unread,
Feb 28, 2020, 5:17:49 AM2/28/20
to TopBraid Suite Users
Works like a charm. Your help is much appreciated!  I did tried to add a sxml:Document during the inference phase but somehow didn't had an affect. Since it did worked manually i didn't thought of it anymore. 

I still have a minor issue with the order of the output but could solve this with a xslt transformation in-between. Just for my understanding the sxml:order should tell the RDF-to-XML step to order the elements according to this property, right?

Thanks,

Colin

Holger Knublauch

unread,
Mar 1, 2020, 4:53:14 PM3/1/20
to topbrai...@googlegroups.com


On 28/02/2020 20:17, Colin Meerveld wrote:
Works like a charm. Your help is much appreciated!  I did tried to add a sxml:Document during the inference phase but somehow didn't had an affect. Since it did worked manually i didn't thought of it anymore. 

I still have a minor issue with the order of the output but could solve this with a xslt transformation in-between. Just for my understanding the sxml:order should tell the RDF-to-XML step to order the elements according to this property, right?

For historical reasons, the order of sibling XML elements is determined based on the property http://www.topbraid.org/2007/05/composite.owl#index, which has values such as 0, 1, 2, ...

HTH
Holger


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/b514c7cc-dc04-4fc5-b5a5-262c80d1e0ca%40googlegroups.com.

Colin Meerveld

unread,
Mar 4, 2020, 2:25:46 AM3/4/20
to TopBraid Suite Users
Great, this works!

Thanks,

Colin
Reply all
Reply to author
Forward
0 new messages