-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.xqy
executable file
·212 lines (210 loc) · 6.57 KB
/
default.xqy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
xquery version "1.0-ml";
(: default.xqy :)
declare namespace hb = "http://www.marklogic.com/ns/osm-hamburg";
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>MarkLogic OSM Editor - Introduction</title>
<link rel="stylesheet" type="text/css" href="css/default.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.snippet.css" />
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/snippet/jquery.snippet.min.js"></script>
<script type="text/javascript" src="js/jquery.corner.js"></script>
<script type="text/javascript" src="js/default.js"></script>
</head>
<body>
<div id="fixed-tr">
<hr/>
<hr/>
<h4>
Time to show what it does
</h4>
<ol dir="rtl">
<li>
<a href="loadhamburg.xqy" target="_blank">
Load sample of OpenStreetmap data set city of Hamburg, Germany
</a>
</li>
<li>
<a href="dumphamburg.xqy" target="_blank">
Display all nodes data from sample data set, show on map and edit OpenStreetmap tags
</a>
</li>
<li>
<a href="spatialsearchhamburg.xqy" target="_blank">
Display geospatial search results in heatmap
<!-- would be way too much with real OpenStreetMap data set -->
</a>
<li>
<a href="simplesearchhamburg.xqy" target="_blank">
Search the data for specific user
</a>
</li>
</li>
<!--
<li>
<a href="updatehamburg-form.xqy" target="_blank">
Test to update node in OpenStreetMap data
</a>
</li>
-->
<li>
<a href="http://localhost:8006" target="_blank">
Aplication Builder Application - testOscar1
</a>
</li>
</ol>
</div>
<h1>
MarkLogic OSM Editor - Introduction
</h1>
<p>
This is my personal test project using MarkLogic to edit OpenStreetmap data.<br/>
The first version focuses on displaying and querying the data, both relational and spatial.<br/>
Updating information is possible too.<br/>
The data used is a tiny piece of the total OpenStreetmap database and I'm not making changes on any real data (yet).
</p>
<p>
<h4>
How does it look?
</h4>
</p>
<p>
<img src="images/mlosmeditor1.png" />
</p>
<p>
<h4>
Possible enhancements
</h4>
</p>
<p>
Too much to note right now.
<!--
But I'd like to add the following:
Heatmap
MarkLogic xquery paging
-->
</p>
<p>
<h4>
Why this OpenStreetmap editor?
</h4>
</p>
<p>
OpenStreetmap database is quite large, over <a href="http://wiki.openstreetmap.org/wiki/Planet.osm" target="_blank">250 GB</a> currently. OpenStreetmap data is in XML format. Sounds like a good candidate for MarkLogic database capable of handling any data, at any volume, in any structure.
</p>
<p>
<h4>
Statistics
</h4>
<!--
declare namespace hb="http://www.marklogic.com/ns/osm-hamburg";
<result>
<node_count>{ count(doc("hamburg.xml")//hb:node) }</node_count>
<way_count>{ count(doc("hamburg.xml")//hb:way) }</way_count>
<relation_count>{ count(doc("hamburg.xml")//hb:relation) }</relation_count>
<tag_count>{ count(doc("hamburg.xml")//hb:tag) }</tag_count>
</result>
322,4,5,187
<result>
<node_count>{ xdmp:estimate(doc("hamburg.xml")//hb:node) }</node_count>
<way_count>{ xdmp:estimate(doc("hamburg.xml")//hb:way) }</way_count>
<relation_count>{ xdmp:estimate(doc("hamburg.xml")//hb:relation) }</relation_count>
<tag_count>{ xdmp:estimate(doc("hamburg.xml")//hb:tag) }</tag_count>
</result>
1,1,1,1
xdmp:estimate says 1,1,1,1 because no index yet?
-->
The following spatial objects exist in the sample OpenStreetmap data set:<br/>
<ul>
<li>
<span class="emp">
{ count(doc("hamburg.xml")//hb:node) }
</span>
nodes<br/>
</li>
<li>
<span class="emp">
{ count(doc("hamburg.xml")//hb:way) }
</span>
ways<br/>
</li>
<li>
<span class="emp">
{ count(doc("hamburg.xml")//hb:relation) }
</span>
relations<br/>
</li>
</ul>
These objects have a total of <span class="emp">
{ count(doc("hamburg.xml")//hb:tag) }
</span> tags.
</p>
<p>
<h4>
Software and data used
</h4>
<ul>
<li>
Initially created for MarkLogic 5.0-3.3, runs on MarkLogic 9 too :-)
</li>
<li>
OpenStreetMap, Leaflet © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="http://cloudmade.com">CloudMade</a>
<!--
http://leaflet.cloudmade.com/
-->
</li>
<li>
jQuery, jQuery UI, Jeditable, jquery-ui-tabs-paging, Snippet, jQuery Corner
<!--
http://jquery.com/
http://jqueryui.com/
http://www.appelsiini.net/projects/jeditable
http://code.google.com/p/jquery-ui-tabs-paging/
http://www.steamdev.com/snippet/
https://github.com/malsup/corner
-->
</li>
<li>
Notepad++
</li>
</ul>
</p>
<p>
<h4>
Sample OpenStreetMap data
</h4>
<pre class="xml">
<hamburg xmlns="http://www.marklogic.com/ns/osm-hamburg">
<node id="122317" lat="53.5282681" lon="10.0232293" version="6" changeset="11135712" user="cassy" uid="578473" timestamp="2012-03-29T10:05:34Z">
<tag k="TMC:cid_58:tabcd_1:Class" v="Point" />
<tag k="TMC:cid_58:tabcd_1:Direction" v="positive" />
<tag k="TMC:cid_58:tabcd_1:LCLversion" v="8.00" />
<tag k="TMC:cid_58:tabcd_1:LocationCode" v="10696" />
<tag k="TMC:cid_58:tabcd_1:NextLocationCode" v="10697" />
<tag k="TMC:cid_58:tabcd_1:PrevLocationCode" v="10695" />
</node>
<node id="122318" lat="53.5297724" lon="10.0242429" version="5" changeset="11135712" user="cassy" uid="578473" timestamp="2012-03-29T10:05:33Z">
<tag k="highway" v="speed_camera" />
</node>
<node id="122329" lat="53.5375321" lon="10.0310097" version="9" changeset="8215853" user="FvGordon" uid="161619" timestamp="2011-05-22T12:59:16Z">
<tag k="highway" v="traffic_signals" />
<tag k="TMC:cid_58:tabcd_1:Class" v="Point" />
<tag k="TMC:cid_58:tabcd_1:Direction" v="positive" />
<tag k="TMC:cid_58:tabcd_1:LCLversion" v="8.00" />
<tag k="TMC:cid_58:tabcd_1:LocationCode" v="35609" />
<tag k="TMC:cid_58:tabcd_1:PrevLocationCode" v="53868" />
</node>
<node id="122331" lat="53.5390823" lon="10.0323663" version="5" changeset="235617" user="mbuege" uid="4902" timestamp="2008-04-23T20:22:49Z"/>
<node id="122332" lat="53.5391351" lon="10.0323397" version="6" changeset="8215853" user="FvGordon" uid="161619" timestamp="2011-05-22T12:59:52Z"/>
<node id="94277077" lat="53.5224788" lon="10.0245725" version="2" changeset="1442329" user="klausis" uid="85761" timestamp="2009-06-06T21:36:13Z"/>
<node id="94277079" lat="53.5238790" lon="10.0233364" version="5" changeset="8883299" user="Glühwürmchen" uid="349191" timestamp="2011-07-31T17:40:23Z">
<tag k="highway" v="motorway_junction" />
<tag k="name" v="Hamburg-Veddel" />
<tag k="ref" v="1" />
</node>
</hamburg>
</pre>
</p>
</body>
</html>