-
Notifications
You must be signed in to change notification settings - Fork 44
TODO Onboarding
This document shows how a new domain, in this case, teacher domain is enabled using OpenSABER. The following are the typical steps an adopter has to do:
Details on modeling the data can be found here and details on modeling validation for Registry can be found here.
- Creating a new RDF vocabulary of terms, if those terms are not already defined. It is considered best practice, to re-use existing vocabularies. For instance,
schema.org
defines aPerson
, so one need not redefine it, but one may choose to extendPerson
to a specific agent, in this case, aTeacher
. - Understanding how to call the OpenSABER APIs.
- Configuring a validator which uses the vocabulary to validate user input.
- Installing and configuring OpenSABER runtime (software).
Let's take the example of starting from scratch and enabling the Teacher
use case and installing OpenSABER as the DIKSHA Teacher Registry.
Try to use the schema.org
or equivalent vocabulary wherever applicable. If schema.org
is insufficient (which is likely), create a RDF file and send in a Pull Request to domains/ for review. While defining a vocabulary for the custom domain, you may end up creating some core classes and properties. You are encouraged to contribute to the core, via the same PR mechanism. To know, how to extend schema.org
, read up on the web, or just study the files in domains/
folder. Extending is fairly straightforward.
All information can be represented in Triples of subject, predicate and object. For instance,
ID 456IHO&78 is a Teacher, her name is Lakshmi and she is a PGT.
This can be represented in RDF (here, Turtle) as
OpenSABER:456IHO&78 a OpenSABER:Teacher ;
schema:name "Lakshmi" ;
OpenSABER:teacherTitle OpenSABER:PGT .
You can see that OpenSABER:456IHO&78
is the subject and there are 3 predicates - a
denoting type, schema:name
denoting name and OpenSABER:teacherTitle
denoting a property which in one out of PGT, TGT and lets say PRT.
schema:name
is a short form for http:\schema.org\name. Everything is namespaced, so one can pick and choose properties and classes from any vocabulary which suits the domain definition.
So, if we are starting from scratch, schema.org
does not have the concept of a Teacher
, so if we had to create the Teacher
agent, we can safely assume that it will subclass from Person
. Subclassing would mean 2 things:
- Every instance of
Teacher
is also an instance ofPerson
, which is true. - Every property which has a domain of
Person
will also be applicable toTeacher
. This is really good, because common properties likename
, etc are just already available viaPerson
. Of course, there maybe many more properties than the ones you want to use, but that's ok. You can filter out the ones you need via yourvalidators
. RDF via nature is more inclusive than not, so be comfortable with taking all what other vocabularies bring on the table.
So, the Teacher
RDF if it has to extend from Person
would look like
OpenSABER:Teacher a rdfs:Class ;
rdfs:label "Teacher" ;
schema:isPartOf <http://teacher.pending.OpenSABER.io> ;
rdfs:comment "A Teacher." ;
rdfs:subClassOf schema:Person .
and lets say we need a new property called teacherTitle
which is an Enumeration, like PRT, TGT, PGT, etc, all of which are actually instances of the Enumeration. So, the following is how you would create an Enumeration and list out the values of an Enumeration:
OpenSABER:TeacherTitle a rdfs:Class ;
rdfs:label "TeacherTitle" ;
rdfs:comment "An enumeration of teacher titles." ;
rdfs:subClassOf schema:Enumeration .
OpenSABER:PGT a OpenSABER:TeacherTitle ;
rdfs:label "PGT" ;
rdfs:comment "Post Graduate Teacher." .
OpenSABER:TGT a OpenSABER:TeacherTitle ;
rdfs:label "TGT" ;
rdfs:comment "Trained Graduate Teacher." .
OpenSABER:PRT a OpenSABER:TeacherTitle ;
rdfs:label "PRT" ;
rdfs:comment "Primary Teacher." .
OpenSABER:TeacherOtherTitle a OpenSABER:TeacherTitle ;
rdfs:label "TeacherOtherTitle" ;
rdfs:comment "Other." .
and we can now create a new property OpenSABER:teacherTitle
which can now range into any TeacherTitle
.
OpenSABER:teacherTitle a rdf:Property ;
rdfs:label "teacherTitle" ;
schema:domainIncludes OpenSABER:Teacher ;
schema:rangeIncludes OpenSABER:TeacherTitle ;
rdfs:comment "Title of a Teacher." .
Putting everything together...
@prefix OpenSABER: <http://OpenSABER.io/vocab/2018/01/> .
@prefix schema: <http://schema.org/> .
OpenSABER:Teacher a rdfs:Class ;
rdfs:label "Teacher" ;
schema:isPartOf <http://teacher.pending.OpenSABER.io> ;
rdfs:comment "A Teacher." ;
rdfs:subClassOf schema:Person .
OpenSABER:TeacherTitle a rdfs:Class ;
rdfs:label "TeacherTitle" ;
rdfs:comment "An enumeration of teacher titles." ;
rdfs:subClassOf schema:Enumeration .
OpenSABER:PGT a OpenSABER:TeacherTitle ;
rdfs:label "PGT" ;
rdfs:comment "Post Graduate Teacher." .
OpenSABER:TGT a OpenSABER:TeacherTitle ;
rdfs:label "TGT" ;
rdfs:comment "Trained Graduate Teacher." .
OpenSABER:PRT a OpenSABER:TeacherTitle ;
rdfs:label "PRT" ;
rdfs:comment "Primary Teacher." .
OpenSABER:TeacherOtherTitle a OpenSABER:TeacherTitle ;
rdfs:label "TeacherOtherTitle" ;
rdfs:comment "Other." .
OpenSABER:teacherTitle a rdf:Property ;
rdfs:label "teacherTitle" ;
schema:domainIncludes OpenSABER:Teacher ;
schema:rangeIncludes OpenSABER:TeacherTitle ;
rdfs:comment "Title of a Teacher." .
We didn't have to define the schema:name
property since it already defined by schema.org
.
Vocabularies are never complete but the first iteration of Teacher
and Core
vocabularies are at domains/. Go through the RDF files. RDF files are versioned, so if you make an edit in the RDF definitions, it is considered good practice to version the files.
Read the Installation Guide for deploying OpenSABER. After deploying
OpenSABER APIs can be used to perform CRUD operations on the various subjects of the same type. For instance, in a Teacher registry, the APIs are used to create, read, update or delete facts about a Teacher.
The following curl command is an example of creating a Teacher: