Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r2950 - branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator

Subject: perfsonar development work

List archive

perfsonar: r2950 - branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r2950 - branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator
  • Date: Mon, 15 Oct 2007 06:47:53 -0400

Author: roman
Date: 2007-10-15 06:47:53 -0400 (Mon, 15 Oct 2007)
New Revision: 2950

Modified:

branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/DiscardsQueryGenerator.java

branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/ErrorsQueryGenerator.java

branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/UtilizationQueryGenerator.java
Log:

xquary statements improved to get results faster



Modified:
branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/DiscardsQueryGenerator.java
===================================================================
---
branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/DiscardsQueryGenerator.java
2007-10-15 09:29:03 UTC (rev 2949)
+++
branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/DiscardsQueryGenerator.java
2007-10-15 10:47:53 UTC (rev 2950)
@@ -80,6 +80,7 @@
String ifName = null;
String ifDescription = null;
String ifAddress = null;
+ String ifAddressType = null;
String ifIndex = null;
String type = null;
String direction = null;
@@ -119,6 +120,12 @@
authRealm = (interf.getAuthRealmElement() != null
? interf.getAuthRealmElement().getAuthRealm().trim() : null);
classOfService = (interf.getClassOfServiceElement() != null
? interf.getClassOfServiceElement().getClassOfService().trim() : null);
capacity = (interf.getCapacityElement() != null
? interf.getCapacityElement().getCapacity().trim() : null);
+
+ try {
+ ifAddressType =
(!interf.getIfAddressElement().getType().trim().equals("") ?
interf.getIfAddressElement().getType().trim(): null);
+ } catch (Exception ex) {
+ ifAddressType = null;
+ }
} else {
throw new PerfSONARException(
"error.ma.query",
@@ -132,7 +139,6 @@
+ "no subject element in metadata element");
}

-
String xQuery = "\n"
+ "declare namespace nmwg='http://ggf.org/ns/nmwg/base/2.0/';
\n"
+ "declare namespace
discards='http://ggf.org/ns/nmwg/characteristic/discards/2.0/'; \n"
@@ -145,6 +151,41 @@
+ " replace(replace($arg,'\\s+$',''),'^\\s+','') \n"
+ "}; \n\n";

+
+ if (ipAddress == null &&
+ hostName == null &&
+ ifName == null &&
+ ifDescription == null &&
+ ifAddress == null &&
+ ifIndex == null &&
+ type == null &&
+ direction == null &&
+ authRealm == null &&
+ classOfService == null &&
+ capacity == null) {
+
+ // getting all metadata
+
+ xQuery +=
+ "let $res :=
\n"
+ + " for $i in //nmwg:metadata
\n"
+ + " where
\n"
+ + "
$i/nmwg:parameters/nmwg:parameter[(functx:trim(text())='" + eventType + "'
and functx:trim(@name)='supportedEventType') \n"
+ + " or (functx:trim(@value)='" + eventType + "' and
functx:trim(@name)='supportedEventType')] \n"
+ + " or
\n"
+ + " $i/nmwg:eventType[functx:trim(text())='" +
eventType + "']
\n"
+ + " return $i
\n"
+ + "\n"
+ + "let $datas :=
\n"
+ + "
//nmwg:data/nmwg:key/nmwg:parameters/nmwg:parameter[functx:trim(@name)='EventType'
and functx:trim(text())='" + eventType + "']/parent::*/parent::*/parent::*
\n"
+ + "\n"
+ + "return ($res, $datas) \n";
+
+ return xQuery;
+
+ }
+
+
xQuery +=
" let $res := \n"
+ " for $i in //nmwg:metadata \n"
@@ -220,7 +261,11 @@
xQuery += "and
$i/discards:subject/nmwgt:interface/nmwgt:capacity[functx:trim(text())='" +
capacity + "'] ";
}

+ if (ifAddressType != null) {
+ xQuery += "and
$i/netutil:subject/nmwgt:interface/nmwgt:ifAddress[functx:trim(@type)='" +
ifAddressType + "'] ";
+ }

+
xQuery += "\n"
+ " return $i
\n"
+ "
\n"
@@ -229,12 +274,10 @@
+ " return fn:data($j/@id)
\n"
+ "
\n"
+ " let $datas :=
\n"
- + " for $k in $metaids
\n"
- + " let $d :=
\n"
- + " for $l in //nmwg:data
\n"
- + " where fn:data($l/@metadataIdRef) = $k
\n"
- + " return $l
\n"
- + " return $d
\n"
+ + " for $k in $metaids
\n"
+ + " let $d:=
\n"
+ + " //nmwg:data[functx:trim(@metadataIdRef)=$k]
\n"
+ + " return $d
\n"
+ "
\n"
+ " return ($res, $datas)
\n";


Modified:
branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/ErrorsQueryGenerator.java
===================================================================
---
branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/ErrorsQueryGenerator.java
2007-10-15 09:29:03 UTC (rev 2949)
+++
branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/ErrorsQueryGenerator.java
2007-10-15 10:47:53 UTC (rev 2950)
@@ -80,6 +80,7 @@
String ifName = null;
String ifDescription = null;
String ifAddress = null;
+ String ifAddressType = null;
String ifIndex = null;
String type = null;
String direction = null;
@@ -119,6 +120,12 @@
authRealm = (interf.getAuthRealmElement() != null
? interf.getAuthRealmElement().getAuthRealm().trim() : null);
classOfService = (interf.getClassOfServiceElement() != null
? interf.getClassOfServiceElement().getClassOfService().trim() : null);
capacity = (interf.getCapacityElement() != null
? interf.getCapacityElement().getCapacity().trim() : null);
+
+ try {
+ ifAddressType =
(!interf.getIfAddressElement().getType().trim().equals("") ?
interf.getIfAddressElement().getType().trim(): null);
+ } catch (Exception ex) {
+ ifAddressType = null;
+ }
} else {
throw new PerfSONARException(
"error.ma.query",
@@ -132,7 +139,6 @@
+ "no subject element in metadata element");
}

-
String xQuery = "\n"
+ "declare namespace nmwg='http://ggf.org/ns/nmwg/base/2.0/';
\n"
+ "declare namespace
errors='http://ggf.org/ns/nmwg/characteristic/errors/2.0/'; \n"
@@ -145,6 +151,40 @@
+ " replace(replace($arg,'\\s+$',''),'^\\s+','') \n"
+ "}; \n\n";

+ if (ipAddress == null &&
+ hostName == null &&
+ ifName == null &&
+ ifDescription == null &&
+ ifAddress == null &&
+ ifIndex == null &&
+ type == null &&
+ direction == null &&
+ authRealm == null &&
+ classOfService == null &&
+ capacity == null) {
+
+ // getting all metadata
+
+ xQuery +=
+ "let $res :=
\n"
+ + " for $i in //nmwg:metadata
\n"
+ + " where
\n"
+ + "
$i/nmwg:parameters/nmwg:parameter[(functx:trim(text())='" + eventType + "'
and functx:trim(@name)='supportedEventType') \n"
+ + " or (functx:trim(@value)='" + eventType + "' and
functx:trim(@name)='supportedEventType')] \n"
+ + " or
\n"
+ + " $i/nmwg:eventType[functx:trim(text())='" +
eventType + "']
\n"
+ + " return $i
\n"
+ + "\n"
+ + "let $datas :=
\n"
+ + "
//nmwg:data/nmwg:key/nmwg:parameters/nmwg:parameter[functx:trim(@name)='EventType'
and functx:trim(text())='" + eventType + "']/parent::*/parent::*/parent::*
\n"
+ + "\n"
+ + "return ($res, $datas) \n";
+
+ return xQuery;
+
+ }
+
+
xQuery +=
" let $res := \n"
+ " for $i in //nmwg:metadata \n"
@@ -220,7 +260,11 @@
xQuery += "and
$i/errors:subject/nmwgt:interface/nmwgt:capacity[functx:trim(text())='" +
capacity + "'] ";
}

+ if (ifAddressType != null) {
+ xQuery += "and
$i/netutil:subject/nmwgt:interface/nmwgt:ifAddress[functx:trim(@type)='" +
ifAddressType + "'] ";
+ }

+
xQuery += "\n"
+ " return $i
\n"
+ "
\n"
@@ -229,12 +273,10 @@
+ " return fn:data($j/@id)
\n"
+ "
\n"
+ " let $datas :=
\n"
- + " for $k in $metaids
\n"
- + " let $d :=
\n"
- + " for $l in //nmwg:data
\n"
- + " where fn:data($l/@metadataIdRef) = $k
\n"
- + " return $l
\n"
- + " return $d
\n"
+ + " for $k in $metaids
\n"
+ + " let $d:=
\n"
+ + " //nmwg:data[functx:trim(@metadataIdRef)=$k]
\n"
+ + " return $d
\n"
+ "
\n"
+ " return ($res, $datas)
\n";


Modified:
branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/UtilizationQueryGenerator.java
===================================================================
---
branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/UtilizationQueryGenerator.java
2007-10-15 09:29:03 UTC (rev 2949)
+++
branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator/UtilizationQueryGenerator.java
2007-10-15 10:47:53 UTC (rev 2950)
@@ -80,6 +80,7 @@
String ifName = null;
String ifDescription = null;
String ifAddress = null;
+ String ifAddressType = null;
String ifIndex = null;
String type = null;
String direction = null;
@@ -119,6 +120,12 @@
authRealm = (interf.getAuthRealmElement() != null
? interf.getAuthRealmElement().getAuthRealm().trim() : null);
classOfService = (interf.getClassOfServiceElement() != null
? interf.getClassOfServiceElement().getClassOfService().trim() : null);
capacity = (interf.getCapacityElement() != null
? interf.getCapacityElement().getCapacity().trim() : null);
+
+ try {
+ ifAddressType =
(!interf.getIfAddressElement().getType().trim().equals("") ?
interf.getIfAddressElement().getType().trim(): null);
+ } catch (Exception ex) {
+ ifAddressType = null;
+ }
} else {
throw new PerfSONARException(
"error.ma.query",
@@ -132,7 +139,6 @@
+ "no subject element in metadata element");
}

-
String xQuery = "\n"
+ "declare namespace nmwg='http://ggf.org/ns/nmwg/base/2.0/';
\n"
+ "declare namespace
netutil='http://ggf.org/ns/nmwg/characteristic/utilization/2.0/';\n"
@@ -145,6 +151,41 @@
+ " replace(replace($arg,'\\s+$',''),'^\\s+','') \n"
+ "}; \n\n";

+
+ if (ipAddress == null &&
+ hostName == null &&
+ ifName == null &&
+ ifDescription == null &&
+ ifAddress == null &&
+ ifIndex == null &&
+ type == null &&
+ direction == null &&
+ authRealm == null &&
+ classOfService == null &&
+ capacity == null) {
+
+ // getting all metadata
+
+ xQuery +=
+ "let $res :=
\n"
+ + " for $i in //nmwg:metadata
\n"
+ + " where
\n"
+ + "
$i/nmwg:parameters/nmwg:parameter[(functx:trim(text())='" + eventType + "'
and functx:trim(@name)='supportedEventType') \n"
+ + " or (functx:trim(@value)='" + eventType + "' and
functx:trim(@name)='supportedEventType')] \n"
+ + " or
\n"
+ + " $i/nmwg:eventType[functx:trim(text())='" +
eventType + "']
\n"
+ + " return $i
\n"
+ + "\n"
+ + "let $datas :=
\n"
+ + "
//nmwg:data/nmwg:key/nmwg:parameters/nmwg:parameter[functx:trim(@name)='EventType'
and functx:trim(text())='" + eventType + "']/parent::*/parent::*/parent::*
\n"
+ + "\n"
+ + "return ($res, $datas) \n";
+
+ return xQuery;
+
+ }
+
+
xQuery +=
" let $res := \n"
+ " for $i in //nmwg:metadata \n"
@@ -228,7 +269,11 @@
xQuery += "and
$i/netutil:subject/nmwgt:interface/nmwgt:capacity[functx:trim(text())='" +
capacity + "'] ";
}

+ if (ifAddressType != null) {
+ xQuery += "and
$i/netutil:subject/nmwgt:interface/nmwgt:ifAddress[functx:trim(@type)='" +
ifAddressType + "'] ";
+ }

+
xQuery += "\n"
+ " return $i
\n"
+ "
\n"
@@ -237,12 +282,10 @@
+ " return fn:data($j/@id)
\n"
+ "
\n"
+ " let $datas :=
\n"
- + " for $k in $metaids
\n"
- + " let $d :=
\n"
- + " for $l in //nmwg:data
\n"
- + " where fn:data($l/@metadataIdRef) = $k
\n"
- + " return $l
\n"
- + " return $d
\n"
+ + " for $k in $metaids
\n"
+ + " let $d:=
\n"
+ + " //nmwg:data[functx:trim(@metadataIdRef)=$k]
\n"
+ + " return $d
\n"
+ "
\n"
+ " return ($res, $datas)
\n";




  • perfsonar: r2950 - branches/new-structure/trunk/perfsonar_base/src/main/java/org/perfsonar/service/measurementArchive/metadataConfig/queryGenerator, svnlog, 10/15/2007

Archive powered by MHonArc 2.6.16.

Top of Page