Hallo wieder,
mein letztes Problem nach der Lösung von allen anderen ist das entsprechende Output zu erzeugen.
Ich will ein Graphml-XLMDokument erzeugen, und irgendwie funktioniert es nicht.
Ich möchte so ein Output bekommen:
Mein XQuery sieht ungefähr so aus:
Leider bekomme ich so Folgendes:
Ich zerbreche mir den Kopf, wie soll ich genau die Konstruktoren ({}) einsetzen, damit ich nur einen graph-Knoten mit den dazugehörigen Nodes bekomme.
Danke schon mal vielmals!
mein letztes Problem nach der Lösung von allen anderen ist das entsprechende Output zu erzeugen.
Ich will ein Graphml-XLMDokument erzeugen, und irgendwie funktioniert es nicht.
Ich möchte so ein Output bekommen:
Code:
<?xml version="1.0" encoding="UTF-8"?> <graphml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://graphml.graphdrawing.org/xmlns" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"> <!-- data schema --> <key id="self_name" for="node" attr.name="name" attr.type="string"/> <key id="child_name" for="node" attr.name="gender" attr.type="string"/> <key id="edge_name" for="edge" attr.name="gender" attr.type="string"/> <graph edgedefault="undirected"> <node id="677"> <data key="self_name">Konzept</data> </node> <node id="seg162"> <data key="child_name"> Subkonzept 1</data> </node> <node id="seg172"> <data key="child_name"> Subkonzept 2</data> </node> <edge source="677" target="seg162"> <data key="edge_name">Relation</data> </edge> <edge source="678" target="seg172"> <data key="edge_name">Relation2</data> </edge> </graph> </graphml>
Code:
xquery version "1.0"; declare boundary-space strip; declare namespace xsf="http://www.xstandoff.net/2009/xstandoff/1.1"; declare namespace xsi="http://www.w3.org/2001/XMLSchema-instance"; declare namespace dataspace="http://web/dataspace"; declare default element namespace "http://www.xstandoff.net/2009/xstandoff/1.1"; <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"> <!-- data schema --> <key id="self_name" for="node" attr.name="name" attr.type="string"/> <key id="child_name" for="node" attr.name="gender" attr.type="string"/> <key id="edge_name" for="edge" attr.name="gender" attr.type="string"/> { for $doc in collection("../data/xsf_u8") let $text := $doc//textualContent return for $hd_mod in $doc//label let $id_dependHead := $xsf_senteces/@id return for $xsf_mod in $doc//cnxde:sentence[@xsf:segment=$attr] let $xsf_seg_id := $xsf_mod/@xsf:segment where $xsf_seg_id return let $parent := $xsf_senteces/../.. for $child_label_cnx_seg in $child_labels/@xsf:segment for $child_token_seg in $doc//cnxde:analysis let $child_term := $doc//terms:toc/terms:head //terms:term[@xsf:segment = $child_token_seg] where $child_term return <graph edgedefault="undirected"> <node id= "{ $self_nodeid }"> <data key="self_name">{$self_term}</data> </node> <node id="{ $child_label_cnx_seg}"> <data key="child_name">{ $children_term}</data> </node> <edge source="{$self_nodeid}" target="{ $child_label_cnx_seg}"> <data key="edge_name">ATTR</data> </edge> </graph> } </graphml>
Code:
<?xml version="1.0" encoding="UTF-8"?> <graphml xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://graphml.graphdrawing.org/xmlns" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd"><!-- data schema --><key id="self_name" attr.type="string" for="node" attr.name="name"/> <key id="child_name" attr.type="string" for="node" attr.name="gender"/> <key id="edge_name" attr.type="string" for="edge" attr.name="gender"/> <graph edgedefault="undirected"> <node id="677"> <data key="self_name">Konzept</data> </node> <node id="seg162"> <data key="child_name">Subkonzept 2</data> </node> <edge source="677" target="seg162"> <data key="edge_name">Relation 1</data> </edge> <edge source="677" target="seg162"> <data key="edge_name">Relation 2</data> </edge> </graph> <graph edgedefault="undirected"> <node id="677"> <data key="self_name">Konzept</data> </node> <node id="seg172"> <data key="child_name">Subkonzept 2</data> </node> <edge source="677" target="seg172"> <data key="edge_name">Relation 1</data> </edge> <edge source="677" target="seg172"> <data key="edge_name">Relation 2</data> </edge> </graph> </graphml>
Danke schon mal vielmals!