Skip to Content.
Sympa Menu

perfsonar-dev - r1346 - trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlStorageManager

Subject: perfsonar development work

List archive

r1346 - trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlStorageManager


Chronological Thread 
  • From:
  • To:
  • Subject: r1346 - trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlStorageManager
  • Date: Fri, 30 Jun 2006 06:40:57 -0400

Author: roman
Date: 2006-06-30 06:40:56 -0400 (Fri, 30 Jun 2006)
New Revision: 1346

Modified:

trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlStorageManager/SQLMATransformations.java
Log:
xquery statement improved

Modified:
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlStorageManager/SQLMATransformations.java
===================================================================
---
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlStorageManager/SQLMATransformations.java
2006-06-29 14:18:32 UTC (rev 1345)
+++
trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlStorageManager/SQLMATransformations.java
2006-06-30 10:40:56 UTC (rev 1346)
@@ -191,65 +191,94 @@
}


- xpathQuery = "
\n "
- + " declare namespace
nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";;
\n "
- + " declare namespace
nmtl2=\"http://ggf.org/ns/nmwg/topology/l2/3.0/\";;
\n "
- + " declare namespace
nmwgtopo3=\"http://ggf.org/ns/nmwg/topology/base/3.0/\";;
\n "
- + "
\n "
- + " let $node1_metadata :=
\n "
- + " for $i in //nmwg:metadata
\n "
- + " where 1
\n "
- + (node1Name != "" ? " and
fn:lower-case($i/nmwg:subject/nmwgtopo3:node/nmwgtopo3:name) =
fn:lower-case('" + node1Name + "') \n" : "")
- + (node1Country != "" ? " and
fn:lower-case($i/nmwg:subject/nmwgtopo3:node/nmwgtopo3:country) =
fn:lower-case('" + node1Country + "') \n" : "")
- + (node1City != "" ? " and
fn:lower-case($i/nmwg:subject/nmwgtopo3:node/nmwgtopo3:city) =
fn:lower-case('" + node1City + "') \n" : "")
- + (node1Institution != "" ? " and
fn:lower-case($i/nmwg:subject/nmwgtopo3:node/nmwgtopo3:institution) =
fn:lower-case('" + node1Institution + "') \n" : "")
- + " return $i
\n "
- + "
\n "
- + " let $node1_id :=
\n "
- + " if ($node1_metadata) then
\n "
- + "
$node1_metadata/nmwg:subject/nmwgtopo3:node/@id
\n "
- + " else
\n "
- + " ''
\n "
- + "
\n "
- + " let $node2_metadata :=
\n "
- + " for $j in //nmwg:metadata
\n "
- + " where 1
\n"
- + (node2Name != "" ? " and
fn:lower-case($j/nmwg:subject/nmwgtopo3:node/nmwgtopo3:name) =
fn:lower-case('" + node2Name + "') \n" : "")
- + (node2Country != "" ? " and
fn:lower-case($j/nmwg:subject/nmwgtopo3:node/nmwgtopo3:country) =
fn:lower-case('" + node2Country + "') \n" : "")
- + (node2City != "" ? " and
fn:lower-case($j/nmwg:subject/nmwgtopo3:node/nmwgtopo3:city) =
fn:lower-case('" + node2City + "') \n" : "")
- + (node2Institution != "" ? " and
fn:lower-case($j/nmwg:subject/nmwgtopo3:node/nmwgtopo3:institution) =
fn:lower-case('" + node2Institution + "') \n" : "")
- + " return $j
\n "
- + "
\n "
- + " let $node2_id :=
\n "
- + " if ($node2_metadata) then
\n "
- + "
$node2_metadata/nmwg:subject/nmwgtopo3:node/@id
\n "
- + " else
\n "
- + " ''
\n"
- + "
\n"
- + " let $linkMetadata :=
\n"
- + " if ($node1_id != '' and $node2_id != '') then
\n"
- + " for $k in //nmwg:metadata
\n"
- + " where
$k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef = $node1_id
\n"
- + " and
$k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef = $node2_id
\n"
- + " and
fn:lower-case($k/nmwg:parameters/nmwg:parameter) =
fn:lower-case('Path.Status') \n"
- + " and
$k/nmwg:parameters/nmwg:parameter[@name='supportedEventType']
\n"
- + " return $k
\n"
- + " else
\n"
- + " ''
\n"
- + "
\n"
- + " return
\n"
- + " if ($linkMetadata != '') then
\n"
- + " ($node1_metadata, $node2_metadata,
$linkMetadata) \n"
- + " else
\n"
- + " ''
";

+ String node1 = null;
+ if (node1Name == "" && node1Country == "" && node1City == "" &&
node1Institution == "")
+ node1 = " let $node1_metadata := '' \n"
+ + "let $node1_id := '' ";
+ else
+ node1 = " let $node1_metadata :=
\n"
+ + " for $i in //nmwg:metadata
\n"
+ + " where 1
\n"
+ + (node1Name != "" ? " and
fn:lower-case($i/nmwg:subject/nmwgtopo3:node/nmwgtopo3:name) =
fn:lower-case('" + node1Name + "') \n" : "")
+ + (node1Country != "" ? " and
fn:lower-case($i/nmwg:subject/nmwgtopo3:node/nmwgtopo3:country) =
fn:lower-case('" + node1Country + "') \n" : "")
+ + (node1City != "" ? " and
fn:lower-case($i/nmwg:subject/nmwgtopo3:node/nmwgtopo3:city) =
fn:lower-case('" + node1City + "') \n" : "")
+ + (node1Institution != "" ? " and
fn:lower-case($i/nmwg:subject/nmwgtopo3:node/nmwgtopo3:institution) =
fn:lower-case('" + node1Institution + "') \n" : "")
+ + " return $i
\n"
+ + "

\n"
+ + " let $node1_id :=
\n"
+ + " if ($node1_metadata) then
\n"
+ + "
$node1_metadata/nmwg:subject/nmwgtopo3:node/@id \n"
+ + " else
\n"
+ + " ''
\n";
+
+
+ String node2 = null;
+ if (node2Name == "" && node2Country == "" && node2City == "" &&
node2Institution == "")
+ node2 = " let $node2_metadata := '' \n"
+ + " let $node2_id := '' ";
+ else
+ node2 = " let $node2_metadata :=
\n"
+ + " for $j in //nmwg:metadata
\n"
+ + " where 1
\n"
+ + (node2Name != "" ? " and
fn:lower-case($j/nmwg:subject/nmwgtopo3:node/nmwgtopo3:name) =
fn:lower-case('" + node2Name + "') \n" : "")
+ + (node2Country != "" ? " and
fn:lower-case($j/nmwg:subject/nmwgtopo3:node/nmwgtopo3:country) =
fn:lower-case('" + node2Country + "') \n" : "")
+ + (node2City != "" ? " and
fn:lower-case($j/nmwg:subject/nmwgtopo3:node/nmwgtopo3:city) =
fn:lower-case('" + node2City + "') \n" : "")
+ + (node2Institution != "" ? " and
fn:lower-case($j/nmwg:subject/nmwgtopo3:node/nmwgtopo3:institution) =
fn:lower-case('" + node2Institution + "') \n" : "")
+ + " return $j
\n"
+ + "
\n"
+ + " let $node2_id :=
\n"
+ + " if ($node2_metadata) then
\n"
+ + "
$node2_metadata/nmwg:subject/nmwgtopo3:node/@id \n"
+ + " else
\n"
+ + " ''

\n";
+
+
+ xpathQuery = "
\n "
+ + " declare namespace
nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\";;
\n "
+ + " declare namespace
nmtl2=\"http://ggf.org/ns/nmwg/topology/l2/3.0/\";;
\n "
+ + " declare namespace
nmwgtopo3=\"http://ggf.org/ns/nmwg/topology/base/3.0/\";;
\n "
+ + "
\n "
+ + node1
+ + node2
+ + "
\n"
+ + " let $linkMetadata :=
\n"
+ + " if ($node1_id != '' and $node2_id != '') then
\n"
+ + " for $k in //nmwg:metadata
\n"
+ + " where
$k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef = $node1_id
\n"
+ + " and
$k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef = $node2_id
\n"
+ + " and
fn:lower-case($k/nmwg:parameters/nmwg:parameter) =
fn:lower-case('Path.Status') \n"
+ + " and
$k/nmwg:parameters/nmwg:parameter[@name='supportedEventType']
\n"
+ + " return $k
\n"
+ + " else if ($node1_id != '' and $node2_id = '')
then \n"
+ + " for $k in //nmwg:metadata
\n"
+ + " where
$k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef = $node1_id
\n"
+ + " and
fn:lower-case($k/nmwg:parameters/nmwg:parameter) =
fn:lower-case('Path.Status') \n"
+ + " and
$k/nmwg:parameters/nmwg:parameter[@name='supportedEventType']
\n"
+ + " return $k
\n"
+ + " else if ($node1_id = '' and $node2_id != '')
then \n"
+ + " for $k in //nmwg:metadata
\n"
+ + " where
$k/nmwg:subject/nmtl2:link/nmwgtopo3:node/@nodeIdRef = $node2_id
\n"
+ + " and
fn:lower-case($k/nmwg:parameters/nmwg:parameter) =
fn:lower-case('Path.Status') \n"
+ + " and
$k/nmwg:parameters/nmwg:parameter[@name='supportedEventType']
\n"
+ + " return $k
\n"
+ + " else
\n"
+ + " ''
\n"
+ + "
\n"
+ + " return
\n"
+ + " if ($linkMetadata != '') then
\n"
+ + " ($node1_metadata, $node2_metadata,
$linkMetadata) \n"
+ + " else
\n"
+ + " ''
";
+
+
}


//logger.debug(
// "SQLMATransformations._getPathStatusMetadataQuery: "
// + "meta xpath/xquery query: "
- // + xpathQuery);
+ // + xpathQuery);






  • r1346 - trunk/perfsonar/src/org/perfsonar/service/measurementArchive/sqlStorageManager, svnlog, 06/30/2006

Archive powered by MHonArc 2.6.16.

Top of Page