# Copyright (C) 2015 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see .
# This schema describes the Baserock data model. It describes how the data
# can be represented in computer memory, it doesn't specify anything about
# how it should be stored on disk or transferred.
#
# Please see README.schemas, and http://wiki.baserock.org/definitions/current/
# for more information.
#
# This is not a brilliant schema, in Linked Data terms, because it's using
# Baserock-specific terminology and a rigid layout, instead of being a generic
# vocabulary for describing how to assemble software. However, it maps closely
# to the format that the existing Baserock reference system definitions use.
# We hope to produce a simpler and more flexible 2.x version of this schema in
# future.
# Partial OWL and RDF Schema glossary:
#
# domain: the set of objects that a can have a property.
# range: the set of possible values for a property.
#
# ObjectProperty:
# a property whose value must be another resource.
# DatatypeProperty:
# a property whose value is one of the datatype defined by XML Schema ("xsd")
# FunctionalProperty:
# a property which can only have one value per resource
# InverseFunctionalProperty:
# a property which can only have one resource per value
# Metadata
@prefix : .
@prefix owl: .
@prefix rdfs: .
@prefix rdf: .
@prefix xsd: .
@prefix dc: .
: a owl:Ontology ;
dc:title "Schema for Baserock data model" ;
dc:creator "The Baserock Project" ;
# Versioned according to Semantic Versioning http://www.semver.org/
owl:versionInfo "0.9.0" .
## Entities
# Source definitions
:Morphology a owl:Class ;
rdfs:comment "A definition file." .
:Cluster a owl:Class ;
rdfs:subClassOf :Morphology ;
rdfs:comment "Instructions for deploying one or systems." ;
owl:disjointWith :System, :Stratum, :Chunk .
:System a owl:Class ;
rdfs:subClassOf :Morphology ;
rdfs:comment "A collection of strata in a form that can be executed." ;
owl:disjointWith :Cluster, :Stratum, :Chunk .
:Stratum a owl:Class ;
rdfs:subClassOf :Morphology ;
rdfs:comment "A set of related chunks." ;
owl:disjointWith :Cluster, :System, :Chunk .
:Chunk a owl:Class ;
rdfs:subClassOf :Morphology ;
rdfs:comment "An individual component, that can be built from a Git repository." ;
owl:disjointWith :Cluster, :System, :Stratum .
# Container contents
:SystemDeployment a owl:Class ;
rdfs:comment "Information for deploying one system of a cluster." .
:ChunkReference a owl:Class ;
rdfs:comment "An instance of a chunk within a stratum." .
# Products (for artifact split rules).
: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:comment "Part of the result of building a stratum." ;
owl:disjointWith :ChunkArtifact.
:ChunkArtifact a owl:Class ;
rdfs:subClassOf :Artifact ;
rdfs:comment "Part of the result of building a chunk." ;
owl:disjointWith :StratumArtifact.
## Shared properties
# 'name' becomes part of the URL when we import definition .morph files as RDF,
# so it doesn't need a property.
# Use dc:description for 'description', see:
# http://dublincore.org/documents/2012/06/14/dcmi-terms/?v=terms#terms-description
## Cluster-specific properties
:containsSystemDeployment a owl:ObjectProperty ;
rdfs:domain :Cluster ;
rdfs:range :SystemDeployment ;
owl:minCardinality 1 .
## SystemDeployment-specific properties
:deploysSystem a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :SystemDeployment ;
rdfs:range :System .
:hasLabel a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain :SystemDeployment ;
rdfs:range xsd:string .
:hasType a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain :SystemDeployment ;
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:comment "Deployment location. This is passed to the selected .write extension" .
# 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:comment "Arbitrary key=value pair that is set in the environment of the .configure and .write extensions during deployment." .
## System-specific properties
:containsStratumArtifact a owl:ObjectProperty ;
rdfs:domain :System ;
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:comment "A .configure extension to be run when with system is deployed." .
## Stratum-specific properties
:producesStratumArtifact a owl:ObjectProperty , rdf:Seq ;
rdfs:domain :Stratum ;
rdfs:range :StratumArtifact ;
rdfs:comment "iDescribes how this artifact is split once all chunks are built." .
:hasStratumBuildDependency a owl:ObjectProperty ;
rdfs:domain :Stratum ;
rdfs:range :Stratum .
:containsChunkReference a owl:ObjectProperty ;
rdfs:domain :Stratum ;
rdfs:range :ChunkReference ;
owl:minCardinality 1 .
## ChunkReference-specific properties
:refersToChunk a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :ChunkReference ;
rdfs:range :Chunk .
:repo a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain :ChunkReference ;
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: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: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 ;
rdfs:range :Chunk .
:prefix a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain :ChunkReference ;
rdfs:range xsd:string ;
rdfs:comment "Value of the PREFIX environment variable in the build environment (defaults to /usr)" .
# 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 .
## Chunk-specific properties
# build-system isn't included here, as it overlaps with the *-commands
# fields in an unfortunate way.
# Note that representing lists of things in RDF is a bit of a pain.
# http://smiy.sourceforge.net/olo/spec/orderedlistontology.html might
# be worth investigating.
:producesChunkArtifact a owl:ObjectProperty , rdf:Seq ;
rdfs:domain :Chunk ;
rdfs:range :ChunkArtifact ;
rdfs:comment "Describes how this artifact is split once built." .
:maxJobs a owl:FunctionalProperty ;
rdfs:domain :Chunk ;
rdfs:range xsd:integer ;
rdfs:comment "Number of parallel jobs that can be run for this chunk. Only useful if set to 1, to mark components which have Makefiles that do not work with `make -j N`."
:CommandSequence a owl:Class ;
rdfs:subClassOf rdf:Seq ;
rdfs:comment "An ordered sequence of commands." .
:preConfigureCommands a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :Chunk ;
rdfs:range :CommandSequence .
:configureCommands a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :Chunk ;
rdfs:range :CommandSequence .
:postConfigureCommands a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :Chunk ;
rdfs:range :CommandSequence .
:preBuildCommands a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :Chunk ;
rdfs:range :CommandSequence .
:buildCommands a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :Chunk ;
rdfs:range :CommandSequence .
:postBuildCommands a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :Chunk ;
rdfs:range :CommandSequence .
:preInstallCommands a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :Chunk ;
rdfs:range :CommandSequence .
:installCommands a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :Chunk ;
rdfs:range :CommandSequence .
:postInstallCommands a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain :Chunk ;
rdfs:range :CommandSequence .
# Artifact properties
:includes a owl:DatatypeProperty , rdf:Seq ;
rdfs:domain :Artifact ;
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." .