summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Thursfield <sam.thursfield@codethink.co.uk>2015-07-02 13:01:46 +0100
committerSam Thursfield <sam.thursfield@codethink.co.uk>2015-07-02 13:02:16 +0100
commit8a6de708145bf6f2416a11a562be482a1b5a7b19 (patch)
treea63050507a383a4ef1ecadff27ba4f8dcbc56202
parentaf67bdb649c052edb2294945d0b81135d384fcf7 (diff)
downloaddefinitions-8a6de708145bf6f2416a11a562be482a1b5a7b19.tar.gz
schema: Add comments to lots of entities
Also, remove the unused 'hasName' property. The URL includes the name anyway so this isn't needed. Change-Id: Ic0f872c48780fc2f52fdd6e8773984dcb3c149df
-rw-r--r--schema/baserock-owl-schema.turtle77
-rw-r--r--schema/browser/main.py1
-rw-r--r--schema/surf-test.py21
3 files changed, 60 insertions, 39 deletions
diff --git a/schema/baserock-owl-schema.turtle b/schema/baserock-owl-schema.turtle
index 20d473d8..f4dadb61 100644
--- a/schema/baserock-owl-schema.turtle
+++ b/schema/baserock-owl-schema.turtle
@@ -44,44 +44,53 @@
# Source definitions
-:Morphology a owl:Class .
+:Morphology a owl:Class ;
+ rdfs:comment "A definition file." .
:Cluster a owl:Class ;
- rdfs:subClassOf :Morphology .
+ rdfs:subClassOf :Morphology ;
+ rdfs:comment "Instructions for deploying one or systems." .
:System a owl:Class ;
- rdfs:subClassOf :Morphology .
+ rdfs:subClassOf :Morphology ;
+ rdfs:comment "A collection of strata in a form that can be executed." .
:Stratum a owl:Class ;
- rdfs:subClassOf :Morphology .
+ rdfs:subClassOf :Morphology ;
+ rdfs:comment "A set of related chunks." .
:Chunk a owl:Class ;
- rdfs:subClassOf :morphology .
+ rdfs:subClassOf :Morphology ;
+ rdfs:comment "An individual component, that can be built from a Git repository." .
# Container contents
-:SystemDeployment a owl:Class .
+:SystemDeployment a owl:Class ;
+ rdfs:comment "Information for deploying one system of a cluster." .
-:ChunkReference a owl:Class .
+:ChunkReference a owl:Class ;
+ rdfs:comment "An instance of a chunk within a stratum." .
# Products (for artifact split rules).
-:Artifact a owl:Class .
+:Artifact a owl:Class ;
+ rdfs:comment "One part of the result of building a morphology. The output of a build is split according to patterns, so there are multiple artifacts produced for a given source." .
:StratumArtifact a owl:Class ;
- rdfs:subClassOf :Artifact .
+ rdfs:subClassOf :Artifact ;
+ rdfs:comment "Part of the result of building a stratum." .
:ChunkArtifact a owl:Class ;
- rdfs:subClassOf :Artifact .
+ rdfs:subClassOf :Artifact ;
+ rdfs:comment "Part of the result of building a chunk." .
## Shared properties
-:hasName a owl:DatatypeProperty , owl:FunctionalProperty ;
- rdfs:domain :Morphology ;
- rdfs:range xsd:string .
+# 'name' is converted to a URL at load time.
-# use dc:description for description, see: http://dublincore.org/documents/2012/06/14/dcmi-terms/?v=terms#terms-description
+# use dc:description for 'description', see:
+# http://dublincore.org/documents/2012/06/14/dcmi-terms/?v=terms#terms-description
## Cluster-specific properties
@@ -104,16 +113,19 @@
:hasType a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain :SystemDeployment ;
- rdfs:range xsd:string .
+ rdfs:range xsd:string ;
+ rdfs:comment "The .write extension used to perform the deployment." .
:hasLocation a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain :SystemDeployment ;
- rdfs:range xsd:string .
+ rdfs:range xsd:string ;
+ rdfs:comment "Deployment location. This is passed to the selected .write extension" .
-# FIXME: this is actually a key-value mapping, how do you do that?
+# FIXME: this is actually a key-value mapping, how do you do that in RDF properly?
:hasConfigurationSetting a owl:DatatypeProperty ;
rdfs:domain :SystemDeployment ;
- rdfs:range xsd:string .
+ rdfs:range xsd:string ;
+ rdfs:comment "Arbitrary key=value pair that is set in the environment of the .configure and .write extensions during deployment." .
## System-specific properties
@@ -123,20 +135,24 @@
rdfs:range :StratumArtifact ;
owl:minCardinality 1 .
+# A build tool will only understand a certain set of architectures, but I think
+# that should not be part of the data model.
:hasArchitecture a owl:DatatypeProperty, owl:FunctionalProperty ;
rdfs:domain :System ;
rdfs:range xsd:string .
:hasConfigurationExtension a owl:DatatypeProperty ;
rdfs:domain :System ;
- rdfs:range xsd:string .
+ rdfs:range xsd:string ;
+ rdfs:comment "A .configure extension to be run when with system is deployed." .
## Stratum-specific properties
:produces a owl:ObjectProperty , rdf:Seq ;
rdfs:domain :Stratum ;
- rdfs:range :StratumArtifact .
+ rdfs:range :StratumArtifact ;
+ rdfs:comment "Describes how this artifact is split once all chunks are built." .
:hasStratumBuildDependency a owl:ObjectProperty ;
rdfs:domain :Stratum ;
@@ -156,15 +172,18 @@
:repo a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain :ChunkReference ;
- rdfs:range xsd:string .
+ rdfs:range xsd:string ;
+ rdfs:comment "Git repo that this chunk's build instructions should be run in. Can be a keyed URL according to the repo-alias mapping, which isn't currently defined in this data model." .
:ref a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain :ChunkReference ;
- rdfs:range xsd:string .
+ rdfs:range xsd:string ;
+ rdfs:comment "Ref of the Git repo that should be checked out before building. Usually a SHA1." .
:unpetrifyRef a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain :ChunkReference ;
- rdfs:range xsd:string .
+ rdfs:range xsd:string ;
+ rdfs:comment "Name of the ref that should be checked out (useful when 'ref' is a SHA1 to keep track of the actual branch/tag name)." .
:hasChunkBuildDependency a owl:ObjectProperty ;
rdfs:domain :ChunkReference ;
@@ -172,9 +191,11 @@
:prefix a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain :ChunkReference ;
- rdfs:range xsd:string .
+ rdfs:range xsd:string ;
+ rdfs:comment "Value of the PREFIX environment variable in the build environment (defaults to /usr)" .
-# FIXME: actually only 'bootstrap' and 'normal' are valid values.
+# FIXME: it's possible to specify in OWL that 'bootstrap' and 'normal' are the
+# only valid values.
:buildMode a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain :ChunkReference ;
rdfs:range xsd:string .
@@ -191,7 +212,8 @@
:produces a owl:ObjectProperty , rdf:Seq ;
rdfs:domain :Chunk ;
- rdfs:range :ChunkArtifact .
+ rdfs:range :ChunkArtifact ;
+ rdfs:comment "Describes how this artifact is split once built." .
:preConfigureCommands a owl:DatatypeProperty , rdf:Seq ;
rdfs:domain :Chunk ;
@@ -234,4 +256,5 @@
:includes a owl:DatatypeProperty, rdf:Seq ;
rdfs:domain :Artifact ;
- rdfs:range xsd:string .
+ rdfs:range xsd:string ;
+ rdfs:comment "A regular expression pattern. The results of a build are matched against this pattern and any that match will be included in that artifact." .
diff --git a/schema/browser/main.py b/schema/browser/main.py
index e977cd76..06fc7b73 100644
--- a/schema/browser/main.py
+++ b/schema/browser/main.py
@@ -7,6 +7,7 @@ import os
definitions = rdflib.Graph()
definitions.parse('definitions.rdfxml')
+definitions.parse('../baserock-owl-schema.turtle', format='turtle')
#app = flask.Flask('Example Baserock definitions browser')
#app.config['graph'] = definitions
diff --git a/schema/surf-test.py b/schema/surf-test.py
index 6e60bfe5..a17ca82d 100644
--- a/schema/surf-test.py
+++ b/schema/surf-test.py
@@ -50,14 +50,11 @@ schema.parse("baserock-owl-schema.turtle", format="turtle")
# Only works for 'memory' database, but I don't really care any more.
all_data = store.reader.graph
-validate.check_data_against_schema(
- data=all_data,
- schema=schema)
-
-
-def serialize_to_json_ld(surflib_resource):
- rdflib_graph = surflib_resource.graph()
+#validate.check_data_against_schema(
+# data=all_data,
+# schema=schema)
+def serialize_to_json_ld(rdflib_graph):
context = {
"@vocab": "http://baserock.org/definitions/example-schema#",
"@language": "en"
@@ -66,9 +63,9 @@ def serialize_to_json_ld(surflib_resource):
return rdflib_graph.serialize(format='json-ld', indent=4, context=context)
-Cluster = session.get_class(surf.ns.BASEROCK.Cluster)
-cluster = Cluster.all()
-for s in cluster:
- s.load()
- print serialize_to_json_ld(s)
+#Cluster = session.get_class(surf.ns.BASEROCK.Cluster)
+#cluster = Cluster.all()
+#for s in cluster:
+# s.load()
+# print serialize_to_json_ld(s.graph())