-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: start working on custom ontology doc
- Loading branch information
Showing
2 changed files
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |