By "Semantic XSD" I mean using Semantic XML with the extended tags and attributes defined in sxsd.rdf.  Note that sxsd.rdf imports sxml.rdf, so if you already have your RDF defined in Semantic XML, all you'd need to do is extend that for some schema definitions, such as the SPARQL transformation I sent earlier.

The XSD exporter was designed for minimal, least common denominator, mappings between OWL and XSD.  Extending that tool to include owl:oneOf-to-xsd:enumeration transformations seems reasonable and we will consider it.  That said it will be  a few weeks our before we could have an enhancement ready.

In the meantime, the sxsd.rdf mappings are the best route and has its advantages because can you fine-tune how your model creates the XML/XSD without interference with how different people may want to interpret OWL-XSD mappings.

-- Scott

On 4/14/11 3:41 PM, Schmitz, Jeffrey A wrote:
Hi Scott,
   When you say "converting the model into Semantic XSD (see sxsd.rdf)" I'm not quite sure I know what you mean.  Can you expand on that?  I see the example for enums, but would I have to write similar scripts to generate all the xsd constructs by "reverse engineering" the model, basically re-doing everything that I think the xml schema export functionality already does?  btw, my current model is based on sxml, e.g. all classes are subclasses of sxml:Element.

Thanks,
Jeff


-----Original Message-----
From: [email protected] [mailto:topbraid-
[email protected]] On Behalf Of Scott Henninger
Sent: Thursday, April 14, 2011 11:53 AM
To: TopBraid Suite Users
Subject: [topbraid-users] Re: XML Schema Export and xsd:enumeration

Jeff, the "XML Schemas from RDF/OWL" exporter does not support
enumerations in this way.  It may be an enhancement we can look into
at some point.

In the meantime, you can accomplish this by converting the model into
Semantic XSD (see sxsd.rdf) and use the Semantic XML converter to
convert into XSD.  For example, the following SPARQL transformation
will create a Semantic XSD structure that is converted to the XSD
shown in your question.

CONSTRUCT
{   ?schema composite:child ?cls .
    ?cls sxsd:name ?name .
    ?cls a sxsd:SimpleType .
    ?restr a sxsd:Restriction .
    ?restr sxsd:base "xsd:string" .
    ?cls composite:child ?restr .
    ?restr composite:child ?elem .
    ?elem a sxsd:Enumeration .
    ?elem sxsd:value ?enumName .
}
WHERE
{   ?cls (rdfs:subClassOf)+ owl:Thing .
    ?cls owl:oneOf ?oneOfList .
    ?oneOfList ((rdf:rest)*)/rdf:first ?elem .
    LET (?name := smf:qname(?cls)) .
    LET (?restr := smf:buildUniqueURI("restr_{?name}")) .
    LET (?enumName := afn:localname(?elem)) .
}

...with ?schema bound to the root of the XSD file.  While the
transformation may seem daunting at first glance, it's fairly simple
when broken down.  The WHERE clause gets each class defined with a
owl:oneOf.  For each match a <simpleType><restriction><enumeration>
tag hierarchy is created, along with the attributes for each.

With this, you can arrange your XSD tags any way you need.  Let us
know how that works for you.

-- Scott

On Apr 13, 1:01 pm, "Schmitz, Jeffrey A"
<[email protected]> wrote:
Hello,
   I'm using the XML Schema Export function on one of my models and
was wondering if there is a way to export xsd enumerations from my
model.  E.g. something like:
<xsd:simpleType name = "iso3currency">

    <xsd:restriction base = "xsd:string">

      <xsd:enumeration value = "AUD"/><!-- Australian Dollar -->

      <xsd:enumeration value = "BRL"/><!-- Brazilian Real -->

      <xsd:enumeration value = "CAD"/><!-- Canadian Dollar -->

      <xsd:enumeration value = "CNY"/><!-- Chinese Yen -->

      <xsd:enumeration value = "EUR"/><!-- Euro -->

      <xsd:enumeration value = "GBP"/><!-- British Pound -->

      <xsd:enumeration value = "INR"/><!-- Indian Rupee -->

      <xsd:enumeration value = "JPY"/><!-- Japanese Yen -->

      <xsd:enumeration value = "RUR"/><!-- Russian Rouble -->

      <xsd:enumeration value = "USD"/><!-- US Dollar -->

      <xsd:length value = "3"/>

    </xsd:restriction>

  </xsd:simpleType>

I tried using the owl:oneOf property in my model to define the
enumeration values for a class, e.g.
<rdf:Description
rdf:about="http://www.boeing.com/sem/acms/ACMS_Datalink_Report.owl#Suff
ix">
    <owl:oneOf
rdf:resource="http://www.boeing.com/sem/acms/ACMS_Datalink_Report.owl#L
DISP1"/>
    <owl:oneOf
rdf:resource="http://www.boeing.com/sem/acms/ACMS_Datalink_Report.owl#R
EECGE"/>
    <owl:oneOf
rdf:resource="http://www.boeing.com/sem/acms/ACMS_Datalink_Report.owl#T
AKEOFF"/>
</rdf:Description>
  <Suffix
rdf:about="http://www.boeing.com/sem/acms/ACMS_Datalink_Report.owl#LDIS
P1">
    <rdfs:label>LDISP1</rdfs:label>
  </Suffix>

but the exporter seems to ignore that.  Is there some other construct
I could use?  If not, could this functionality perhaps be added to the
exporter, perhaps using the enum resource's local name or its
rdfs:label property for the value used in the xml schema?  I'm no xml
schema export, but it seems to me that on the surface they are two
semantically equivalent concepts.
Thanks,
Jeff
--
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

    

--
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