Skip to content

Commit 00d3a1b

Browse files
authored
Merge pull request #735 from TNO/line-endings
Line endings
2 parents 679535c + 6fbd376 commit 00d3a1b

30 files changed

Lines changed: 3646 additions & 3659 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,45 @@
1-
name: Docker Image CI
2-
3-
on:
4-
push:
5-
branches: [ "master" ]
6-
pull_request:
7-
branches: [ "master" ]
8-
9-
env:
10-
MAVEN_OPTS: -Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true
11-
MAVEN_CLI_OPTS: --batch-mode --errors --fail-at-end --show-version
12-
13-
jobs:
14-
build:
15-
runs-on: ubuntu-latest
16-
steps:
17-
- name: Set up JDK 17
18-
uses: actions/setup-java@v3
19-
with:
20-
java-version: '17'
21-
distribution: 'temurin'
22-
- uses: actions/checkout@v4
23-
- name: Set up QEMU
24-
uses: docker/setup-qemu-action@v3
25-
- name: Run the Maven verify phase
26-
run: mvn $MAVEN_CLI_OPTS verify
27-
- name: Build Docker image for Knowledge Directory
28-
uses: docker/build-push-action@v6
29-
with:
30-
context: ./knowledge-directory
31-
platforms: linux/amd64
32-
tags: knowledge-directory
33-
load: true
34-
- name: Build Docker image for Smart Connector
35-
uses: docker/build-push-action@v6
36-
with:
37-
context: ./smart-connector-rest-dist
38-
platforms: linux/amd64
39-
tags: smart-connector
40-
load: true
41-
- name: Build and start smoke test
42-
run: docker compose -f ".github/workflows/docker-smoke-test" up -d --build
43-
- name: Check smoke test status
44-
run: sleep 60s && test $(docker info --format '{{json .ContainersRunning}}') == 5
45-
shell: bash
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
env:
10+
MAVEN_OPTS: -Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=$CI_PROJECT_DIR/.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Dorg.slf4j.simpleLogger.showDateTime=true -Djava.awt.headless=true
11+
MAVEN_CLI_OPTS: --batch-mode --errors --fail-at-end --show-version
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Set up JDK 17
18+
uses: actions/setup-java@v3
19+
with:
20+
java-version: '17'
21+
distribution: 'temurin'
22+
- uses: actions/checkout@v4
23+
- name: Set up QEMU
24+
uses: docker/setup-qemu-action@v3
25+
- name: Run the Maven verify phase
26+
run: mvn $MAVEN_CLI_OPTS verify
27+
- name: Build Docker image for Knowledge Directory
28+
uses: docker/build-push-action@v6
29+
with:
30+
context: ./knowledge-directory
31+
platforms: linux/amd64
32+
tags: knowledge-directory
33+
load: true
34+
- name: Build Docker image for Smart Connector
35+
uses: docker/build-push-action@v6
36+
with:
37+
context: ./smart-connector-rest-dist
38+
platforms: linux/amd64
39+
tags: smart-connector
40+
load: true
41+
- name: Build and start smoke test
42+
run: docker compose -f ".github/workflows/docker-smoke-test" up -d --build
43+
- name: Check smoke test status
44+
run: sleep 60s && test $(docker info --format '{{json .ContainersRunning}}') == 5
45+
shell: bash
Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
services:
2-
knowledge-directory:
3-
image: knowledge-directory
4-
5-
runtime-1:
6-
image: smart-connector
7-
environment:
8-
KE_RUNTIME_PORT: 8081
9-
KE_RUNTIME_EXPOSED_URL: http://runtime-1:8081
10-
KD_URL: http://knowledge-directory:8282
11-
runtime-2:
12-
image: smart-connector
13-
environment:
14-
KE_RUNTIME_PORT: 8081
15-
KE_RUNTIME_EXPOSED_URL: http://runtime-2:8081
16-
KD_URL: http://knowledge-directory:8282
17-
18-
kb1:
19-
build: ../../examples/common/asking_kb
20-
environment:
21-
KE_URL: http://runtime-1:8280/rest
22-
KB_ID: http://example.org/kb1
23-
PREFIXES: |
24-
{
25-
"ex": "http://example.org/"
26-
}
27-
GRAPH_PATTERN: |
28-
?a ex:relatedTo ?b .
29-
kb2:
30-
build: ../../examples/common/answering_kb
31-
environment:
32-
KE_URL: http://runtime-2:8280/rest
33-
KB_ID: http://example.org/kb2
34-
PREFIXES: |
35-
{
36-
"ex": "http://example.org/"
37-
}
38-
GRAPH_PATTERN: |
39-
?a ex:relatedTo ?b .
40-
KB_DATA: |
41-
[
42-
{
43-
"a": "<http://example.org/Math>",
44-
"b": "<http://example.org/Science>"
45-
}
1+
services:
2+
knowledge-directory:
3+
image: knowledge-directory
4+
5+
runtime-1:
6+
image: smart-connector
7+
environment:
8+
KE_RUNTIME_PORT: 8081
9+
KE_RUNTIME_EXPOSED_URL: http://runtime-1:8081
10+
KD_URL: http://knowledge-directory:8282
11+
runtime-2:
12+
image: smart-connector
13+
environment:
14+
KE_RUNTIME_PORT: 8081
15+
KE_RUNTIME_EXPOSED_URL: http://runtime-2:8081
16+
KD_URL: http://knowledge-directory:8282
17+
18+
kb1:
19+
build: ../../examples/common/asking_kb
20+
environment:
21+
KE_URL: http://runtime-1:8280/rest
22+
KB_ID: http://example.org/kb1
23+
PREFIXES: |
24+
{
25+
"ex": "http://example.org/"
26+
}
27+
GRAPH_PATTERN: |
28+
?a ex:relatedTo ?b .
29+
kb2:
30+
build: ../../examples/common/answering_kb
31+
environment:
32+
KE_URL: http://runtime-2:8280/rest
33+
KB_ID: http://example.org/kb2
34+
PREFIXES: |
35+
{
36+
"ex": "http://example.org/"
37+
}
38+
GRAPH_PATTERN: |
39+
?a ex:relatedTo ?b .
40+
KB_DATA: |
41+
[
42+
{
43+
"a": "<http://example.org/Math>",
44+
"b": "<http://example.org/Science>"
45+
}
4646
]
Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
package eu.knowledge.engine.admin;
2-
3-
public class AdminUIConfig {
4-
5-
/**
6-
* The key to configure how long (in milliseconds) should the Admin UI wait
7-
* until it tries to ask for all KBs in the network. This value should probably
8-
* be higher in distributed mode, to allow the participants to reach equilibrium
9-
* with respect to knowledge about each other.
10-
*/
11-
public static final String CONF_KEY_INITIAL_ADMIN_UI_DELAY = "initial.admin.ui.delay";
12-
13-
}
1+
package eu.knowledge.engine.admin;
2+
3+
public class AdminUIConfig {
4+
5+
/**
6+
* The key to configure how long (in milliseconds) should the Admin UI wait
7+
* until it tries to ask for all KBs in the network. This value should probably
8+
* be higher in distributed mode, to allow the participants to reach equilibrium
9+
* with respect to knowledge about each other.
10+
*/
11+
public static final String CONF_KEY_INITIAL_ADMIN_UI_DELAY = "initial.admin.ui.delay";
12+
13+
}

docs/docs/glossary.md

Lines changed: 59 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,59 @@
1-
---
2-
sidebar_position: 100
3-
---
4-
5-
# Glossary
6-
7-
## Knowledge Base
8-
An independent producer and/or consumer of information.
9-
10-
## Knowledge Network
11-
A set of Knowledge Bases that securely exchange knowledge about a clearly defined domain.
12-
13-
## Knowledge Engine Runtime
14-
A single instance that is part of a Knowledge Network.
15-
It takes care of the communication between one (or more!) Knowledge Base(s) and the rest of the Knowledge Network.
16-
17-
## Knowledge Directory
18-
A registry that keeps track of all Knowledge Bases (as represented by Smart Connectors), and specifically their knowledge needs and desires.
19-
20-
## Smart Connector
21-
An entity (currently in the form of a Java object) that enables a Knowledge Base to connect to a Knowledge Network and exchange knowledge.
22-
23-
## Knowledge Interaction
24-
A specification of knowledge that a Knowledge Base processes.
25-
A Knowledge Interaction is always one of the following four types: ASK, ANSWER, POST, REACT.
26-
### ASK
27-
A request for knowledge.
28-
29-
### ANSWER
30-
Answer to a request for knowledge
31-
32-
### POST
33-
A publication of knowledge.
34-
35-
### REACT
36-
Reaction to the publication of knowledge
37-
38-
39-
## Graph Pattern
40-
A set of triples, separated by a dot (.), that describe the Knowledge that is processed with a Knowledge Interaction.
41-
Each triple consists of a subject, predicate, and object.
42-
Each of these can be either a variable (using a question mark `?var` prefix), a URI (using the `<https://...>`) or a literal (using quotes `"hello"`)
43-
44-
### On the Expressibility of Graph Patterns
45-
Currently, the Knowledge Engine only supports Basic Graph Patterns.
46-
It does not yet support features such as the FILTER from SPARQL.
47-
48-
## Binding Set
49-
A result of a Knowledge Interaction can have more than 1 match.
50-
These matches are collected in a `BindingSet`, which is simply a set of bindings.
51-
52-
### Binding
53-
Describes a 'match' of a graph pattern.
54-
Essentially it maps (free) variables in a graph pattern to actual values.
55-
Variables can be identified in a graph pattern as they are always prefixed with `?`.
56-
57-
Two important things should be noted:
58-
1. The keys of the bindings MUST correspond to the variable names in the graph pattern, and they must be complete (all variables must have a value bound to them). (This last restriction does not apply to the bindings given with ASK requests; they can be partial of even empty.)
59-
2. The values of the bindings MUST be valid IRIs (https://www.w3.org/TR/turtle/#sec-iri) (for now without prefixes, so full IRIs) or valid literals (https://www.w3.org/TR/turtle/#literals).
1+
---
2+
sidebar_position: 100
3+
---
4+
5+
# Glossary
6+
7+
## Knowledge Base
8+
An independent producer and/or consumer of information.
9+
10+
## Knowledge Network
11+
A set of Knowledge Bases that securely exchange knowledge about a clearly defined domain.
12+
13+
## Knowledge Engine Runtime
14+
A single instance that is part of a Knowledge Network.
15+
It takes care of the communication between one (or more!) Knowledge Base(s) and the rest of the Knowledge Network.
16+
17+
## Knowledge Directory
18+
A registry that keeps track of all Knowledge Bases (as represented by Smart Connectors), and specifically their knowledge needs and desires.
19+
20+
## Smart Connector
21+
An entity (currently in the form of a Java object) that enables a Knowledge Base to connect to a Knowledge Network and exchange knowledge.
22+
23+
## Knowledge Interaction
24+
A specification of knowledge that a Knowledge Base processes.
25+
A Knowledge Interaction is always one of the following four types: ASK, ANSWER, POST, REACT.
26+
### ASK
27+
A request for knowledge.
28+
29+
### ANSWER
30+
Answer to a request for knowledge
31+
32+
### POST
33+
A publication of knowledge.
34+
35+
### REACT
36+
Reaction to the publication of knowledge
37+
38+
39+
## Graph Pattern
40+
A set of triples, separated by a dot (.), that describe the Knowledge that is processed with a Knowledge Interaction.
41+
Each triple consists of a subject, predicate, and object.
42+
Each of these can be either a variable (using a question mark `?var` prefix), a URI (using the `<https://...>`) or a literal (using quotes `"hello"`)
43+
44+
### On the Expressibility of Graph Patterns
45+
Currently, the Knowledge Engine only supports Basic Graph Patterns.
46+
It does not yet support features such as the FILTER from SPARQL.
47+
48+
## Binding Set
49+
A result of a Knowledge Interaction can have more than 1 match.
50+
These matches are collected in a `BindingSet`, which is simply a set of bindings.
51+
52+
### Binding
53+
Describes a 'match' of a graph pattern.
54+
Essentially it maps (free) variables in a graph pattern to actual values.
55+
Variables can be identified in a graph pattern as they are always prefixed with `?`.
56+
57+
Two important things should be noted:
58+
1. The keys of the bindings MUST correspond to the variable names in the graph pattern, and they must be complete (all variables must have a value bound to them). (This last restriction does not apply to the bindings given with ASK requests; they can be partial of even empty.)
59+
2. The values of the bindings MUST be valid IRIs (https://www.w3.org/TR/turtle/#sec-iri) (for now without prefixes, so full IRIs) or valid literals (https://www.w3.org/TR/turtle/#literals).

docs/docs/security.md

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
---
2-
sidebar_position: 11
3-
---
4-
5-
# Security
6-
Within the KE we distinguish between several parts of the security question and explain below how we expect to deal with those:
7-
8-
1) **Connection between Knowledge Base (KB) and Smart Connector (SC)**: When using _Java_ Developer API this is secure by default, however, when using the REST Developer API we need to be more careful. The Generic Adapter and Service Store already provide some solution for this.
9-
2) **Connection between SC and SC** (when in different Java Virtual Machines): By using a configurable Exposed URL, the KE remains flexible with respect to the setup it is used in. This Exposed URL can point directly to the SC or to a proxy that is configured for HTTPS with certificates.
10-
3) **Connection between SC and Knowledge Directory (KD)**: The Knowledge Directory itself exposes a REST API that we recommend to be put behind a HTTPS proxy. SCs have a configuration option to point to the URL of the Knowledge Directory. This can be both HTTP and HTTPS.
11-
4) **Identification/authentication**: Still unclear, but we are thinking about *not* introducing the concept of a user within the KE. The reason is that the only way other KBs can really trust a user, is by having a centralized Identity Provider that all KBs can access which constrasts the distributed nature of the KE. But again, not sure about whether we can maintain this position. Sharing login credentials and JWT tokens through the KE by including them in the domain knowledge is of course possible and this indeed requires the ontologies to contain classes and properties related to login and token information.
12-
5) **Authorization**: In the future we want to support roles and access control policies that are agreed upon by all KBs and it should make up the domain knowledge together with the ontology. We will definitely work on this in the future, but probably not in the scope of InterConnect.
13-
14-
15-
## Sharing credentials
16-
17-
As I mentioned in my previous comment there is no _right_ way to deal with sharing credentials. More discussion and experience is definitely necessary to find the sweet spot for security related issues like these. In your use cases, the easiest and safest way is probably to share the credentials outside of the Knowledge Engine and just use some token (or home id) in the graph pattern, but it might be interesting to see how actually sending the credentials through the KE works out using a login graph pattern. Keep in mind, though, that the KE does not encrypt anything by itself and that the credentials might be visible to others.
18-
19-
## Using Basic Authentication to secure data exchange
20-
21-
The communication in a Knowledge Network can be secured using Basic Authentication and HTTPS. This requires the usage of reverse proxies (like [NGINX](https://www.nginx.org/)) in front of the KD and KE runtimes. In such scenario, this reverse proxy handles all HTTPS and Basis Authentication configuration and forwards traffic over HTTP and without basic authentication to the KD and KE Runtime. To facilitate this, the KE supports conveying user credentials (username and password) within both the KD_URL and KE_RUNTIME_EXPOSED_URL environment variables like this `https://username:password@www.example.org/keruntime`. Whenever these URLs contains user credentials, the KER uses these credentials to connect to the Knowledge Directory or Knowledge Engine Runtime, respectively. An example of using Basic Authentication (without HTTPS) in distributed mode can be found in the within the Knowledge Engine repository at `examples/authentication/`.
1+
---
2+
sidebar_position: 11
3+
---
4+
5+
# Security
6+
Within the KE we distinguish between several parts of the security question and explain below how we expect to deal with those:
7+
8+
1) **Connection between Knowledge Base (KB) and Smart Connector (SC)**: When using _Java_ Developer API this is secure by default, however, when using the REST Developer API we need to be more careful. The Generic Adapter and Service Store already provide some solution for this.
9+
2) **Connection between SC and SC** (when in different Java Virtual Machines): By using a configurable Exposed URL, the KE remains flexible with respect to the setup it is used in. This Exposed URL can point directly to the SC or to a proxy that is configured for HTTPS with certificates.
10+
3) **Connection between SC and Knowledge Directory (KD)**: The Knowledge Directory itself exposes a REST API that we recommend to be put behind a HTTPS proxy. SCs have a configuration option to point to the URL of the Knowledge Directory. This can be both HTTP and HTTPS.
11+
4) **Identification/authentication**: Still unclear, but we are thinking about *not* introducing the concept of a user within the KE. The reason is that the only way other KBs can really trust a user, is by having a centralized Identity Provider that all KBs can access which constrasts the distributed nature of the KE. But again, not sure about whether we can maintain this position. Sharing login credentials and JWT tokens through the KE by including them in the domain knowledge is of course possible and this indeed requires the ontologies to contain classes and properties related to login and token information.
12+
5) **Authorization**: In the future we want to support roles and access control policies that are agreed upon by all KBs and it should make up the domain knowledge together with the ontology. We will definitely work on this in the future, but probably not in the scope of InterConnect.
13+
14+
15+
## Sharing credentials
16+
17+
As I mentioned in my previous comment there is no _right_ way to deal with sharing credentials. More discussion and experience is definitely necessary to find the sweet spot for security related issues like these. In your use cases, the easiest and safest way is probably to share the credentials outside of the Knowledge Engine and just use some token (or home id) in the graph pattern, but it might be interesting to see how actually sending the credentials through the KE works out using a login graph pattern. Keep in mind, though, that the KE does not encrypt anything by itself and that the credentials might be visible to others.
18+
19+
## Using Basic Authentication to secure data exchange
20+
21+
The communication in a Knowledge Network can be secured using Basic Authentication and HTTPS. This requires the usage of reverse proxies (like [NGINX](https://www.nginx.org/)) in front of the KD and KE runtimes. In such scenario, this reverse proxy handles all HTTPS and Basis Authentication configuration and forwards traffic over HTTP and without basic authentication to the KD and KE Runtime. To facilitate this, the KE supports conveying user credentials (username and password) within both the KD_URL and KE_RUNTIME_EXPOSED_URL environment variables like this `https://username:password@www.example.org/keruntime`. Whenever these URLs contains user credentials, the KER uses these credentials to connect to the Knowledge Directory or Knowledge Engine Runtime, respectively. An example of using Basic Authentication (without HTTPS) in distributed mode can be found in the within the Knowledge Engine repository at `examples/authentication/`.
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#------------------------------------------------------------------
2-
# Domain knowledge
3-
#------------------------------------------------------------------
4-
5-
@prefix ex: <http://example.org/> .
6-
7-
-> ( ex:DutchTemperatureSensor rdfs:subClassOf ex:Sensor ) .
8-
-> ( ex:USTemperatureSensor rdfs:subClassOf ex:Sensor ) .
9-
10-
(?x rdfs:subClassOf ?y), (?a rdf:type ?x) -> (?a rdf:type ?y) .
11-
1+
#------------------------------------------------------------------
2+
# Domain knowledge
3+
#------------------------------------------------------------------
4+
5+
@prefix ex: <http://example.org/> .
6+
7+
-> ( ex:DutchTemperatureSensor rdfs:subClassOf ex:Sensor ) .
8+
-> ( ex:USTemperatureSensor rdfs:subClassOf ex:Sensor ) .
9+
10+
(?x rdfs:subClassOf ?y), (?a rdf:type ?x) -> (?a rdf:type ?y) .
11+

0 commit comments

Comments
 (0)