<< APPENDIX_C_Extensibility.cpp

Index of HTML Docs

APPENDIX E Footprint >>

 

 

APPENDIX D

QUERY MODIFICATIONS

 

The query descriptions are from the XOO7 website. The XQuery code in the left column is also from the XOO7 website. The XQuery code in the right column is the variation we used to test the NeoCore XMS, v. 2.6. See XQuery Adaptations in Chapter 7 for an explanation of each type of variation.

 

 

XOO7 BENCHMARK

QUERIES

OUR ADAPTATIONS FOR

USE WITH

NEOCORE XMS V. 2.6

Query 1

Randomly generate 5 numbers in the range of AtomicPart's MyID, then return the AtomicPart according to the 5 numbers.

FOR $a IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart/Connection
/AtomicPart[@MyID = 221 or @MyID = 1000 or @MyID = 535 or @MyID = 13 or @MyID = 2000] RETURN $a

for $a in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart/Connection
/AtomicPart[@MyID = 221 or @MyID = 1000 or @MyID = 535 or @MyID = 13 or @MyID = 2000] return $a

Query 2

Randomly generate 5 titles for Documents, then return the first paragraph of the Document by lookup on these titles.

FOR $d IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart
/Document[@title="CompositePart 00000009"
or @title="CompositePart 00000050"
or @title="CompositePart 00000034"
or @title="CompositePart 00000022"
or @title="CompositePart 00000080"]
RETURN $d/para[1]

for $d in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart
/Document[@title="Composite Part 00000009" or @title="Composite Part 00000050" or @title="Composite Part 00000034" or @title="Composite Part 00000022" or @title="Composite Part 00000080"]
return ($d/para)[1]

Query 3

Select 5% of AtomicParts via buildDate (in a certain period).

FOR $a IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart/Connection
/AtomicPart[@buildDate .>=. 1900 and
@buildDate .<. 1950] RETURN $a

for $d in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart/Connection
/AtomicPart[@buildDate >= 1900 and
@buildDate < 1950] return $d

Query 4

Find the CompositePart if it is later than BaseAssembly it is using (comparing the buildDate attribute).

FOR $b IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly, $c IN $b/CompositePart[@buildDate .>. $b/@buildDate]
RETURN $c

for $b in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly, $c in $b
/CompositePart[@buildDate > $b/@buildDate] return $c

Query 5

Within the same BaseAssembly, return the AtomicParts once finding a Document that has MyID equals to its docId.

FOR $b IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly, $d IN $b/CompositePart
/Document
LET $a := $b/CompositePart/Connection
/AtomicPart
WHERE  $d/@MyID = $a/@docId
RETURN $a

for $b in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly, $d in $b/CompositePart/Document
let $a:=$b/CompositePart/Connection
/AtomicPart
where $d/@MyID = $a/@docId
return $a

Query 6

Select all BaseAssemblies with earlier buildDate from one XML database where it has the same "type" attributes as the BaseAssemblies in another database.

FOR $b1 IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly, $b2 IN document
("/export/home/liyg/genxml/small32.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly
Where $b1/@type = $b2/@type
and $b1/@buildDate .<. $b2/@buildDate
RETURN  $b1

for $b1 in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly,
$b2 in document("neo1002.xml")/Module2
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly
where $b1/@type = $b2/@type and
$b1/@buildDate < $b2/@buildDate
return $b1

Query 7

Randomly generate two phrases among all phrases in Documents. Select
those documents containing the 2 phrases

FOR $d IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart
/Document[contains(., "00000010") and
contains(., "document")]
Return $d

for $d in document ("neo1001.xml")/Module1
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart
/Document [contains(., "00000010") and
contains(., "document")]
return $d

Query 8

This query was withdrawn by the XOO7 team

Query 9

Select all AtomicParts with corresponding CompositeParts as their sub-elements.

FOR $a IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart/Connection
/AtomicPart
Return
  <AtomicPart $a/@*>
    shallow($a/../..)
  </AtomicPart>

for $a in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart/Connection/AtomicPart
return $a/@*

Query 10

Select all ComplexAssembly with type "type008" without the knowledge of the path.

FOR $ca IN document("small31.xml")
//ComplexAssembly[./@type = "type008"]
RETURN $ca

for $ca in document("neo1001.xml")
/Module1
//ComplexAssembly[./@type="type008"]
return $ca

Query 11

Among the first 5 Connections of each CompositePart,
select those with length greater than "len".

FOR $c IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart
RETURN
$c/Connection[position() .<=. 5]
[@length .>. 60000]

for $c in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart return
$c/Connection[position() <= 5]
[@length > 32000]

Query 12

For each CompositePart, select the first 5 Connections with length greater than "len".

FOR $c IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart
RETURN
$c/Connection[@length .>. 60000]
[position() .<=. 5]

for $c in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart return
$c/Connection[@length > 32000]
[position() <= 5]

Query 13

For each BaseAssembly count the number of documents.

FOR $b IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly
LET $d := $b/CompositePart/Document
RETURN count($d)

for $b in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
let $d := $b/CompositePart/Document
return count($d)

Query 14

Sort CompositePart in descending order where buildDate is within a year
from current year

FUNCTION year()
{
  "2002"
}

FOR $c IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart
Where  $c/@buildDate .>=. (year()-1)
RETURN
  <result>
    $c
  </result>
sortby (buildDate DESCENDING)

for $c in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart
where $c/@buildDate >= (2003-1)
return $c
sortby(@buildDate descending)

Query 15

Find BaseAssembly of not type "type008".

FOR $b IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly[not(@type='type008')]
RETURN $b

for $b in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly
/BaseAssembly[not(@type='type008')]
return $b

Query 16

Return all BaseAssembly of type "type008" without any child nodes.

FOR $b IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly[./@type="type008"]
Return shallow($b)

for $b in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly
/BaseAssembly[./@type="type008"]
return $b/@*

Query 17

Return all CompositePart having Connection elements with length greater than Avg(length) within the same CompositePart without child elements.

FOR $c IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly           /BaseAssembly/CompositePart, $con IN
$c/Connection[./@length .>. avg($c/Connection/@length)]
Return shallow($con)

for $c in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart, $con in
$c/Connection[@length >
avg($c/Connection/@length)]
return $con/@*

Query 18

For CompositePart of type "type008", give 'Result' containing ID of CompositePart and Document.

FOR $c IN document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart
Return
  <Result $c/@MyID>
    $c/Document
  </Result>

for $c in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart
return $c/Document

Query 19

Select all of CompositePart, Document and AtomicPart.

<Result>
  Let $m := document("small31.xml")
  FILTER (self::CompositePart OR self::Document OR self::AtomicPart)
  return $m
</Result>

NeoCore XMS v. 2.6 here supports neither the tags nor the FILTER() function

Query 20

Select the last connection of each CompositePart.

For $c in document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart
return $c/Connection[position() = last()]

for $c in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart
return $c/Connection[position() = last()]

Query 21

Select the third connection's AtomicParts of each CompositePart.

for $c in document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart,
$cn in $c/Connection[position() = 3]
return $cn/AtomicPart

for $c in document("neo1001.xml")
/Module1/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart,
$cn in $c/Connection[position()=3]
return $cn/AtomicPart

Query 22

Select the AtomicPart whose MyID is smaller than its sibling's and it occurs before that sibling.

for $c in document("small31.xml")
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/BaseAssembly/CompositePart/Connection,
$a1 in $c/AtomicPart
return $c/AtomicPart[(. BEFORE $a1) AND
(./@MyID .<. $a1/@MyID)]

NeoCore XMS v. 2.6 here does not support the BEFORE() function

Query 23

Select all Document after the Document with MyID = 25.

FOR $doc in document("small31.xml")
LET $d := $doc/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly
/CompositePart/Document[@MyID = 25]
return
  <After_DOC>
     $doc/ComplexAssembly
/ComplexAssembly/ComplexAssembly
/ComplexAssembly/BaseAssembly

/CompositePart/Document AFTER $d
</After_DOC>

NeoCore XMS v. 2.6 here does not support the AFTER() function

 

 

 

<< APPENDIX_C_Extensibility.cpp

Index of HTML Docs

APPENDIX E Footprint >>