Skip to main content

Aloeschema is a simple schema.org accessor and validator that allows custom types and properties

Project description

aloeschema

A Schema.org Multitool

License Repo

Getting Started

See quickstart.ipynb for more detailed usage examples

Installation:

pip install aloeschema

Initialization: Loads schema.org and a validator

from aloeschema import load_schema_org
from aloeschema.validator import AloeSchemaValidator
schema_org = load_schema_org()
schema_validator =  AloeSchemaValidator(schema_org)

Validating schema.org

  • Input case is ignored by default (ignore_case=True)
  • Detailed errors raised by default (quiet=False)
    • Set quiet=True to return a truthy result instead
from aloeschema.validator import AloeSchemaValidator
from aloeschema import load_schema_org

schema_org = load_schema_org()
schema_validator = AloeSchemaValidator(schema_org)

schema_validator.Validate(subject_type_name="person", property_type_name="potentialaction", object_type_name="planaction")
schema_validator._getType("schedule")

Extending Schema.org With Custom Types, Properties, and Enumerations

use registerCustomType, registerCustomProperty, registerCustomEnumeration, and registerCustomEnumerationValue to extend Schema.org

from aloeschema.validator import AloeSchemaValidator
from aloeschema import load_schema_org, registerCustomProperty, registerCustomType, registerCustomEnumeration, registerCustomEnumerationValue

schema_org = load_schema_org()

schema_org = registerCustomType(schema_org, name="User", parent="Person", properties=[])
schema_org = registerCustomProperty(schema_org, name="userName", domain=["Person", "User"], range=["Text"])

schema_org = registerCustomEnumeration(schema_org, name="TaskStatus")
schema_org = registerCustomEnumerationValue(schema_org, enum_type="TaskStatus", value="TaskStatusActive")
schema_org = registerCustomProperty(schema_org, name="taskStatus", domain=["User"], range=["TaskStatus"])

schema_validator = AloeSchemaValidator(schema_org)

schema_validator.IsEnumerationType("TaskStatus")                                           # True
schema_validator.EnumerationValueIsOfType("TaskStatus", "TaskStatusActive")               # True
schema_validator.Validate(subject_type_name="User", property_type_name="taskStatus", enumeration_value_name="TaskStatusActive")  # True

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

aloeschema-0.2.0.tar.gz (13.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aloeschema-0.2.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file aloeschema-0.2.0.tar.gz.

File metadata

  • Download URL: aloeschema-0.2.0.tar.gz
  • Upload date:
  • Size: 13.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aloeschema-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e3f98904666f74b38f3aa091ea8febf7d90e1669bda58342b1848fc7a2dfa668
MD5 fc3797010b7c06f56aed41186cd3a455
BLAKE2b-256 2b3b8836640e48b50faaf90cbaee7c8b96d9de87bf68c1f8405ad1407787d2b7

See more details on using hashes here.

Provenance

The following attestation bundles were made for aloeschema-0.2.0.tar.gz:

Publisher: publish.yml on Aloecraft-org/aloeschema

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aloeschema-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: aloeschema-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for aloeschema-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c424179560b36076413276a557e5fee611072c5ca3fe6406e20b694319049f9
MD5 37b93f14a55059da49c91322a92d4617
BLAKE2b-256 3ff882279b7f0944b9fa16aef8a73b6023474253506f6b6fa72c39d5f7594118

See more details on using hashes here.

Provenance

The following attestation bundles were made for aloeschema-0.2.0-py3-none-any.whl:

Publisher: publish.yml on Aloecraft-org/aloeschema

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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