Bob:

Thanks, that was very helpfull.

Derrick

On Sep 15, 2:05 pm, "Bob Ducharme" <[email protected]> wrote:
> I forgot to mention: if you want to create XML from triples that did not
> originate as XML, consider SPARQL Web Pages, which despite their name can
> create any XML you like, not just HTML. That could be simpler.
>
> Bob
>
>
>
> -----Original Message-----
> From: Bob Ducharme [mailto:[email protected]]
> Sent: Thursday, September 15, 2011 1:27 PM
> To: '[email protected]'
> Subject: RE: [topbraid-users] Re: RDF/OWL conversion to XML instancies
>
> Derrick,
>
> The following demonstrates how to create an XML file from an existing model
> that didn't start off as an XML file:
>
> 1. Create a new model
> 2. import /TopBraid/Examples/kennedys.rdf and /TopBraid/TBC/sxml.rdf into it
> 3. run the query below
> 4. assert the triples it creates
> 5. do a Save As to a file with an extension of .xml
>
> You will see an XML file following this pattern:
>
>    <kennedies>
>        <kennedy birthYear="1923">Peter Lawford</kennedy>
>        <kennedy birthYear="1967">Alfred Tucker</kennedy>
>        <kennedy birthYear="1928">Jean Kennedy</kennedy>
>        <!-- etc. -->
>    </kennedies>
>
> The query:
>
>    CONSTRUCT {
>      :kennedys a owl:Class;
>                rdfs:subClassOf owl:Thing ;
>                sxml:element "kennedies" ;
>                rdfs:label "kennedies" .
>      :kennedy-birthYear a owl:DatatypeProperty ;
>           sxml:attribute "birthYear" ;
>           rdfs:label "color" ;
>           rdfs:domain :kennedy .
>      :Document a sxml:Document ;
>                sxml:root :kennedysInstance .
>      :kennedysInstance a :kennedys ;
>                composite:child ?k .
>      :kennedy a owl:Class;
>               rdfs:subClassOf owl:Thing ;
>               sxml:element "kennedy" ;
>               rdfs:label "kennedy" .
>      ?k rdf:type :kennedy ;
>         :kennedy-birthYear ?birthYear ;
>         composite:child _:textNode .
>      _:textNode rdf:type sxml:TextNode ;
>                 sxml:text ?fullName .
>    }
>    WHERE {
>      ?k a kennedys:Person ;
>         kennedys:birthYear ?birthYear ;
>         kennedys:firstName ?firstName ;
>         kennedys:lastName ?lastName .
>      BIND (concat(?firstName," ",?lastName) as ?fullName ).
>    }
>
> If I was going to do this with additional Kennedys data as on a regular
> basis, I would split up the query above into different SPIN rules for the
> appropriate classes, but your data will have different classes, so where you
> put the SPIN rules depends on what classes you're working with. (I also
> would define a prefix for my new file and use it in the SPARQL query instead
> of the default prefix of :, but this was just a quick example for demo
> purposes.) All the logic is demonstrated in the query above, though: which
> classes and properties need to be declared, how to get data into the XML
> elements and attributes, and what has to point at what.
>
> To put the result XML's kennedy elements in a specific order in the XML, I
> would have set the composite:index property for each ?k instance to 1, 2, 3,
> etc.
>
> If you create an XML document that looks like the target you'd like to
> export to and then import it as semantic XML, you'll see the kinds of
> classes and properties that TopBraid uses to represent that XML document as
> triples, and can use logic like that shown above to create them.
>
> See also the TopBraid Composer help: TopBraid Composer > Import and Export >
> Handling XML documents with Semantic XML (ME).
>
> Bob
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> [email protected]
> Sent: Thursday, September 15, 2011 10:49 AM
> To: TopBraid Suite Users
> Subject: [topbraid-users] Re: RDF/OWL conversion to XML instancies
>
> Bob:
>
> Could you provide or point me to an example of the type of SPIN rules
> to do this?
>
> Derrick
>
> On Sep 15, 9:08 am, "Bob Ducharme" <[email protected]> wrote:
> > Right now there is no automated export of instances conforming to a
> > particular OWL model to XML.
>
> > TopBraid's Semantic XML (SXML) ontology makes it possible to import XML as
> > triples and then round-trip it back to XML, and would make it possible to
> > create new XML documents from existing triples. If you create an XML
> > document following the model you'd like to see exported and then, in
> > TopBraid Composer, right-click it in the Navigator and pick Open With
> > TopBraid (Semantic XML Documents), it will open it as RDF with the sxml
> > ontology imported. Editing and saving it will save it as XML.
>
> > To save the instances described below as XML, you could use SPARQL (in
> SPIN
> > rules attached to each class to transform, if you wanted to automate this)
> > to create semantic XML triples following the example of the imported
> > document described above from your existing triples and then save that.
>
> > Bob DuCharme
>
> > -----Original Message-----
> > From: [email protected]
>
> > [mailto:[email protected]] On Behalf Of
> > [email protected]
> > Sent: Wednesday, September 14, 2011 12:40 PM
> > To: TopBraid Suite Users
> > Subject: [topbraid-users] RDF/OWL conversion to XML instancies
>
> > I have created a very simple OWL Class that subclasses  owl:Thing. It
> > contains one object reference and 5 data type properties. I will
> > eventually have several dozen instances of this class that must be to
> > converted to XML for use by software programs. The XML
> > conversion(Manual process using TBM to date) produced a reasonable XSD
> > but no instances. What must I do to get them? In addition, the object
> > property in the schema I would like to be converted to its URI in the
> > resulting xml. Is this doable? Currently using version 3.4.0. Any
> > insight would be helpful.
>
> > --
> > You received this message because you are subscribed to the Google
> > Group "TopBraid Suite Users", the topics of which include TopBraid
> Composer,
> > TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
> > To post to this group, send email to
> > [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group
> athttp://groups.google.com/group/topbraid-users?hl=en-Hide quoted text -
>
> > - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google
> Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
> TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
> To post to this group, send email to
> [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group 
> athttp://groups.google.com/group/topbraid-users?hl=en- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en

Reply via email to