From 41710b07a5314dab5dee1e9b9ea3c89ed5e118da Mon Sep 17 00:00:00 2001 From: Birger Schacht Date: Wed, 18 Oct 2023 18:02:09 +0200 Subject: [PATCH] WIP: start working on custom ontology doc --- docs/source/index.rst | 1 + docs/source/ontology.rst | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 docs/source/ontology.rst diff --git a/docs/source/index.rst b/docs/source/index.rst index b1072c05d..263f1e6f3 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -13,6 +13,7 @@ Welcome to APIS's documentation! :caption: Documentation: installation + ontology configuration user_documentation data_model diff --git a/docs/source/ontology.rst b/docs/source/ontology.rst new file mode 100644 index 000000000..02ca2dd8f --- /dev/null +++ b/docs/source/ontology.rst @@ -0,0 +1,26 @@ +Set up your ontology +==================== + +APIS provides two main types: entities and relations. Entities are things, whereas relations are the connections between things. +To define your own entities and relations, we use `Django models `_. + +Entities +-------- + +To create entities, define them in your application and let them inherit from :class:`apis_core.apis_entities.models.AbstractEntity` +Like with any other Django model, you can define fields describing the attributes of this entity: + +.. code-block:: python + + from apis_core.apis_entities.models import AbstractEntity + + class Person(AbstractEntity): + name = models.CharField(max_length=255, help_text="The personsĀ“s name", blank=True, null=True) + + + class Place(AbstractEntity): + lat = models.FloatField(blank=True, null=True, verbose_name="latitude") + lng = models.FloatField(blank=True, null=True, verbose_name="longitude") + +For every entity you define, there will be a menu entry in the main APIS menu, pointing to a list of instances of this entity. In +this list it is possible to filter entities based on their defined attributes.