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