Excellent!  Now I got it.

So the real key is to let ConvertXMLtoRDF do its thing, and then use
an ApplyConstruct module to clean up the triples to fit the existing
ontology.

First, I removed all the sxml:element annotations from my existing
ontology.  They seemed to have no effect anyway.  Next, I used the
following input xml to ConvertXMLtoRDF:

<Environment name="TestEnv" hasLatitudeDegrees="50"></Environment>

I connected this to an ApplyConstruct module with the following
construct statement, with replace="true":

CONSTRUCT {
    ?uri a :Environment .
    ?uri :hasLatitudeDegrees ?latitudeDegrees .
}
WHERE {
    ?env a :Environment .
    ?env :name-Environment ?name .
    ?env :hasLatitudeDegrees-Environment ?latitudeDegrees .
    LET (?uri := smf:buildURI(":Environment_{?name}")) .
}

Now I have my new, nicely formatted Environment instance.

Thanks Scott and Holger, for your help.


Kev


On Oct 5, 11:01 pm, Scott Henninger <[email protected]>
wrote:
> Kevin;  Using the xml:
>   <Environment hasLatitudeDegrees="50"></Environment>
>
> I believe your query just needs a slight modification:
>
> SELECT ?subject ?val
> WHERE {
>     ?subject a :Environment .
>     ?subject :hasLatitudeDegrees-Environment ?val .
>
> }
>
> In SPARQLMotion, be sure to use the debug button on the
> ConvertXMLtoRDF  module and Infer the result triples temporarily.  You
> will then find that the xml above creates the following triples
> (amongst others) to convert XML to RDF:
>
>   :Environment rdf:type owl:Class .
>   :Environment sxml:element "Environment" .
>   :r rdf:type :Environment .
>   :r :hasLatitudeDegrees-Environment "50" .
>   :hasLatitudeDegrees-Environment sxml:attribute
> "hasLatitudeDegrees" .
>   :hasLatitudeDegrees-Environment rdf:type owl:DatatypeProperty ;
>
> Where :r is an instance of the :Environment element(class).  The key
> here is that XML allows the same attribute names on an element, and
> therefore Semantic XML needs a way to name them uniquely - using the
> pattern [attrib_name]-[elem_name].  You can, of course, use an
> ApplyConstruct module to rename as desired.
>
> The pizzaProcess.xml file in the Help (Semantic XML) files does show
> this, and is a good example to start with.
>
> -- Scott
>
> On Oct 5, 6:55 pm, Kevin Matthews <[email protected]> wrote:
>
> > OK, I've been playing with this all day to no avail.
>
> > Going back to my <Environment> example, I have tried using the
> > following 2 xml string as input to ConvertXMLtoRDF:
>
> > <Environment name="test"><hasLatitudeDegrees>50</hasLatitudeDegrees></
> > Environment>
> > ....and...
> > <Environment hasLatitudeDegrees="50"></Environment>
>
> > I'm not sure which one is correct, but neither worked.  Again, my end
> > goal is to be able to run the following query and get back
> > (<Environment>, 50).
>
> > SELECT ?subject ?val
> > WHERE {
> >     ?subject a :Environment .
> >         ?subject :hasLatitudeDegrees ?val .
>
> > }
>
> > Currently, when I use either of the 2 xml strings above as input to
> > ConvertXMLtoRDF, a (<Environment hasLatitudeDegrees="50">, rdf:type,
> > Environment)  triple is properly created.  I believe this is because I
> > added sxml:element="Environment" to the annotations of my Environment
> > class.
>
> > My problem is that I cannot seem to create the hasLatitudeDegrees
> > triple as a type :hasLatitudeDegrees.  I also cannot get the importer
> > to create the association of the new Environment with the new
> > hasLatitudeDegrees instance.
>
> > Where exactly do I need to add sxml:element or sxml:attribute
> > annotations?  The Environment class?  hasLatitudeDegrees
> > datatypeProperty?  What should their values be?  Strings?  Or class
> > references?  (I have added sxml:element and sxml:attribute to the
> > Environment and hasLatitudeDegrees property, and tried every possible
> > combination of moving them around as well).
>
> > How do I get the importer to use hasLatitudeDegrees as a predicate
> > instead of a subject or object?  Currenlty, the Environment and
> > hasLatitudeDegrees triples are related by a composite:child
> > predicate.
>
> > If there is an example of this anywhere, I would greatly appreciate
> > it.  The documentation was helpful, but it did not explain how to
> > create a parent class with a child relation containing a give value.
>
> > Thanks,
>
> > Kevin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TopBraid Composer Users" group.
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-composer-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to