2
module namespace foaf = "http://www.w3.org/TestModules/foaf";
4
import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
5
import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
6
import module namespace index_ddl = "http://www.zorba-xquery.com/modules/store/static/indexes/ddl";
7
import module namespace index_dml = "http://www.zorba-xquery.com/modules/store/static/indexes/dml";
9
declare namespace ann = "http://www.zorba-xquery.com/annotations";
11
declare variable $foaf:network:= xs:QName("foaf:network");
13
declare collection foaf:network as object()*;
17
Create and populate the collection, and then create the indexes
20
declare %ann:sequential function foaf:create-db()
22
ddl:create($foaf:network);
24
dml:insert($foaf:network, (
26
"name" : "James T. Kirk",
29
"friends" : [ "Mister Spock", "Scotty", "Jean-Luc Picard"]
33
"name" : "Jean-Luc Picard",
36
"friends" : [ "James T. Kirk", "Lieutenant Commander Data", "Beverly Crusher" ]
40
"name" : "Beverly Crusher",
43
"friends" : [ "Jean-Luc Picard", "Ensign Crusher" ]
47
"name" : "Lieutenant Commander Data",
49
"gender" : "positronic matrix",
50
"friends" : [ "Geordi La Forge" ]