@@ -14,12 +14,14 @@ import { QueryService } from '../services/query.service'
1414} )
1515export 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 /**
0 commit comments