diff --git a/README.md b/README.md index e458de9ee843ec6f96809ea439d695d03f49c065..90be502e8813fd7160be6a991311ba7596c21c33 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,7 @@ SITE_URL = 'http://localhost:8000' BASE_URL = SITE_URL ``` -* `LDP_RDF_CONTEXT` tells DjangoLDP where our RDF [ontology](https://www.w3.org/standards/semanticweb/ontology) is defined, which will be returned as part of our views in the 'context' field. This is a web URL and you can visit the value to view the full ontology online +* `LDP_RDF_CONTEXT` tells DjangoLDP where our RDF [ontology](https://www.w3.org/standards/semanticweb/ontology) is defined, which will be returned as part of our views in the 'context' field. This is a web URL and you can visit the value to view the full ontology online. The ontology can be a string, as in the example, but it can also be a dictionary, or a list of ontologies (see the [JSON-LD spec](https://json-ld.org) for examples) * `DJANGOLDP_PACKAGES` defines which other [DjangoLDP packages](https://git.happy-dev.fr/startinblox/djangoldp-packages) we're using in this installation * `SITE_URL` is the URL serving the site, e.g. `https://example.com/`. Note that if you include the DjangoLDP urls in a nested path (e.g. `https://example.com/api/`), then `SITE_URL` will need to be set to this value * `BASE_URL` may be different from SITE_URL, e.g. `https://example.com/app/` @@ -280,6 +280,19 @@ class Meta: ### rdf_type +Indicates the type the model corresponds to in the ontology. E.g. where `'hd:circle'` is defined in an ontology from `settings.LDP_RDF_CONTEXT` + +```python +rdf_type = 'hd:circle' +``` + +### rdf_context + +Sets added `context` fields to be serialized with model instances +```python +rdf_context = {'picture': 'foaf:depiction'} +``` + ### auto_author This property allows to associate a model with the logged in user. diff --git a/djangoldp/activities/services.py b/djangoldp/activities/services.py index 9bc509c9ccbdd97e012fd70d1c78130eb9ee7132..3f7d0e6f4bf0824deb148a402feb82b18cc0a739 100644 --- a/djangoldp/activities/services.py +++ b/djangoldp/activities/services.py @@ -33,7 +33,6 @@ class ActivityPubService(object): "@id": instance.urlid } if obj['@type'] is None: - logger.warning('[Backlink-Creation] model ' + str(model) + ' has no rdf_type') return # append relations @@ -49,7 +48,6 @@ class ActivityPubService(object): } if sub_object['@type'] is None: - logger.warning('[Backlink-Creation] model ' + str(type(value)) + ' has no rdf_type') continue obj[field_name] = sub_object @@ -256,7 +254,6 @@ def _check_instance_for_backlinks(sender, instance): # bounds checking if not hasattr(instance, 'urlid') or Model.get_model_rdf_type(sender) is None: - logger.warning('[Create-Backlink] model ' + str(sender) + ' has no rdf_type') return {} # check each foreign key for a distant resource @@ -269,7 +266,6 @@ def _check_instance_for_backlinks(sender, instance): target_type = Model.get_model_rdf_type(type(value)) if target_type is None: - logger.warning('[Create-Backlink] model ' + str(type(value)) + ' has no rdf_type') continue targets[value.urlid] = ActivityPubService._discover_inbox(value.urlid) @@ -345,10 +341,8 @@ def check_m2m_for_backlinks(sender, instance, action, *args, **kwargs): container_rdf_type = Model.get_model_rdf_type(type(instance)) if member_rdf_type is None: - logger.warning('[Backlink-Creation] model ' + str(member_model) + ' has no rdf_type') return if container_rdf_type is None: - logger.warning('[Backlink-Creation] model ' + str(type(instance)) + ' has no rdf_type') return # build list of targets (models affected by the change)