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

PyPI Version Python Versions License

CI Status Downloads

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.3.tar.gz (11.7 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.3-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aloeschema-0.2.3.tar.gz
  • Upload date:
  • Size: 11.7 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.3.tar.gz
Algorithm Hash digest
SHA256 0a9594ef31dfdc92ac9a4819baf8b7d84003cbf12f987b85538f08450a6a9e62
MD5 712a49d473ebc34dad8cba582be81c4f
BLAKE2b-256 a91e89916444a4918bd87d50fc55d85c9dc9953d03336d7ac4b06d36dba70d85

See more details on using hashes here.

Provenance

The following attestation bundles were made for aloeschema-0.2.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: aloeschema-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 13.1 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a5fbb976e5c0aea2249df4d08f1433f4a5d9867baf0e95ad7a172d6ef612401b
MD5 50f14a8869136221b3ecdef09d35aedd
BLAKE2b-256 e95fca654330335bba4e09cf92b7cbe9c445e9c64629932e9fcbbf1289a0426d

See more details on using hashes here.

Provenance

The following attestation bundles were made for aloeschema-0.2.3-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