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 <ref> 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 <ref> 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-auto-opportunities
</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>