Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: start working on custom ontology doc #367

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Welcome to APIS's documentation!
:caption: Documentation:

installation
ontology
configuration
user_documentation
data_model
Expand Down
26 changes: 26 additions & 0 deletions docs/source/ontology.rst
Original file line number Diff line number Diff line change
@@ -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 <https://docs.djangoproject.com/en/4.2/topics/db/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.