Library to model, search, and work with linked data in IVCAP
Project description
ivcap-df
A Python Library for interacting with the IVCAP Data Fabric
Defining Schemas
I need to define a much simpler example. Maybe along the lines of the classical Elementary School experiment of growing grass seeds with different amount of water added every so often - with maybe an imge taken as well for every observation
from ivcap_df import Schema, IdColumn, RefColumn, Column, ColType, Connector
common_ns = 'common'
geo_location_s = Schema('geo_location', common_ns, 'The geographic coordinates of a place or event', [
Column('elevation', ColType.FLOAT64, description="The elevation of a location (WGS 84). Value alone should be assumed to be in meters.", required=False),
Column('latitude', ColType.FLOAT64, description="The latitude of a location. For example 37.42242 (WGS 84)."),
Column('longitude', ColType.FLOAT64, description="The longitude of a location. For example -122.08585 (WGS 84)."),
])
geo_line_s = Schema('geo_line', common_ns, 'The geographic coordinates of a line defined by a from and to locations', [
RefColumn('from', geo_location_s, description='Location of the beginning of the line'),
RefColumn('to', geo_location_s, description='Location of the end of the line'),
])
image_s = Schema('image', common_ns, 'An image', [
Column('url', ColType.STRING, format='uri'),
Column('description', ColType.STRING, required=False),
Column('format', ColType.STRING, required=False),
Column('width', ColType.INT64, description="Image width in pixels", unit='pixel', required=False),
Column('height', ColType.INT64, description="Image height in pixels", unit='pixel', required=False),
Column('dateTime', ColType.STRING, description='The date and time this image was taken (in ISO 8601 date format).', format='date-time', required=False),
RefColumn('location', geo_location_s, required=False),
])
To visualise the schema relationships, execute the following in a Jupyter Notebook:
schemas = {
'geo_location_s': geo_location_s,
'geo_line_s': geo_line_s,
'image': image_s,
}
Schema.to_dot(schemas.values(), fontSize=10)
To persist the schema definition to IVCAP, run the following:
from ivcap_prov import Connector
ivcap_params = {"type": "ivcap", ...}
db = Connector.create(**ivcap_params)
for name, schema in schemas.items():
print(name)
schema.persist(db, verbose=False)
print("...schema done")
db.close()
Loading Data
First we will need to load the respective schemas:
from ivcap_prov import Connector,Schema
bg_ns = 'blue_growth'
ivcap_ns = 'ivcap'
db = Connector.create(**ivcap_params)
qimage_s = Schema.load(db, 'quadrat_image', bg_ns)
image_artifact_s = Schema.load(db, 'image_artifact', ivcap_ns)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ivcap_df-0.4.0.tar.gz
.
File metadata
- Download URL: ivcap_df-0.4.0.tar.gz
- Upload date:
- Size: 27.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.16 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 190414d2f8aeb4fe11402fb83037d6dd7f40a768998a838692384783ed927f34 |
|
MD5 | 94d5a746126000b2830c64ff005428dd |
|
BLAKE2b-256 | 13e1758ae5b74d8a75e173b3d9973f35f62c19bd37c24f37f169639967e3641c |
File details
Details for the file ivcap_df-0.4.0-py3-none-any.whl
.
File metadata
- Download URL: ivcap_df-0.4.0-py3-none-any.whl
- Upload date:
- Size: 34.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.5.1 CPython/3.9.16 Darwin/22.5.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f584211ef8161e298791bc64f99048182d81ec15b6e684ba944375bd64292f14 |
|
MD5 | b3ce29a4fc48152ab3c8dbcb43ee56ad |
|
BLAKE2b-256 | fd4230da68914966fa71de6757c2aae00a1f90de5de62ba33fbd35da1bbf4057 |