Skip to content

Commit 70573da

Browse files
committed
Add a mapless interface for browsing nodes
1 parent fd98803 commit 70573da

File tree

9 files changed

+65
-839
lines changed

9 files changed

+65
-839
lines changed

node-browser/src/app/browse/browse.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<div class="map-body">
55
<div class=""></div>
6-
<browser-map></browser-map>
6+
<browser-map #mapChild [geometry]='geometry'></browser-map>
77
</div>
88

99
<div class="outbound-relations">

node-browser/src/app/browse/browse.component.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
.node-title {
3131
font-size:x-large;
3232
padding-left: 1rem;
33-
margin-bottom: 0;
3433
font-weight: bold;
3534
}
3635

node-browser/src/app/browse/browse.component.ts

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,14 @@ import { QueryService } from '../services/query.service'
1414
})
1515
export class BrowseComponent implements OnInit {
1616
// The identifier of the node being presented
17+
node_id: string = '';
1718
node_name: string = '';
1819
// The full path to the node (eg stko-kwg.ucsb.edu/lod/resource/1234)
1920
full_node_id: string = '';
2021
// Event that sends the locations of people from a query to the parent component
2122
@Output() locationEvent = new EventEmitter();
2223
large: boolean = true;
24+
geometry: Array<string>;
2325
// The fully qualified URI of predicates that should appear at the top of the page
2426
preferred_predicate_order: Array <string> = [
2527
"http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
@@ -54,11 +56,25 @@ export class BrowseComponent implements OnInit {
5456

5557

5658
constructor(private route: ActivatedRoute, private queryService: QueryService) {
57-
this.route.queryParams.subscribe(params => {
58-
this.node_name = params['id'];
59-
this.full_node_id = this.getFullNodePath(this.node_name);
59+
this.geometry = [];
60+
this.route.fragment.subscribe(fragment => {
61+
if (fragment != null) {
62+
this.node_id =fragment;
63+
}
64+
console.log(fragment)
65+
this.full_node_id = this.getFullNodePath(this.node_id);
66+
console.log(this.full_node_id)
6067
});
6168

69+
this.queryService.getLabel(this.full_node_id).subscribe({
70+
next: response => {
71+
let parsedResponse = this.queryService.getResults(response);
72+
parsedResponse.forEach(predicate => {
73+
console.log(predicate)
74+
this.node_name = predicate.label.value;
75+
});
76+
}});
77+
6278
this.queryService.getOutboundPredicates(this.full_node_id).subscribe({
6379
next: response => {
6480
let parsedResponse = this.queryService.getResults(response);
@@ -73,7 +89,7 @@ export class BrowseComponent implements OnInit {
7389
let parsedObjects = this.queryService.getResults(response);
7490
let location: string | undefined = undefined;
7591
parsedObjects.forEach(obj => {
76-
// The shortened path of http://localhost:4200/browse?id=<object here>
92+
// The shortened path of http://localhost:4200/browse/#<object here>
7793
let localURI = ''
7894
// If the response doesn't have a label-but is a literal, use the literal as the label
7995
if (obj.label == undefined) {
@@ -111,8 +127,7 @@ export class BrowseComponent implements OnInit {
111127
'localURI': localURI,
112128
'dataType': ''
113129
}
114-
115-
)
130+
)
116131
}
117132
// Check to see if the geometry can be sent to the map
118133
if(predicate.predicate.value === "http://www.opengis.net/ont/geosparql#hasGeometry" || predicate.predicate.value === "http://www.opengis.net/ont/geosparql#hasDefaultGeometry") {
@@ -121,14 +136,20 @@ export class BrowseComponent implements OnInit {
121136
console.log(obj.object.value)
122137
console.log(obj.object.value)
123138
console.log(obj.object.value)
124-
location = obj.object.value
139+
// Get the geometry for the URI
140+
this.queryService.getGeometry(obj.object.value).subscribe({
141+
next: response => {
142+
let geometry_response = this.queryService.getResults(response)
143+
console.log(geometry_response)
144+
if(geometry_response.length()) {
145+
this.locationEvent.emit(geometry_response);
146+
this.geometry = geometry_response;
147+
} else {
148+
console.warn("Found a geometry predicate, but failed to retrieve the geometry as WKT.")
149+
}
150+
}
151+
})
125152
}
126-
127-
128-
129-
130-
131-
132153
}
133154
});
134155
this.locationEvent.emit(location);
@@ -185,8 +206,7 @@ export class BrowseComponent implements OnInit {
185206
}
186207

187208
getExternalKWGPath(uri: string) {
188-
189-
return "https://stko-kwg.geog.ucsb.edu/browse?id=".concat(this.getExternalPrefix(uri))
209+
return "https://stko-kwg.geog.ucsb.edu/browse/#".concat(this.getExternalPrefix(uri))
190210
}
191211

192212
/**

node-browser/src/app/browser-map/browser-map.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Component, Input, AfterViewInit } from '@angular/core';
22
import * as L from 'leaflet';
33
import '@geoman-io/leaflet-geoman-free';
4-
import '@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css';
4+
//import '@geoman-io/leaflet-geoman-free/dist/leaflet-geoman.css';
55
import "leaflet.markercluster";
66
import * as wkt from 'wicket'
77

@@ -18,7 +18,7 @@ export class BrowserMap implements AfterViewInit {
1818

1919
private map: any;
2020
public showMap: boolean;
21-
@Input() locations: any;
21+
@Input() geometry: any;
2222

2323
private initMap(): void {
2424
this.map = L.map('map', {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<footer class="footer">
2-
<img src="../assets/images/svgs/logo-main.svg" alt="Know Where Graph Logo" />
2+
<img src="../assets/images/logo-main.svg" alt="Know Where Graph Logo" />
33
</footer>

node-browser/src/app/footer/footer.component.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
display: flex;
66
justify-content: center;
77
padding: 100px;
8-
width: 100%;;
98
img {
109
width: 13rem;
1110
}

node-browser/src/app/nav/nav.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<section class="landing">
22
<div class="left">
3-
<a href="http://knowwheregraph.org/"><img src="../assets/images/svgs/logo-main.svg"
3+
<a href="http://knowwheregraph.org/"><img src="../assets/images/logo-main.svg"
44
alt="Know Where Graph Logo" /></a>
55
</div>
66
<div class="right" id="menuToggle">

0 commit comments

Comments
 (0)