{"id":16669234,"url":"https://github.com/cknoll/yamlpyowl","last_synced_at":"2025-07-14T21:40:39.026Z","repository":{"id":45329043,"uuid":"305425640","full_name":"cknoll/yamlpyowl","owner":"cknoll","description":"python based YAML-to-OWL-converter","archived":false,"fork":false,"pushed_at":"2022-05-20T08:34:01.000Z","size":176,"stargazers_count":17,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-23T21:24:06.499Z","etag":null,"topics":["ontology","owl","python","semantic-web","yaml"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cknoll.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-10-19T15:14:17.000Z","updated_at":"2024-12-31T02:50:32.000Z","dependencies_parsed_at":"2022-09-22T21:41:28.504Z","dependency_job_id":null,"html_url":"https://github.com/cknoll/yamlpyowl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cknoll%2Fyamlpyowl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cknoll%2Fyamlpyowl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cknoll%2Fyamlpyowl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cknoll%2Fyamlpyowl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cknoll","download_url":"https://codeload.github.com/cknoll/yamlpyowl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248098115,"owners_count":21047371,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ontology","owl","python","semantic-web","yaml"],"created_at":"2024-10-12T11:30:42.551Z","updated_at":"2025-04-09T19:33:49.688Z","avatar_url":"https://github.com/cknoll.png","language":"Python","funding_links":[],"categories":["Ontology Utilities"],"sub_categories":[],"readme":"[![Build Status](https://cloud.drone.io/api/badges/cknoll/yamlpyowl/status.svg)](https://cloud.drone.io/cknoll/yamlpyowl)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n# General Information\n\nThis tool (yamlpyowl) aims to read an ontology (including individuals and SWRL rules) specified via the simple and widespread data-serialization language [YAML](https://en.wikipedia.org/wiki/YAML) and represent it as collection of python-objects via the package [`owlready2`](https://owlready2.readthedocs.io). From there, a reasoner can be used or the ontology can be exported to standard-owl format *rdfxml*.\n\n# Motivation\n\nAlmost all existing OWL2-syntax-dialects (RDF-XML, Turtle, Manchester) seem more or less unpractical for **manual authoring**. On the other hand, to encourage contributions, e.g. from students, the requirement to learn a sophisticated tool like [Protégé](http://protege.stanford.edu/) or at least some *exotic* syntax like Manchester seems to be a significant hurdle. See also [this blog post](https://keet.wordpress.com/2020/04/10/a-draft-requirements-catalogue-for-ontology-languages/) from knowledge engineering expert Maria Keet, and especially requirement HU-3: *\"Have at least one compact, human-readable syntax defined so that it can be easily typed up in emails.\"* The tool yamlpyowl aims to explore in that direction. It relies on the widespread human-readable data-serialization language [YAML](https://en.wikipedia.org/wiki/YAML).\n\nThe project is part of the authors endeavour to simplify the understanding and the usage of semantic technologies for humans without much experience in this field, e.g. from engineering. \n\n# Examples\n\n## Overview\n\n- [examples/pizza.owl.yml](examples/pizza.owl.yml) (Simple example, see also below) \n- [examples/einsteins_zebra_riddle.owl.yml](examples/einsteins_zebra_riddle.owl.yml)\n    - Understandable OWL-Representation of a famous logical puzzle, posed by A. Einstein. The reasoner solves this puzzle (see unittests).  \n- [examples/regional-rules.owl.yml](examples/regional-rules.owl.yml) \n\nMore examples can be found in the directory.\n## Pizza Ontology Preview \n\nThe following example is a strongly simplified fragment of the \"Pizza-Ontology\" which is often used as introduction, e.g. in Protégé tutorials.\n\n```yaml\n# shortcut to define multiple classes\n- multiple_owl_classes:\n      - Food:\n          SubClassOf: \"owl:Thing\"\n      - PizzaBase:\n          SubClassOf: Food\n      # ---\n      - ThinAndCrispyBase:\n          SubClassOf: PizzaBase\n      # ---\n      - PizzaTopping:\n          SubClassOf: Food\n      - CheezeTopping:\n          SubClassOf: PizzaTopping\n      - MozzarellaTopping:\n          SubClassOf: CheezeTopping\n\n      # ...\n\n- owl_object_property:\n    hasSpiciness:\n        Domain:\n          - \"owl:Thing\"\n        Range:\n          - Spiciness\n        Characteristics:\n            - Functional\n\n- owl_object_property:\n    hasIngredient:\n        # shortcut: use plain string instead of len1-list\n        Domain: Food\n        Range: Food\n        Characteristics:\n            - Transitive\n# ...\n\n\n# create an individual \n- owl_individual:\n    mypizza1:\n      types:\n        - Pizza\n\n# assert some facts \n- property_facts:\n    hasTopping:\n        Facts:\n            - mypizza1:\n                - iTomatoTopping\n                - iMozzarellaTopping\n    hasBase:\n        Facts:\n            - mypizza1: iThinAndCrispyBase \n```\n\n\n# Features\n\n*yamlpyowl* implements some \"magic\" convenience features, i.e. extensions to OWL2. To be easily recognizable the corresponding keywords all start with `X_`.\n\n\n## RelationConcepts to Simplify n-ary Relations\n\nThe concept name `X_RelationConcept` has a special meaning. It is used to simplify the creation of n-ary relations. In OWL it is typically required to create a own concept for such relations and an instance (individual) for each concrete relation, see this [W3C Working Group Note](https://www.w3.org/TR/swbp-n-aryRelations/#pattern1).\n\nThe parser of *yamlpyowl* simplifies this: For every subclass of `X_RelationConcept` (which must start with `X_`and by convention should end with `_RC`, e.g. `X_DocumentReference_RC`)) the parser automatically creates a role `X_hasDocumentReference_RC`. Its domain can be specified with the attribute `X_associatedWithClasses`. The roles which can be applied to this concept are defined as usual. The application to individuals is done by `relation_concept_facts`.\n\nShort Example:\n\n```yaml\n- multiple_owl_classes:\n\n      # ...\n\n      - X_RelationConcept:\n          # base class\n          SubClassOf: \"owl:Thing\"\n\n      - X_CombinedTasteValue_RC:\n          SubClassOf: X_RelationConcept\n          X_associatedWithClasses:\n            - PizzaTopping\n\n\n- owl_object_property:\n    hasCombinationPartner:\n        Domain: X_CombinedTasteValue_RC\n        Range: Food\n\n- owl_data_property:\n    hasFunctionValue:\n        Domain: \"owl:Thing\"\n        Range:\n            - float\n        Characteristics:\n            - Functional\n\n# model two ternary relations: Mozzarella tastes 95%-good in\n# combination with tomatos but only 50%-good in combination with meat.\n- relation_concept_facts:\n    iMozzarellaTopping:\n        X_hasCombinedTasteValue_RC:\n            - hasCombinationPartner: iTomatoTopping\n              hasFunctionValue: 0.95\n            - hasCombinationPartner: iMeatTopping\n              hasFunctionValue: 0.5\n```\n\nFurther example: see [regional-rules.owl.yml](examples/regional-rules.owl.yml)\n\n## SWRL Rules\n\nSemantic Web Rule Language (SWRL) rules can be defined with the keyword `swrl_rule`.\nSee [regional-rules.owl.yml](examples/regional-rules.owl.yml) for example usages.\n\n## Proxy Individuals\n\nThe python package [`owlready2`](https://owlready2.readthedocs.io) and most owl reasoners do not support meta classes (also called \"punning\"). However, sometimes it is necessary to express knowledge which refers to a class and not primarily to its instances. This can be modeled with \"proxy individuals\". yamlpyowl has the following optional keyword for this: `__create_proxy_individual`. Allowed values are `True`, `recursive`, and `False` (default). The respective individuals have the name `i\u003cClassName\u003e`.\n\n## Command Line Interface\n\nyamlpyowl comes with a command line interface which is automatically installed via pip. Main purpose: simple conversion from yaml to rdfxml format. See `yamlpyowl --help` for more information.\n\n\n# Documentation\nOrdinary documentation does not yet exist. However, the following might be at least somewhat useful: \n\n- [demo notebook of the zebra puzzle](doc/demo_notebooks/zebra_puzzle.ipynb),\n- [unittests](tests/test_core.py),\n- [docstrings and type hints in core.py](src/yamlpyowl/core.py).\n\n# Requirements\n\n- python \u003e= 3.8\n- java\n- \u003crequirements.txt\u003e (installed automatically via pip)\n\nThe docker container which provides the runtime environment for unittests is available here: [carvk/java_python](https://hub.docker.com/repository/docker/carvk/java_python).\n\n# Installation\n\n## Install for Normal Usage\n\n- Run `pip install yamlpyowl` to install the latest officially released version\n\n## Install Directly from Source Repo\n\n- Clone the repo\n- Run `pip install -e .` from the project root\n    - This installs in \"editable mode\" best suited for experimenting and hacking.\n\n\n# Development Status\n\nYamlpyowl is currently an early prototype and will likely be expanded (and changed) in the future. If you are interested in  using this package in your project as a dependency or in contributing to Yamlpyowl please open an issue or contact the author. The same holds for feature requests and bug reports.\n\n# Contribution\n\nContributions in form of issues or pull requests are highly welcome. If you submit code please ensure that this project uses automatic code formatting with the tool [black](https://github.com/psf/black), more precisely: `black -l 120 src`.\n\n# Misc remarks\n\n-  There exists at least one earlier similar tool: [yaml2owl](https://github.com/leifw/yaml2owl), written in haskel. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcknoll%2Fyamlpyowl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcknoll%2Fyamlpyowl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcknoll%2Fyamlpyowl/lists"}