Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
pogi7 authored Mar 19, 2024
2 parents a3c38e1 + 621ddb5 commit 9c53e06
Show file tree
Hide file tree
Showing 25 changed files with 534 additions and 38 deletions.
52 changes: 52 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/debian
{
"name": "Kepler16b",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:bullseye",
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {
"version": "latest",
"enableNonRootDocker": "true",
"moby": "true"
},
"ghcr.io/devcontainers/features/java:1": {
"installGradle": true,
"version": "17",
"jdkDistro": "ms",
"gradleVersion": "latest",
"mavenVersion": "latest",
"antVersion": "latest",
"groovyVersion": "latest"
}
},

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
// Extensions below are for quality of life improvments
"eamodio.gitlens",
"esbenp.prettier-vscode",
"TabNine.tabnine-vscode",
"mhutchie.git-graph",
"wayou.vscode-todo-highlight",
"vscode-icons-team.vscode-icons",
"ms-azuretools.vscode-docker",
"firefox-devtools.vscode-firefox-debug",
// Extension below is for VSCode Gradle Plugin needed for OML Vision
"vscjava.vscode-gradle"
]
}
}


// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
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" ;
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-inf" ;
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" ] ;
.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot

version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
10 changes: 10 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Grab gitpod image
FROM gitpod/workspace-full

# Set the user as gitpod
USER gitpod

# Set the version to Java 17
RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && \
sdk install java 17.0.3-ms && \
sdk default java 17.0.3-ms"
15 changes: 12 additions & 3 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,17 @@

# Learn more from ready-to-use templates: https://www.gitpod.io/docs/introduction/getting-started/quickstart

# Docker image
image:
file: .gitpod.Dockerfile

# Tasks to run
tasks:
- init: sdk install java 17
- init: ./gradlew build

- init: ./gradlew owlLoad

# VSCode attributes
vscode:
extensions:
- https://github.com/microsoft/vscode-gradle/releases/download/3.12.7/vscjava.vscode-gradle-3.12.7.vsix
- https://github.com/opencaesar/oml-vision/releases/download/v0.2.0/oml-vision-v0.2.0.vsix
- https://github.com/opencaesar/oml-luxor/releases/download/2.4.0/oml-luxor-2.4.0.vsix
29 changes: 20 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,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 +119,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:"vision", dependsOn: owlReason) {
configurationPath = file('.fuseki.ttl')
outputFolderPath = file('.fuseki')
webUI = true
Expand All @@ -127,24 +129,33 @@ task startFuseki(type: io.opencaesar.owl.fuseki.StartFusekiTask, group:"oml") {
* Stop the headless Fuseki server
* @seeAlso https://github.com/opencaesar/owl-tools/blob/master/owl-fuseki/README.md
*/
task stopFuseki(type: io.opencaesar.owl.fuseki.StopFusekiTask, group:"oml") {
task stopFuseki(type: io.opencaesar.owl.fuseki.StopFusekiTask, group:"vision") {
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(startFuseki.outputFolderPath) // rerun when fuseki restarts
catalogPath = file('build/owl/catalog.xml')
endpointURL = "http://localhost:3030/$dataset".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, startFuseki]) {
inputs.files(startFuseki.outputFolderPath) // rerun when fuseki restarts
catalogPath = file('build/owl/catalog.xml')
endpointURL = "http://localhost:3030/$dataset".toString()
endpointURL = "http://localhost:3030/$dataset-inf".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 @@ -153,7 +164,7 @@ task owlLoad(type:io.opencaesar.owl.load.OwlLoadTask, group:"oml", dependsOn: [o
*/
task owlQuery(type:io.opencaesar.owl.query.OwlQueryTask, group:"oml", dependsOn: owlLoad) {
inputs.files(owlLoad.inputs.files) // rerun when the dataset changes
endpointURL = "http://localhost:3030/$dataset".toString()
endpointURL = "http://localhost:3030/$dataset-inf".toString()
queryPath = file('src/sparql')
resultPath = file('build/results')
format = 'json'
Expand Down
Binary file added oml-vision-v0.2.0.vsix
Binary file not shown.
10 changes: 5 additions & 5 deletions src/sparql/components.sparql
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ PREFIX base: <http://example.com/tutorial2/vocabulary/base#>
PREFIX mission: <http://example.com/tutorial2/vocabulary/mission#>
PREFIX vim4: <http://bipm.org/jcgm/vim4#>

SELECT DISTINCT ?c1_id ?c1_name ?c1_mass ?c2_id ?c2_name
SELECT DISTINCT ?iri ?c2Iri ?c1_id ?c1_name ?c1_mass ?c2_id ?c2_name
WHERE {
?c1 a mission:Component ;
?iri a mission:Component ;
base:hasIdentifier ?c1_id ;
base:hasCanonicalName ?c1_name .
OPTIONAL {
?c1 base:isContainedIn ?c2 .
?c2 base:hasIdentifier ?c2_id ;
?iri base:isContainedIn ?c2Iri .
?c2Iri base:hasIdentifier ?c2_id ;
base:hasCanonicalName ?c2_name .
}
OPTIONAL {
?c1_mass_mag vim4:characterizes ?c1 ;
?c1_mass_mag vim4:characterizes ?iri ;
vim4:hasDoubleNumber ?c1_mass .
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/sparql/update.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
PREFIX base: <http://example.com/tutorial2/vocabulary/base#>
PREFIX mission: <http://example.com/tutorial2/vocabulary/mission#>
PREFIX components: <http://example.com/tutorial2/description/components#>
PREFIX vim4: <http://bipm.org/jcgm/vim4#>

INSERT DATA {
components:test a mission:Component ;
base:hasIdentifier "testID" ;
base:hasCanonicalName "testName" ;
base:contains components:orbiter-launch-system .
}
5 changes: 5 additions & 0 deletions src/vision/config/sparqlConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"queryEndpoint": "http://localhost:3030/tutorial2-inf/sparql",
"updateEndpoint": "http://localhost:3030/tutorial2-inf/update",
"pingEndpoint": "http://localhost:3030/$/ping"
}
20 changes: 20 additions & 0 deletions src/vision/sparql/components.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
PREFIX base: <http://example.com/tutorial2/vocabulary/base#>
PREFIX mission: <http://example.com/tutorial2/vocabulary/mission#>
PREFIX vim4: <http://bipm.org/jcgm/vim4#>

SELECT DISTINCT ?iri ?c2Iri ?c1_id ?c1_name ?c1_mass ?c2_id ?c2_name
WHERE {
?iri a mission:Component ;
base:hasIdentifier ?c1_id ;
base:hasCanonicalName ?c1_name .
OPTIONAL {
?iri base:isContainedIn ?c2Iri .
?c2Iri base:hasIdentifier ?c2_id ;
base:hasCanonicalName ?c2_name .
}
OPTIONAL {
?c1_mass_mag vim4:characterizes ?iri ;
vim4:hasDoubleNumber ?c1_mass .
}
}
ORDER BY ?c1_id ?c2_id
12 changes: 12 additions & 0 deletions src/vision/sparql/connections.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
PREFIX base: <http://example.com/tutorial2/vocabulary/base#>
PREFIX mission: <http://example.com/tutorial2/vocabulary/mission#>

SELECT DISTINCT ?c1_name ?c2_name
WHERE {
?c1 a mission:Component ;
base:hasCanonicalName ?c1_name ;
mission:connectsTo [
base:hasCanonicalName ?c2_name
]
}
ORDER BY ?c1_name ?c2_name
13 changes: 13 additions & 0 deletions src/vision/sparql/general-properties.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX base: <http://example.com/tutorial2/vocabulary/base#>

select distinct ?anyIri ?id ?name
WHERE {
BIND(<${iri}> AS ?anyIri)
?anyIri a owl:NamedIndividual ;
base:hasIdentifier ?id ;
base:hasCanonicalName ?name .
}
23 changes: 23 additions & 0 deletions src/vision/sparql/missions-diagram.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
PREFIX base: <http://example.com/tutorial2/vocabulary/base#>
PREFIX mission: <http://example.com/tutorial2/vocabulary/mission#>

SELECT DISTINCT ?m_id ?m_name
WHERE {
?m a mission:Mission ;
base:hasIdentifier ?m_id ;
base:hasCanonicalName ?m_name ;
}
ORDER BY ?m_id

# PREFIX oml: <http://opencaesar.io/oml#>
# PREFIX dc: <http://purl.org/dc/elements/1.1#>
# PREFIX base: <http://example.com/tutorial2/vocabulary/base#>
# PREFIX mission: <http://example.com/tutorial2/vocabulary/mission#>

# CONSTRUCT {
# ?mission dc:type oml:Concept ;
# mission:pursues ?objective .
# }
# WHERE {
# ?mission mission:pursues ?objective ;
# }
10 changes: 10 additions & 0 deletions src/vision/sparql/missions.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
PREFIX base: <http://example.com/tutorial2/vocabulary/base#>
PREFIX mission: <http://example.com/tutorial2/vocabulary/mission#>

SELECT DISTINCT ?iri ?m_id ?m_name
WHERE {
?iri a mission:Mission ;
base:hasIdentifier ?m_id ;
base:hasCanonicalName ?m_name ;
}
ORDER BY ?m_id ?o_id
15 changes: 15 additions & 0 deletions src/vision/sparql/objectives-edge.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
PREFIX base: <http://example.com/tutorial2/vocabulary/base#>
PREFIX mission: <http://example.com/tutorial2/vocabulary/mission#>

SELECT DISTINCT ?m_id ?m_name ?o_id ?o_name
WHERE {
?m a mission:Mission ;
base:hasIdentifier ?m_id ;
base:hasCanonicalName ?m_name ;
mission:pursues [
a mission:Objective ;
base:hasIdentifier ?o_id ;
base:hasCanonicalName ?o_name
]
}
ORDER BY ?o_id
14 changes: 14 additions & 0 deletions src/vision/sparql/objectives.sparql
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
PREFIX base: <http://example.com/tutorial2/vocabulary/base#>
PREFIX mission: <http://example.com/tutorial2/vocabulary/mission#>

SELECT DISTINCT ?iri ?o1_id ?o1_name ?o2_id ?o2_name
WHERE {
?iri a mission:Objective ;
base:hasIdentifier ?o1_id ;
base:hasCanonicalName ?o1_name ;
base:aggregates [
base:hasIdentifier ?o2_id ;
base:hasCanonicalName ?o2_name
]
}
ORDER BY ?o1_id ?o2_id
Loading

0 comments on commit 9c53e06

Please sign in to comment.