Skip to main content

A python package to create OntoPiA RDFs.

Project description

ontopia-py

Maintenance PyPI version PyPI pyversions PyPI status

This python package helps in create and implements an OntoPiA RDF.

How it works

For example, to create a street toponym in the ANNCSU dataset:

from rdflib import XSD, Graph, Literal, Namespace

from ontopia_py import ConceptScheme, createGraph
from ontopia_py.clv import StreetToponym

# Set namespace for data
ANNCSU: Namespace = Namespace("https://w3id.org/sona/data/ANNCSU/")

# Create the graph and bind the namespace
g = createGraph()
g.bind("anncsu", ANNCSU)

# Create the concept scheme
ANNCSU_DATA: ConceptScheme = ConceptScheme(ANNCSU)
ANNCSU_DATA.label = [
    Literal("Anagrafe nazionale numeri civici e strade urbane", lang="it"),
    Literal("Civic Addressing and Street Naming", lang="en")
]

# Add to graph
ANNCSU_DATA.addToGraph(g)

# Create the street toponym
streetToponym: StreetToponym = StreetToponym(
  id="street-1",
  baseUri=ANNCSU,
  dataset=ANNCSU_DATA,
  titles=[Literal("Via Roma", datatype=XSD.string)]
)
streetToponym.toponymQualifier = "Via"
streetToponym.officialStreetName = "Roma"

# Add to graph
streetToponym.addToGraph(g)

Ontologies implemented

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ontopia-py-0.0.5.tar.gz (25.8 kB view details)

Uploaded Source

File details

Details for the file ontopia-py-0.0.5.tar.gz.

File metadata

  • Download URL: ontopia-py-0.0.5.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for ontopia-py-0.0.5.tar.gz
Algorithm Hash digest
SHA256 3e338f89fa98a81cd445ed1049c2c6701e20b483baac3a769054fd6c0926d97e
MD5 26bc6f0e1a8b5a1e80c76847b58a1955
BLAKE2b-256 581dee0afa09f207a45fb3d76dd12b8c7aa7489c1830c4a5f674e26b7bef4178

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page