Documentation site of NextGraph.org https://docs.nextgraph.org
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docs-site/src/pages/en/framework/schema.md

112 lines
8.9 KiB

---
title: Data Schema, Context, Ontology
description: Describe the Schema of your data with a set of Semantic Ontologies that will define your JSON-LD Context
layout: ../../../layouts/MainLayout.astro
---
2 months ago
2 months ago
As explained in the previous chapter about the [Semantic Web and Ontologies](/en/framework/semantic), NextGraph is based on RDF, and OWL is used to defined Ontologies, which are equivalent to a Schema definition.
2 months ago
Every document can list a set of prefixes and associated ontology that the Document is using.
This is done with the `context` branch internally and is accessible from the document Menu, under Tools, then Schema. (not implemented for now).
The schema is defined at the Document level, not at the branch or block level.
It can updated at any time, and prefixes can be removed too, that will not affect the predicates that are using it, as all predicates are encoded and saved with their full URI anyway.
The context is useful for SPARQL Queries and for JSON-LD output.
JSON-LD is not available yet but will be included in an upcoming release.
2 months ago
By default, NextGraph always defines the prefix `ng` that is reserved for special predicates that all Documents in NextGraph can or must have.
2 months ago
The list is detailed below. This prefix cannot be overridden.
In this `ng` ontology, we also define the primary classes of all the types of documents that are officially supported in our Apps.
We also can expose some common prefixes if requested, that are listed a bit below.
And in general we strive to map our official primary classes with existing ontologies for backward compatibility. You are encouraged too to reuse existing ontologies or directly in your prefixes, or by inheriting from them in your own ontology definitions.
We will also keep a repository of well known ontologies of specific interest.
A new ontology can be defined by creating a new Document of type Data / Ontology (not available yet)
### ng ontology
2 months ago
There is a special prefix ng: for the NextGraph ontology (not to be confused with the did:ng method). It is available in all RDF documents and cannot be overridden by other prefixes/context.
It has a list of predicates that help manage the Documents. It is also a way for us to offer a metadata API on each document, that can be queries with SPARQL. This API automatically generates some virtual triples about the document. let's have a look more in details about them.
| predicate | R/W | type | label | comment | equivalent |
| --------- | --- | ------------- | ---------- | -------------------------------------------- | ------------------------------------------------------- |
| | | | | | |
| ng:a | RW | string | about | short description | rdfs:comment<br/> as:summary<br/>og:description |
| ng:b | R | string | weblink | link at nextgraph.one | |
| ng:c | R | rdfs:Class | class | primary class | rdf:type |
| ng:e | RW | rdfs:Resource | extlink | http external link | og:url <br/> as:url |
| ng:f | R | Nuri | file | a linked binary file | |
| ng:g | R | Nuri | nuri | nuri of self | |
| ng:h | R | Nuri | follower | branch containing followers | as:followers |
| ng:i | R | Nuri | inbox | inbox of repo ng:p | as:inbox |
| ng:j | RW | Nuri | image | default image | as:image<br/> og:image <br/> vcard:photo <br/> foaf:img |
| ng:k | RW | keyword | keyword | list of related to | |
| ng:l | RW | langString | lang | language BCP47 | og:locale <br/> rdf:language |
| ng:m | R | Nuri | comment | comment branch | |
| ng:n | RW | string | title | title or name | rdfs:label <br/> as:name <br/> og:title |
| ng:o | R | Nuri | viewer | list of viewers | |
| ng:p | R | TBD | permission | list of permissions | |
| ng:q | R | Nuri | qrcode | image of QR-code <br/>containing ng:b | |
| ng:r | R | Nuri | store | store header branch | |
| ng:s | R | Nuri | stream | stream branch of store | |
| ng:t | RW | dateTime | time | date and time | |
| ng:u | RW | Nuri | icon | favicon image | as:icon |
| ng:v | R | Nuri | backlinks | backlinks branch | |
| ng:w | R | Nuri | editor | list of editors | |
| ng:x | R | Nuri | context | context branch for <br/>JSON-LD and prefixes | |
| ng:y | R | Nuri | following | branch containing following | as:following |
| ng:z | R | Nuri | service | list of services | |
| ng:loc | RW | TBD | location | location (country, <br/>geoname, coordinate) | |
`Nuri` is a subClass of `rdfs:Resource`
Apart from `ng:f`, `ng:g`, `ng:p` and `ng:q`, all the other predicates sit in the `Header` branch.
`ng:c` also sits in every block branch.
2 months ago
### official primary classes
2 months ago
see [Features](/en/features) for a list of all official primary classes
2 months ago
### common prefixes available in NextGraph
2 months ago
| prefix | resolves to |
| ------------- | ------------------------------------------------- |
| rdf: | http://www.w3.org/1999/02/22-rdf-syntax-ns# |
| rdfs: | http://www.w3.org/2000/01/rdf-schema# |
| xsd: | http://www.w3.org/2001/XMLSchema# |
| owl: | http://www.w3.org/2002/07/owl# |
| sh: | http://www.w3.org/ns/shacl# |
| shex: | http://www.w3.org/ns/shex# |
| skos: | http://www.w3.org/2004/02/skos/core# |
| schema: | https://schema.org/ |
| foaf: | http://xmlns.com/foaf/0.1/ |
| relationship: | http://purl.org/vocab/relationship/ |
| dcterms: | http://purl.org/dc/terms/ |
| dcmitype: | http://purl.org/dc/dcmitype/ |
| as: | https://www.w3.org/ns/activitystreams# |
| ldp: | http://www.w3.org/ns/ldp# |
| vcard: | http://www.w3.org/2006/vcard/ns# |
| og: | [http://ogp.me/ns#](https://ogp.me/ns/ogp.me.ttl) |
| cc: | http://creativecommons.org/ns# |
| sec: | https://w3id.org/security# |
| wgs: | http://www.w3.org/2003/01/geo/wgs84_pos# |
| gn: | https://www.geonames.org/ontology# |
| geo: | http://www.opengis.net/ont/geosparql# |
| time: | http://www.w3.org/2006/time# |
2 months ago
### well known Ontologies by domain
2 months ago
TBD
You can have a look at [Awesome ontology](https://github.com/ozekik/awesome-ontology#ontologies-and-vocabularies) and [LOV Linked Open Vocabularies](https://lov.linkeddata.es/) in the meanwhile