@@ -32,10 +32,16 @@ if there is a problem getting into our account.
32
32
``` python
33
33
team = os.environ[' TERMINUSDB_TEAM' ]
34
34
team_quoted = urllib.parse.quote(team)
35
+ # ###
36
+ # To use TerminusCMS
35
37
client = WOQLClient(f " https://cloud.terminusdb.com/ { team_quoted} / " )
36
38
# make sure you have put the token in environment variable
37
- # https://docs. terminusdb.com/v10.0/#/terminusx/ get-your -api-key
39
+ # https://terminusdb.com/docs/terminuscms/ get-api-key
38
40
client.connect(team = team, use_token = True )
41
+ # ###
42
+ # to connect locally, comment the above client and call and try this instead:
43
+ # client = WOQLClient("http://localhost:6363/")
44
+ # client.connect(team=team)
39
45
```
40
46
41
47
Once we are in, we can start to build our data product. A data product
@@ -63,17 +69,20 @@ prefixes = {'@base' : 'http://lib.terminusdb.com/nuclear/',
63
69
64
70
Now we get to the meat. We will want to describe * where* our reactors
65
71
are. In order to do that we need a geo-coordinate. Hence we've created
66
- a small schema called ` geo_schema.json ` , which has (among other
67
- things), the following definition:
72
+ a small schema called ` geo_schema.json ` , which is a subset of the
73
+ GeoJSON schema, and has (among other things) a point type, with the
74
+ following definition:
68
75
69
76
``` json
70
- { "@type" : " Class" ,
71
- "@id" : " GeoCoordinate" ,
72
- "@subdocument" : [],
73
- "@key" : { "@type" : " Lexical" ,
74
- "@fields" : [" latitude" , " longitude" ] },
75
- "latitude" : " xsd:decimal" ,
76
- "longitude" : " xsd:decimal"
77
+ { "@id" : " Point" ,
78
+ "@inherits" : " Geometry" ,
79
+ "@type" : " Class" ,
80
+ "coordinates" : {
81
+ "@class" : " xsd:decimal" ,
82
+ "@dimensions" : 1 ,
83
+ "@type" : " Array"
84
+ },
85
+ "type" : " Point_Type"
77
86
}
78
87
```
79
88
@@ -370,9 +379,9 @@ def import_nuclear(client):
370
379
plant = { ' @type' : " NuclearPowerPlant" ,
371
380
' name' : name,
372
381
' country' : { ' @ref' : f " Country/ { country_long} " },
373
- ' location' : { ' @type' : ' GeoCoordinate ' ,
374
- ' latitude ' : latitude ,
375
- ' longitude ' : longitude },
382
+ ' location' : { ' @type' : " Point " ,
383
+ ' type ' : " Point " ,
384
+ ' coordinates ' : [latitude, longitude] },
376
385
' capacity' : { ' @type' : ' Quantity' ,
377
386
' unit' : ' Unit/MWe' ,
378
387
' quantity' : capacity_mw },
0 commit comments