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


On 28/02/2020 01:50, Colin Meerveld wrote:
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

    On Feb 27, 2020, at 5:44 AM, Colin Meerveld <colin....@gmail.com
    <javascript:>> wrote:

    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
    <https://github.com/btotr/skos2archimate>

    Thanks,

    Colin


    On Thursday, February 27, 2020 at 10:28:59 AM UTC+1, Holger
    Knublauch wrote:

        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


        On 27/02/2020 18:27, Colin Meerveld wrote:
        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
-- 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 topbrai...@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
        
<https://groups.google.com/d/msgid/topbraid-users/8af614c5-7d4a-4475-8ebc-a0e0dab7c802%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 topbrai...@googlegroups.com <javascript:>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/topbraid-users/cba0b9d7-f761-44df-8c43-3b1104febc5f%40googlegroups.com
    
<https://groups.google.com/d/msgid/topbraid-users/cba0b9d7-f761-44df-8c43-3b1104febc5f%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 topbraid-users+unsubscr...@googlegroups.com <mailto:topbraid-users+unsubscr...@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 <https://groups.google.com/d/msgid/topbraid-users/6e289e52-288a-4311-ae12-0992c5f9ff41%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 topbraid-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/topbraid-users/bd4b2b77-b54e-8a72-a4d2-1cf3a692b9b9%40topquadrant.com.
# baseURI: http://archimate.politie.nl/skos2archimate/converter
# imports: http://definities.politie.nl/iv
# imports: http://spinrdf.org/spin
# imports: http://www.opengroup.org/xsd/archimate/3.0/
# imports: http://www.w3.org/XML/1998/namespace
# prefix: converter

@prefix converter: <http://archimate.politie.nl/skos2archimate/converter#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix s2a: <http://archimate.politie.nl/skos2archimate#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix sxml: <http://topbraid.org/sxml#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix xsi: <http://www.w3.org/2001/XMLSchema-instance#> .

<http://archimate.politie.nl/skos2archimate/converter>
  a owl:Ontology ;
  owl:imports <http://definities.politie.nl/iv> ;
  owl:imports <http://spinrdf.org/spin> ;
  owl:imports <http://www.opengroup.org/xsd/archimate/3.0/> ;
  owl:imports <http://www.w3.org/XML/1998/namespace> ;
.
converter:TheDocument
  a sxml:Document ;
  sxml:root converter:model ;
  rdfs:label "The document" ;
.
converter:mapping
  a spin:ConstructTemplate ;
  spin:body [
      a sp:Construct ;
      sp:templates (
          [
            sp:object <http://www.opengroup.org/xsd/archimate/3.0/Model> ;
            sp:predicate rdf:type ;
            sp:subject converter:model ;
          ]
          [
            sp:object "http://www.opengroup.org/xsd/archimate/3.0/"; ;
            sp:predicate xsi:schemaLocation ;
            sp:subject converter:model ;
          ]
          [
            sp:object <http://www.opengroup.org/xsd/archimate/3.0/nameRef> ;
            sp:predicate rdf:type ;
            sp:subject converter:model-name ;
          ]
          [
            sp:object "informatieobjectenmodel" ;
            sp:predicate <http://www.linkedmodel.org/schema/dtype#value> ;
            sp:subject converter:model-name ;
          ]
          [
            sp:object converter:model-name ;
            sp:predicate <http://www.opengroup.org/xsd/archimate/3.0/nameRef> ;
            sp:subject converter:model ;
          ]
          [
            sp:object "id-f9013866-8b94-44a1-a570-7b14982366a0" ;
            sp:predicate 
<http://www.opengroup.org/xsd/archimate/3.0/identifier> ;
            sp:subject converter:model ;
          ]
          [
            sp:object <http://www.opengroup.org/xsd/archimate/3.0/ElementsType> 
;
            sp:predicate rdf:type ;
            sp:subject converter:elements ;
          ]
          [
            sp:object converter:elements ;
            sp:predicate 
<http://www.opengroup.org/xsd/archimate/3.0/elementsRef> ;
            sp:subject converter:model ;
          ]
          [
            sp:object 
<http://www.opengroup.org/xsd/archimate/3.0/BusinessObject> ;
            sp:predicate rdf:type ;
            sp:subject [
                sp:varName "businessObject" ;
              ] ;
          ]
          [
            sp:object [
                sp:varName "businessObject" ;
              ] ;
            sp:predicate 
<http://www.opengroup.org/xsd/archimate/3.0/elementRef> ;
            sp:subject converter:elements ;
          ]
          [
            sp:object [
                sp:varName "name" ;
              ] ;
            sp:predicate <http://www.opengroup.org/xsd/archimate/3.0/nameRef> ;
            sp:subject [
                sp:varName "businessObject" ;
              ] ;
          ]
          [
            sp:object [
                sp:varName "definition" ;
              ] ;
            sp:predicate 
<http://www.opengroup.org/xsd/archimate/3.0/documentationRef> ;
            sp:subject [
                sp:varName "businessObject" ;
              ] ;
          ]
          [
            sp:object [
                sp:varName "cname" ;
              ] ;
            sp:predicate 
<http://www.opengroup.org/xsd/archimate/3.0/identifier> ;
            sp:subject [
                sp:varName "businessObject" ;
              ] ;
          ]
          [
            sp:object "BusinessObject" ;
            sp:predicate xsi:type ;
            sp:subject [
                sp:varName "businessObject" ;
              ] ;
          ]
          [
            sp:object 
<http://www.opengroup.org/xsd/archimate/3.0/documentationRef> ;
            sp:predicate rdf:type ;
            sp:subject [
                sp:varName "definition" ;
              ] ;
          ]
          [
            sp:object [
                sp:varName "definitionText" ;
              ] ;
            sp:predicate <http://www.linkedmodel.org/schema/dtype#value> ;
            sp:subject [
                sp:varName "definition" ;
              ] ;
          ]
          [
            sp:object 2 ;
            sp:predicate sxml:order ;
            sp:subject [
                sp:varName "definition" ;
              ] ;
          ]
          [
            sp:object <http://www.opengroup.org/xsd/archimate/3.0/nameRef> ;
            sp:predicate rdf:type ;
            sp:subject [
                sp:varName "name" ;
              ] ;
          ]
          [
            sp:object [
                sp:varName "labelSpecialisatie" ;
              ] ;
            sp:predicate <http://www.linkedmodel.org/schema/dtype#value> ;
            sp:subject [
                sp:varName "name" ;
              ] ;
          ]
          [
            sp:object 1 ;
            sp:predicate sxml:order ;
            sp:subject [
                sp:varName "name" ;
              ] ;
          ]
        ) ;
      sp:where (
          [
            sp:object "Dossier"@nl ;
            sp:predicate <http://www.w3.org/2004/02/skos/core#prefLabel> ;
            sp:subject spin:_this ;
          ]
          [
            sp:object spin:_this ;
            sp:predicate <http://www.w3.org/2004/02/skos/core#broader> ;
            sp:subject [
                sp:varName "specialisatie" ;
              ] ;
          ]
          [
            a sp:NotExists ;
            sp:elements (
                [
                  sp:object <http://definities.politie.nl/im/id/begrip/Relatie> 
;
                  sp:predicate <http://www.w3.org/2004/02/skos/core#broader> ;
                  sp:subject [
                      sp:varName "specialisatie" ;
                    ] ;
                ]
              ) ;
          ]
          [
            sp:object [
                sp:varName "labelSpecialisatie" ;
              ] ;
            sp:predicate <http://www.w3.org/2004/02/skos/core#prefLabel> ;
            sp:subject [
                sp:varName "specialisatie" ;
              ] ;
          ]
          [
            a sp:Optional ;
            sp:elements (
                [
                  sp:object [
                      sp:varName "definitionText" ;
                    ] ;
                  sp:predicate <http://www.w3.org/2004/02/skos/core#definition> 
;
                  sp:subject [
                      sp:varName "specialisatie" ;
                    ] ;
                ]
              ) ;
          ]
          [
            a sp:Bind ;
            sp:expression [
                a sp:encode_for_uri ;
                sp:arg1 [
                    sp:varName "labelSpecialisatie" ;
                  ] ;
              ] ;
            sp:variable [
                sp:varName "id" ;
              ] ;
          ]
          [
            a sp:Bind ;
            sp:expression [
                a sp:concat ;
                sp:arg1 "id-" ;
                sp:arg2 [
                    a sp:str ;
                    sp:arg1 [
                        a sp:floor ;
                        sp:arg1 [
                            a sp:mul ;
                            sp:arg1 [
                                a sp:rand ;
                              ] ;
                            sp:arg2 100000 ;
                          ] ;
                      ] ;
                  ] ;
              ] ;
            sp:variable [
                sp:varName "cname" ;
              ] ;
          ]
          [
            a sp:Bind ;
            sp:expression [
                a sp:iri ;
                sp:arg1 [
                    a sp:concat ;
                    sp:arg1 "http://archimate.politie.nl/naam/"; ;
                    sp:arg2 [
                        sp:varName "id" ;
                      ] ;
                  ] ;
              ] ;
            sp:variable [
                sp:varName "name" ;
              ] ;
          ]
          [
            a sp:Bind ;
            sp:expression [
                a sp:iri ;
                sp:arg1 [
                    a sp:concat ;
                    sp:arg1 "http://archimate.politie.nl/definitie/"; ;
                    sp:arg2 [
                        sp:varName "id" ;
                      ] ;
                  ] ;
              ] ;
            sp:variable [
                sp:varName "definition" ;
              ] ;
          ]
          [
            a sp:Bind ;
            sp:expression [
                a sp:concat ;
                sp:arg1 "http://archimate.politie.nl/businessObject/"; ;
                sp:arg2 [
                    sp:varName "id" ;
                  ] ;
              ] ;
            sp:variable [
                sp:varName "businessObjectId" ;
              ] ;
          ]
          [
            a sp:Bind ;
            sp:expression [
                a sp:iri ;
                sp:arg1 [
                    sp:varName "businessObjectId" ;
                  ] ;
              ] ;
            sp:variable [
                sp:varName "businessObject" ;
              ] ;
          ]
        ) ;
    ] ;
  spin:labelTemplate "mapping" ;
  rdfs:subClassOf spin:ConstructTemplates ;
.
<http://www.opengroup.org/xsd/archimate/3.0/Model>
  sxml:prefix "archimate" ;
.
xsi:schemaLocation
  a owl:DatatypeProperty ;
  sxml:attribute "xsi:schemaLocation" ;
  rdfs:label "xsi:schemaLocation" ;
.
xsi:type
  a owl:DatatypeProperty ;
  sxml:attribute "xsi:type" ;
  rdfs:label "xsi:type" ;
.
<http://www.w3.org/2004/02/skos/core#Concept>
  spin:rule [
      a converter:mapping ;
    ] ;
.
# baseURI: http://archimate.politie.nl/skos2archimate/service/export
# imports: http://topbraid.org/sparqlmotionlib
# prefix: export

@prefix arg: <http://spinrdf.org/arg#> .
@prefix converter: <http://archimate.politie.nl/skos2archimate/converter#> .
@prefix dbp: <http://dbpedia.org/property/> .
@prefix dbpo: <http://dbpedia.org/ontology/> .
@prefix endpoint: <http://archimate.politie.nl/skos2archimate/service#> .
@prefix export: <http://archimate.politie.nl/skos2archimate/service/export#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sm: <http://topbraid.org/sparqlmotion#> .
@prefix smf: <http://topbraid.org/sparqlmotionfunctions#> .
@prefix sml: <http://topbraid.org/sparqlmotionlib#> .
@prefix sp: <http://spinrdf.org/sp#> .
@prefix spin: <http://spinrdf.org/spin#> .
@prefix spl: <http://spinrdf.org/spl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://archimate.politie.nl/skos2archimate/service/export>
  a owl:Ontology ;
  owl:imports <http://topbraid.org/sparqlmotionlib> ;
  owl:versionInfo "simple example for sparqlMotion" ;
.
export:ApplyTopSPIN
  a sml:ApplyTopSPIN ;
  sm:next export:ConvertRDFToXML ;
  sm:nodeX 446 ;
  sm:nodeY 457 ;
  sml:flatten false ;
  sml:predicate spin:rule ;
  sml:replace false ;
  sml:singlePass true ;
  rdfs:label "Apply Inferencing" ;
.
export:ConvertRDFToXML
  a sml:ConvertRDFToXML ;
  sm:next export:Response ;
  sm:nodeX 440 ;
  sm:nodeY 668 ;
  sm:outputVariable "archimatexml" ;
  sml:document converter:TheDocument ;
  rdfs:label "Convert RDF To XML" ;
.
export:ImportConverter
  a sml:ImportRDFFromWorkspace ;
  sm:next export:ApplyTopSPIN ;
  sm:nodeX 454 ;
  sm:nodeY 256 ;
  sml:baseURI "http://archimate.politie.nl/skos2archimate/converter"; ;
  sml:ignoreImports false ;
  sml:sourceFilePath "converter.ttl" ;
  rdfs:label "Import converter" ;
.
export:Response
  a sml:ReturnXML ;
  sm:nodeX 475 ;
  sm:nodeY 876 ;
  sml:mimeType "text/xml" ;
  sml:xml [
      sp:varName "archimatexml" ;
    ] ;
  rdfs:label "response" ;
.

Reply via email to