Darin;  There are some problems with the ApplyConstruct query that
could be causing the problem.  An instance of the <attribute> element
is created, but is then is declared to be the composite:child of a
bnode (_:b0).  But since the bnode is not linked to any XML
structures, this will not appear in the XML document.  Instead, for
each match in IterateOverSelect, the <attribute> element is set as a
composite:child of CQ:Documentr-3-3, which I take to be the
<attributes> tag.  If the match to ?rStringAttributeNodeName resolved
to the same uri, then all will be placed in the same <attribute>
element.  I suspect this is what is placing all of your data in the
one tag (it's hard to say without knowing what the data is).

The bnode _:b1 will not be added to the XML file, as it is not linked
to the XML structure.  If the intent is to create multiple <attribute>
tags, one for each match in IterateOverSelect, then something like the
following should get you what you need:

CONSTRUCT
{  _:b0 :qualifier-attribute "MashupData" .
   _:b0 :type-attribute ?stringPredicate .
   _:b0 composite:index 0 .
   _:b0 a :attribute .
  CQ:Documentr-3-3 composite:child _:b0 .
}

Again, I am assuming that CQ:Documentr-3-3 is the <attributes> tag.
(Using the named uri, ?rStringAttributeNodeName, instead of the bnode
_:b0 is also acceptable, as long as ?rStringAttributeNodeName creates
unique names.)

-- Scott

On Nov 3, 5:42 pm, Darin <[email protected]> wrote:
> OK, now that I know I am working in the right direction, I am stuck
> and could use a bit of help. At this point, I am able to take this
> xml:
>
> <attributes>
>     <attribute qualifier="Ticker" type="NYSE">GPC</attribute>
>     <attribute qualifier="URL" type="Homepage">http://www.genpt.com/</
> attribute>
> </attributes>
>
> And insert the CQ:GathereData statements (14 of them) but instead of
> each getting its own <attribute> element they are all shoved into one
> <attribute> element like this:
>
>        <attributes>
>             <attribute qualifier="MashupData" type="<http://
> dbpedia.org/property/reference>"><http://www4.wiwiss.fu-berlin.de/
> flickrwrappr/photos/Genuine_Parts_Company>Genuine Parts Company is
> a Fortune 1000 company that was founded in 1928. Based in Georgia with
> large operations in Alabama, the company employs 31,700 people. Cite
> error: Invalid &lt;ref&gt; tag; refs with no name must have
> content It specializes in replacement parts for cars and other
> industrial machines and is the largest member of the National
> Automotive Parts Association(NAPA). Approximately 5,800 NAPA Auto Part
> stores, around 1,000 of which are company owned, are serviced by the
> auto parts segment of the company, which accounted for 51% of their
> profits in 2005. Cite error: Invalid &lt;ref&gt; tag; refs
> with no name must have content<http://dbpedia.org/class/yago/
> CompaniesBasedInAtlanta,Georgia>Genuine Parts 
> Company<http://www.genpt.com><http://sw.opencyc.org/concept/Mx4rvy_igJwpEbGdrcN5Y29ycA>Genuine
> Parts Company is a Fortune 1000 company that was founded in 1928.
> Based in<http://en.wikipedia.org/wiki/
> Genuine_Parts_Company><http://dbpedia.org/resource/
> Category:Companies_based_in_Atlanta%2C_Georgia><http://
> dbpedia.org/resource/
> Category:Companies_established_in_1928><http://dbpedia.org/class/
> yago/CompaniesEstablishedIn1928><http://dbpedia.org/resource/
> Genuine_Parts_Company><http://rdf.freebase.com/ns/guid.
> 9202a8c04000641f8000000000b995db>"In auto parts, that's the kind of
> stature enjoyed by GPC...."  Title:GM Bankruptcy: Time for New-Era
> Auto Opportunities 
> -http://seekingalpha.com/article/140787-gm-bankruptcy-time-for-new-era...
> </attribute>
>             <attribute qualifier="Ticker" type="NYSE">GPC</attribute>
>             <attribute qualifier="URL" 
> type="Homepage">http://www.genpt.com/</attribute>
>         </attributes>
>
> Could I be utilizing IterateOverSelect module with the ApplyConstruct
> module incorrectly, or could it be that I am not forming the new
> CQ:Attribute class instance/resource correctly. Below are the configs
> for these two modules again as I have updated them a bit since my last
> post.
>
> sml:IterateOverSelet
> SELECT ?stringPredicate ?stringObject ?rStringAttributeNodeName
> WHERE {
>     CQ:GatheredData ?predicate ?object .
>     LET (?stringPredicate := smf:cast(smf:name(?predicate),
> xsd:string)) .
>     LET (?stringObject := smf:cast(smf:name(?object), xsd:string)) .
>     LET (?uuid := smf:generateUUID()) .
>     ?attributes a CQ:attributes .
>     LET (?attributesNodeName := smf:qname(?attributes)) .
>     LET (?stringAttributesNodeName := smf:cast(smf:name(?
> attributesNodeName), xsd:string)) .
>     LET (?stringAttributeNodeName := smf:buildString("{?
> stringAttributesNodeName}-{?uuid}")) .
>     LET (?rStringAttributesNodeName := smf:resource(?
> stringAttributesNodeName)) .
>     LET (?rStringAttributeNodeName := smf:resource(?
> stringAttributeNodeName)) .
>
> }
>
> sme:ApplyConstruct
> CONSTRUCT {
>     ?rStringAttributeNodeName CQ:qualifier-attribute "MashupData" .
>     ?rStringAttributeNodeName CQ:type-attribute ?stringPredicate .
>     ?rStringAttributeNodeName a CQ:attribute .
>     ?rStringAttributeNodeName composite:child _:b0 .
>     _:b1 composite:index "0"^^xsd:int .
>     _:b1 sxml:text ?stringObject .
>     _:b1 a sxml:TextNode .
>     CQ:Documentr-3-3 composite:child ?rStringAttributeNodeName .
>
> }
> WHERE {
> }
>
> Please let me know if I should supply further information etc.
>
> On Nov 2, 10:31 pm, Scott Henninger <[email protected]>
> wrote:
>
> > <Am I taking the right approach to adding the dbpedia triples back
> > into
> > the xml, or is there a simpler way to do this? It seems like I might
> > be making this too complex. >
>
> > Darin;  Overall this seems to be in order and as expected.  When
> > transforming between XML and RDF you're moving from a triple
> > representation to hierarchical tags, so some complexity is expected.
>
> > I did notice that the composite:index is hardcoded.  This will control
> > the order in which the XML element tags (siblings) are written.  So if
> > that matters, you want to assign an ordering, otherwise it can be
> > ignored.
>
> > -- Scott
>
> > On Nov 2, 9:19 pm,Darin<[email protected]> wrote:
>
> > > I am importing an xml file to rdf (which gives me semantic xml to work
> > > with), adding data to it, then converting it back to XML for export.
> > > The imported file represents a company and the added data is
> > > information for that company gathered from dbpedia and one other
> > > source.
>
> > > All of the data gathered from dbpedia etc., is temporarily stored via
> > > Construct like this – CQ:GatheredData ?predicate ?object. At the end
> > > of the process, prior to converting from RDF to XML, I use
> > > IterateOverSelect module with an ApplyConstruct module to take this
> > > GatheredData (all the data for CQ:GathererdData) and inject it into
> > > the RDF so that it appears in the xml.
>
> > > sml:IterateOverSelect
> > > sml:selectQuery =
> > > SELECT ?stringPredicate ?stringObject ?stringAttributesNodeName ?
> > > stringAttributeNodeName
> > > WHERE {
> > >     CQ:GatheredData ?predicate ?object .
> > >     LET (?stringPredicate := smf:cast(smf:name(?predicate),
> > > xsd:string)) .
> > >     LET (?stringObject := smf:cast(smf:name(?object), xsd:string)) .
> > >     LET (?uuid := smf:generateUUID()) .
> > >     ?attributes a CQ:attributes .
> > >     LET (?attributesNodeName := smf:qname(?attributes)) .
> > >     LET (?stringAttributesNodeName := smf:cast(smf:name(?
> > > attributesNodeName), xsd:string)) .
> > >     LET (?stringAttributeNodeName := smf:buildString("{?
> > > stringAttributesNodeName}-{?uuid}")) .
>
> > > }
>
> > > sml:ApplyConstruct
> > > sml:ConstructQuery
> > > CONSTRUCT {
> > >     ?stringAttributeNodeName CQ:qualifier-attribute "MashupData" .
> > >     ?stringAttributeNodeName CQ:type-attribute ?stringPredicate .
> > >     ?stringAttributeNodeName composite:index "5"^^xsd:int .
> > >     ?stringAttributeNodeName a CQ:attribute .
> > >     ?stringAttributeNodeName composite:child _:b0 .
> > >     _:b0 composite:index "0"^^xsd:int .
> > >     _:b0 sxml:text ?stringObject .
> > >     _:b0 a sxml:TextNode .
> > >     ?stringAttributesNodeName composite:child ?
> > > stringAttributeNodeName .
>
> > > }
> > > WHERE {
> > > }
>
> > > Am I taking the right approach to adding the dbpedia triples back into
> > > the xml, or is there a simpler way to do this? It seems like I might
> > > be making this too complex.
>
> > > In building up to this approach, I was able to do a static sort of
> > > construct query that does successfully add a sigle entry into my xml,
> > > as follows:
>
> > >  CONSTRUCT {
> > >     CQ:Documentr-3-3-5 CQ:qualifier-attribute "MashupData" .
> > >     CQ:Documentr-3-3-5 CQ:type-attribute "FreeBaseUri" .
> > >     CQ:Documentr-3-3-5 composite:index "5"^^xsd:int .
> > >     CQ:Documentr-3-3-5 a CQ:attribute .
> > >     CQ:Documentr-3-3-5 composite:child _:b0 .
> > >     _:b0 composite:index "0"^^xsd:int .
> > >     _:b0 sxml:text "http://www.freebase.com/Actel"; .
> > >     _:b0 a sxml:TextNode .
> > >     CQ:Documentr-3-3 composite:child CQ:Documentr-3-3-5 .
>
> > > }
> > > WHERE {
> > > }
>
> > > This adds an element into the xml that looks like this.
>
> > > <attributes>
> > >         <attribute 
> > > qualifier="MashupData"type="FreeBaseUri">http://www.freebase.com/Actel
> > > </attribute>
> > >  </attributes>
--~--~---------~--~----~------------~-------~--~----~
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