Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 43 additions & 21 deletions .fuseki.ttl
Original file line number Diff line number Diff line change
@@ -1,24 +1,46 @@
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix : <#> .
PREFIX : <#>
PREFIX fuseki: <http://jena.apache.org/fuseki#>
PREFIX ja: <http://jena.hpl.hp.com/2005/11/Assembler#>
PREFIX tdb: <http://jena.hpl.hp.com/2008/tdb#>

[] rdf:type fuseki:Server .
# Service 1: Assertions endpoint
:service1 a fuseki:Service ;
fuseki:name "tutorial2-tdb" ;
fuseki:dataset :assertions ;
fuseki:serviceQuery "" , "query", "sparql" ;
fuseki:serviceUpdate "" , "update" ;
fuseki:serviceReadWriteGraphStore "data" ;
.

<#service> rdf:type fuseki:Service ;
rdfs:label "Tutorial2" ; # Human readable label for dataset
fuseki:name "tutorial2" ; # Name of the dataset in the endpoint url
fuseki:serviceReadWriteGraphStore "data" ; # SPARQL Graph store protocol (read and write)
fuseki:endpoint [ fuseki:operation fuseki:query ; fuseki:name "sparql" ] ; # SPARQL query service
fuseki:endpoint [ fuseki:operation fuseki:shacl ; fuseki:name "shacl" ] ; # SHACL query service
fuseki:dataset <#dataset> .
# Service 2: Inference endpoint
:service2 a fuseki:Service ;
fuseki:name "tutorial2" ;
fuseki:dataset :inferences ;
fuseki:serviceQuery "" , "query", "sparql" ;
fuseki:serviceUpdate "" , "update" ;
fuseki:serviceReadWriteGraphStore "data" ;
fuseki:serviceReadGraphStore "get" ;
.

:inferences a ja:RDFDataset ;
ja:defaultGraph :inf_model ;
.

## In memory TDB with union graph.
<#dataset> rdf:type tdb:DatasetTDB ;
tdb:location "--mem--" ;
# Query timeout on this dataset (1s, 1000 milliseconds)
ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "1000" ] ;
# Make the default graph be the union of all named graphs.
tdb:unionDefaultGraph true .
:inf_model a ja:InfModel ;
ja:baseModel :baseModel ;
ja:reasoner [
ja:reasonerURL <http://jena.hpl.hp.com/2003/GenericRuleReasoner> ;
ja:rulesFrom <build/owl/example.com/tutorial2/vocabulary/bundle.rules> ;
]
.

:baseModel a tdb:GraphTDB ;
tdb:graphName <urn:x-arq:DefaultGraph> ;
tdb:dataset :assertions ;
.

:assertions a tdb:DatasetTDB ;
# location is relative to the .fuseki folder
tdb:location "assertions" ;
tdb:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "1000" ] ;
.
13 changes: 7 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ This is an example OML project for a hypothetical mission called Kepler 16b. For
./gradlew stopFuseki
```

## Load to Fuseki Dataset
## Load Dataset to Fuseki
```
./gradlew owlLoad
./gradlew load
```

Pre-req: A Fuseki server with a firesat dataset must be running at http://localhost:3030/firesat (see Start Fuseki above)
## Save Dataset from Fuseki
```
./gradlew save
```

## Run SPARQL Queries
```
./gradlew owlQuery
./gradlew query
```

Pre-req: A Fuseki server with a firesat dataset must be running at http://localhost:3030/firesat (see Load to Fuseki Dataset)
67 changes: 59 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ buildscript {
classpath 'io.opencaesar.owl:owl-fuseki-gradle:+'
classpath 'io.opencaesar.owl:owl-query-gradle:+'
classpath 'io.opencaesar.owl:owl-load-gradle:+'
classpath 'io.opencaesar.owl:owl-save-gradle:+'
classpath 'io.opencaesar.owl:owl-reason-gradle:+'
classpath 'io.opencaesar.oml:oml-merge-gradle:+'
classpath 'io.opencaesar.adapters:oml2owl-gradle:+'
classpath 'io.opencaesar.adapters:owl2oml-gradle:+'
}
}

Expand Down Expand Up @@ -74,6 +76,8 @@ task omlToOwl(type:io.opencaesar.oml2owl.Oml2OwlTask, group:"oml", dependsOn: do
inputCatalogPath = file('catalog.xml')
// OWL catalog
outputCatalogPath = file('build/owl/catalog.xml')
// Generate rules
generateRules = true
}

/*
Expand Down Expand Up @@ -117,7 +121,7 @@ task generateDocs(type: io.opencaesar.owl.doc.OwlDocTask, dependsOn: owlReason)
* Start the headless Fuseki server
* @seeAlso https://github.com/opencaesar/owl-tools/blob/master/owl-doc/README.md
*/
task startFuseki(type: io.opencaesar.owl.fuseki.StartFusekiTask, group:"oml") {
task startFuseki(type: io.opencaesar.owl.fuseki.StartFusekiTask, group:"oml", dependsOn: owlReason) {
configurationPath = file('.fuseki.ttl')
outputFolderPath = file('.fuseki')
webUI = true
Expand All @@ -131,20 +135,29 @@ task stopFuseki(type: io.opencaesar.owl.fuseki.StopFusekiTask, group:"oml") {
outputFolderPath = file('.fuseki')
}

/*
* A task to load an OWL catalog to a TDB-persisted Fuseki dataset endpoint
* @seeAlso https://github.com/opencaesar/owl-tools/blob/master/owl-load/README.md
*/
task owlLoadTdb(type:io.opencaesar.owl.load.OwlLoadTask, group:"oml", dependsOn: startFuseki) {
inputs.files(file('.fuseki/fuseki.pid')) // rerun when fuseki restarts
catalogPath = file('build/owl/catalog.xml')
endpointURL = "http://localhost:3030/$dataset-tdb".toString()
fileExtensions = ['owl', 'ttl']
iris = ["$rootIri".toString()]
}

/*
* A task to load an OWL catalog to a Fuseki dataset endpoint
* @seeAlso https://github.com/opencaesar/owl-tools/blob/master/owl-load/README.md
*/
task owlLoad(type:io.opencaesar.owl.load.OwlLoadTask, group:"oml", dependsOn: owlReason) {
inputs.files(startFuseki.outputFolderPath) // rerun when fuseki restarts
task owlLoad(type:io.opencaesar.owl.load.OwlLoadTask, group:"oml", dependsOn: owlLoadTdb) {
inputs.files(file('.fuseki/fuseki.pid')) // rerun when fuseki restarts
catalogPath = file('build/owl/catalog.xml')
endpointURL = "http://localhost:3030/$dataset".toString()
fileExtensions = ['owl', 'ttl']
iris = [
"$rootIri/classes".toString(),
"$rootIri/properties".toString(),
"$rootIri/individuals".toString()
]
iris = ["$rootIri/classes".toString(), "$rootIri/properties".toString()]
loadToDefaultGraph = true
}

/*
Expand All @@ -159,6 +172,44 @@ task owlQuery(type:io.opencaesar.owl.query.OwlQueryTask, group:"oml", dependsOn:
format = 'json'
}

/*
* A task to save a Fuseki dataset endpoint to an OWL catalog
* @seeAlso https://github.com/opencaesar/owl-tools/blob/master/owl-save/README.md
*/
task owlSave(type:io.opencaesar.owl.save.OwlSaveTask, group:"oml") {
inputs.files(startFuseki.outputFolderPath) // rerun when fuseki restarts
endpointURL = "http://localhost:3030/$dataset-tdb".toString()
catalogPath = file('build/save/catalog.xml')
fileExtension = 'ttl'
}

/*
* A task to convert the OWL catalog to OML catalog
* @seeAlso https://github.com/opencaesar/owl-adapter/blob/master/owl2oml/README.md
*/
task owlToOml(type:io.opencaesar.owl2oml.Owl2OmlTask, dependsOn: [downloadDependencies, owlSave]) {
inputCatalogPath = owlSave.catalogPath
outputCatalogPath = file('catalog.xml')
doNotUpdatePaths = [ file('build/oml'), file('src/oml/example.com/tutorial2/vocabulary') ]
inputFileExtensions = ['ttl']
outputFileExtension = 'oml'
}

/*
* A task to load the OML dataset to Fuseki
*/
task load (dependsOn: owlLoad)

/*
* A task to save the OML dataset from Fuseki
*/
task save (dependsOn: owlToOml)

/*
* A task to query the OML dataset in Fuseki
*/
task query (dependsOn: owlQuery)

/*
* A task to check the project's build artifacts
* @seeAlso https://docs.gradle.org/current/userguide/base_plugin.html
Expand Down
19 changes: 13 additions & 6 deletions src/oml/example.com/tutorial2/description/bundle.oml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
description bundle <http://example.com/tutorial2/description/bundle#> as ^bundle {

uses <http://example.com/tutorial2/vocabulary/bundle#>
includes <http://example.com/tutorial2/description/objectives#>
includes <http://example.com/tutorial2/description/missions#>

includes <http://example.com/tutorial2/description/components#>
includes <http://example.com/tutorial2/description/masses#>

includes <http://example.com/tutorial2/description/interfaces#>
includes <http://example.com/tutorial2/description/requirements#>

includes <http://example.com/tutorial2/description/junctions#>

includes <http://example.com/tutorial2/description/masses#>

includes <http://example.com/tutorial2/description/missions#>

includes <http://example.com/tutorial2/description/objectives#>

includes <http://example.com/tutorial2/description/requirements#>

uses <http://example.com/tutorial2/vocabulary/bundle#>
}
120 changes: 67 additions & 53 deletions src/oml/example.com/tutorial2/description/components.oml
Original file line number Diff line number Diff line change
@@ -1,81 +1,95 @@
description <http://example.com/tutorial2/description/components#> as components {

uses <http://example.com/tutorial2/vocabulary/base#> as base

uses <http://example.com/tutorial2/vocabulary/mission#> as mission

instance orbiter-launch-system : mission:Component [
base:hasIdentifier "C.01"
base:hasCanonicalName "Orbiter Launch System"
]
instance orbiter-spacecraft : mission:Component [
base:hasIdentifier "C.02"
base:hasCanonicalName "Orbiter Spacecraft"
instance lander-ground-data-system : mission:Component [
base:hasCanonicalName "Lander Ground Data System"
base:hasIdentifier "C.07"
]
instance orbiter-power-subsystem : mission:Component [
base:hasIdentifier "C.02.01"
base:hasCanonicalName "Orbiter Power Subsystem"

instance lander-launch-system : mission:Component [
base:hasCanonicalName "Lander Launch System"
base:hasIdentifier "C.05"
]
instance orbiter-harness : mission:Component [
base:hasIdentifier "C.02.02"
base:hasCanonicalName "Orbiter Harness"

instance lander-spacecraft : mission:Component [
base:hasCanonicalName "Lander Spacecraft"
base:hasIdentifier "C.06"
]
instance orbiter-thermal-subsystem : mission:Component [
base:hasIdentifier "C.02.03"
base:hasCanonicalName "Orbiter Thermal Subsystem"

instance mission-operations-system : mission:Component [
base:hasCanonicalName "Mission Operations System"
base:hasIdentifier "C.04"
]

instance orbiter-command-and-data-handling-subsystem : mission:Component [
base:hasIdentifier "C.02.04"
base:hasCanonicalName "Orbiter C&DH Subsystem"
base:hasIdentifier "C.02.04"
]
instance orbiter-telecom-subsystem : mission:Component [
base:hasIdentifier "C.02.05"
base:hasCanonicalName "Orbiter Telecom Subsystem"

instance orbiter-ground-data-system : mission:Component [
base:hasCanonicalName "Orbiter Ground Data System"
base:hasIdentifier "C.03"
]

instance orbiter-guidance-navigation-control-subsystem : mission:Component [
base:hasIdentifier "C.02.06"
base:hasCanonicalName "Orbiter GN&C Subsystem"
base:hasIdentifier "C.02.06"
]

instance orbiter-harness : mission:Component [
base:hasCanonicalName "Orbiter Harness"
base:hasIdentifier "C.02.02"
]

instance orbiter-launch-system : mission:Component [
base:hasCanonicalName "Orbiter Launch System"
base:hasIdentifier "C.01"
]

instance orbiter-mechanical-subsystem : mission:Component [
base:hasIdentifier "C.02.07"
base:hasCanonicalName "Orbiter Mechanical Subsystem"
base:hasIdentifier "C.02.07"
]
instance orbiter-spacraft-flight-software : mission:Component [
base:hasIdentifier "C.02.08"
base:hasCanonicalName "Orbiter Flight Software"

instance orbiter-power-subsystem : mission:Component [
base:hasCanonicalName "Orbiter Power Subsystem"
base:hasIdentifier "C.02.01"
]

instance orbiter-propulsion-subsystem : mission:Component [
base:hasIdentifier "C.02.09"
base:hasCanonicalName "Orbiter Propulsion Subsystem"
base:hasIdentifier "C.02.09"
]
instance orbiter-ground-data-system : mission:Component [
base:hasIdentifier "C.03"
base:hasCanonicalName "Orbiter Ground Data System"
]
instance mission-operations-system : mission:Component [
base:hasIdentifier "C.04"
base:hasCanonicalName "Mission Operations System"
]
instance lander-launch-system : mission:Component [
base:hasIdentifier "C.05"
base:hasCanonicalName "Lander Launch System"
]
instance lander-spacecraft : mission:Component [
base:hasIdentifier "C.06"
base:hasCanonicalName "Lander Spacecraft"
]
instance lander-ground-data-system : mission:Component [
base:hasIdentifier "C.07"
base:hasCanonicalName "Lander Ground Data System"
]
ref instance orbiter-spacecraft [
base:contains orbiter-power-subsystem
base:contains orbiter-harness
base:contains orbiter-thermal-subsystem

instance orbiter-spacecraft : mission:Component [
base:contains orbiter-command-and-data-handling-subsystem
base:contains orbiter-telecom-subsystem
base:contains orbiter-guidance-navigation-control-subsystem
base:contains orbiter-harness
base:contains orbiter-mechanical-subsystem
base:contains orbiter-spacraft-flight-software
base:contains orbiter-power-subsystem
base:contains orbiter-propulsion-subsystem
base:contains orbiter-spacraft-flight-software
base:contains orbiter-telecom-subsystem
base:contains orbiter-thermal-subsystem
base:hasCanonicalName "Orbiter Spacecraft"
base:hasIdentifier "C.02"
]

instance orbiter-spacraft-flight-software : mission:Component [
base:hasCanonicalName "Orbiter Flight Software"
base:hasIdentifier "C.02.08"
]

instance orbiter-telecom-subsystem : mission:Component [
base:hasCanonicalName "Orbiter Telecom Subsystem"
base:hasIdentifier "C.02.05"
]

instance orbiter-thermal-subsystem : mission:Component [
base:hasCanonicalName "Orbiter Thermal Subsystem"
base:hasIdentifier "C.02.03"
]
}
}
Loading