@dennwc and @robertmeta,
I took a whack at a set of requirements for schema manipulation for this new high-level library. I’m trying to keep the library as small as possible while also accommodating the majority (90%+) of use cases for creating an RDF graph in Cayley. I have left the data manipulation and implementation sections blank for now…since it seems like the schema manipulation requirements are a precursor to those. Please let me know what feedback you may have so far.
@dennwc, I decided not to create a special concept for “relation” since those can be handled by the rdf:range property. As previously defined, a “relation” will have an rdf:range that is a class, while a “property” will have an rdf:range that is a literal. Also, Re: cardinality… instead of introducing the concepts “oneToOne” and “oneToMany” for now, I just included owl:minCardinality and owl:maxCardinality. These two are enough to describe whether a property is nullable (minCardinality = 0) and whether a property is one-to-one or one-to-many. It has the added benefit of allowing more than one occurrence of a property, but putting an upper limit on it rather than stating simply that it is “one-to-many”.
High level cayley schema library
Provide a minimal, high level Go library for creating, modifying, and accessing RDF graphs in Cayley.
- Create and modify RDF classes (rdfs:class). ALL Classes have properties:
rdfs:label - a human-readable version of the class’ name
rdfs:comment - a human-readable description of the class
- Create and modify properties (rdf:property), which can in turn be associated with classes. These are properties other than rdfs:label and rdfs:comment, which are automatically associated with all classes. Properties have properties:
rdfs:domain - equals the class (rdf:type) with which the property is being associated. The domain is the set of rdf:type which can act as the subject in a statement (rdf:statement) for which the property acts as a predicate.
rdf:range - equals the classes (rdf:type), or in the event the range is of type rdf:literal, the data types (rdfs:datatype) which can act as the object in a statement for which the property acts as a predicate.
rdfs:label - a human-readable version of the property’s name
rdfs:comment - a human-readable description of the property
owl:maxCardinality - the maximum number of times the property can be used for a given subject. NOTE: may be mapped to from more user friendly attribute.
owl:minCardinality - describes the minimum number of times the property can be used for a given subject. NOTE: may be mapped to from more user friendly attribute.
Create and Modify Class Instances (Entities)
- Provide “create”, “update”, and “create or update” functions
- Decision point: allow user specification of IRIs, or automatically assign a UUID and allow the user to specify only the rdfs:label and rdfs:comment of the entity?
Set and Modify Entity Property Values
- For properties with literal ranges, the user will pass a literal to the set prop function.
- For properties with class ranges, the user will pass an IRI to the set prop function.
Note1: These high level query function should provide a set of methods that allow retrieving data without using Gizmo or GraphQL. In this way, these methods are a complement to existing Cayley query functionality and simply provide high-level wrappers
Note2: Minimal requirement for query results is to return JSON. More discussion is needed to lay out exactly how queries using this high-level library will output results that can be output as go structs and used with the ORM library.
Return complete list of classes defined in the schema
- Will include class rdfs:label and class rdfs:comment
- Will include only the IRI and rdfs:label value for each property associated with the class
Return a complete list of properties defined in the schema
- Will include all of the property’s properties (not only rdfs:label)
Return a complete list of all instances of a given class.
- To reduce data size of the result set, only IRI, label, and comment of each class will be returned.
Given an IRI, return a class instance
- Include all class properties
- Include all properties of properties up to a user-specified max level. At the last level, literal property values will be included in the result, and for non-literal property values, the IRI will be included in the result.
(To be drafted)
- 0.1 - Dec 31, 2016
- 0.2 - Jan 3, 2017