TNO / knowledge-engine

Improves interoperability between systems (i.e. devices, platforms, apps, databases) by exchanging data based on their semantics
https://knowledge-engine.eu
Apache License 2.0
33 stars 4 forks source link

Make sure the AdminUI can be used during the reasoner workshop. #362

Closed Sophietje closed 9 months ago

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Feb 18, 2022, 09:30

MoSCoW

MUST:

SHOULD:

COULD:

WON'T:

UNCATEGORIZED:

Other tasks:

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Feb 18, 2022, 10:08

marked this issue as related to #349

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Feb 18, 2022, 11:56

created merge request !279 to address this issue

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Feb 18, 2022, 11:59

marked this issue as related to #351

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Feb 21, 2022, 10:29

marked the checklist item Han: dockerize AdminUI to easily integrate into other projects (C2-JeF) as completed

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Feb 21, 2022, 10:36

Regarding this point:

Allow in the Visual Knowledge Explorer for KBs that reside in the same KERuntime as the AdminUI to trigger KIs manually.

We established on Friday that the AdminUI uses its own 'private' KE runtime. This means that there are no other KBs in there by default.

We decided that we could make it so that the AdminUI frontend can still make new KBs and KIs (and trigger them) if the AdminUI backend ships with a KE REST API. @barry.nouwt.tno.nl is working on that in !280.

I therefore moved the following point up to the MUST priority, since it is required to create them before triggering them:

Visually create new KB with KIs.

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Feb 21, 2022, 11:12

Hey @han.kruiger.tno.nl, indeed, either we increase the priority of that point, or we use some script (for now) to initiate all the KBs and their KIs. I think this latter is a good option to begin with. What do you think?

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Mar 4, 2022, 09:09

marked the checklist item Barry: Modify connections between KB to use ReasoningProcessor and ReasoningNode. See #351 as completed

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Mar 4, 2022, 09:09

marked the checklist item Han: Move Visual Knowledge Explorer outside C2-JeF as completed

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Mar 4, 2022, 09:09

marked the checklist item Han: Polish the current Visual Knowledge Explorer as completed

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Mar 4, 2022, 09:09

marked the checklist item Barry: Run REST Developer API next to REST Admin API. as completed

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Mar 4, 2022, 09:46

Planning (10 dagen):
    - (2-3 dagen) Han: Allow in the Visual Knowledge Explorer for KBs that reside in the same KERuntime as the AdminUI to trigger KIs manually.
        ○ trigger van proactive KIs
        ○ reageren op reactive KIs
        ○ iets om bindingsets te vullen (beginnen met JSON)
    - (3 dag) Barry: Pruning om aantal verbindingen te verminderen
    - (1 dag) Barry: Sequence diagrams beschikbaar stellen aan frontend (via connections, alleen plannen)
    - (1 dag) Barry+Han: scenario's voorbereiden, opstellen en uitproberen.
        ○ 3 of 4 kleine scenario's rechtstreeks overgenomen van de vorige reasoner workshop slides
        ○ 1 groter scenario met realistische graph patterns gebaseerd op Aleksandar's test.
        - (2 dagen) Barry+Han: laatste puntjes op de i wat betreft look&feel van de admin ui.

Sorry, Dutch.

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Mar 11, 2022, 08:33

marked the checklist item Han: Allow in the Visual Knowledge Explorer for KBs that reside in the same KERuntime as the AdminUI to trigger KIs manually. as completed

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Mar 11, 2022, 08:36

marked the checklist item Han: Visually create new KB with KIs. as completed

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Mar 11, 2022, 09:05

Other tasks:

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Mar 25, 2022, 12:40

Example that shows that the reasoner makes things parallel

Network JSON (without reasoner)

Click to expand ```json [ { "knowledgeBaseId": "http://example.org/kb-1", "knowledgeBaseName": "KB1", "knowledgeBaseDescription": "KB1", "reasonerEnabled": false, "knowledgeInteractions": [ { "knowledgeInteractionType": "AskKnowledgeInteraction", "graphPattern": "?a ?b ." } ] }, { "knowledgeBaseId": "http://example.org/kb-2", "knowledgeBaseName": "KB2", "knowledgeBaseDescription": "KB2", "reasonerEnabled": false, "knowledgeInteractions": [ { "knowledgeInteractionType": "AnswerKnowledgeInteraction", "graphPattern": "?a ?b ." } ] }, { "knowledgeBaseId": "http://example.org/kb-3", "knowledgeBaseName": "KB3", "knowledgeBaseDescription": "KB3", "reasonerEnabled": false, "knowledgeInteractions": [ { "knowledgeInteractionType": "AnswerKnowledgeInteraction", "graphPattern": "?a ?b ." } ] } ] ```

Network JSON (with reasoner)

Click to expand ```json [ { "knowledgeBaseId": "http://example.org/kb-1", "knowledgeBaseName": "KB1", "knowledgeBaseDescription": "KB1", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "AskKnowledgeInteraction", "graphPattern": "?a ?b ." } ] }, { "knowledgeBaseId": "http://example.org/kb-2", "knowledgeBaseName": "KB2", "knowledgeBaseDescription": "KB2", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "AnswerKnowledgeInteraction", "graphPattern": "?a ?b ." } ] }, { "knowledgeBaseId": "http://example.org/kb-3", "knowledgeBaseName": "KB3", "knowledgeBaseDescription": "KB3", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "AnswerKnowledgeInteraction", "graphPattern": "?a ?b ." } ] } ] ```

Binding JSON (http://example.org/kb-2)

[{"a": "<http://example.org/maths>", "b": "<http://example.org/science>"}]

Binding JSON (http://example.org/kb-3)

[{"a": "<http://example.org/grammar>", "b": "<http://example.org/punctuation>"}]
Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Mar 25, 2022, 13:15

Example with combining measurements of sensors in rooms (slide 21)

Network JSON

Click to expand ```json [ { "knowledgeBaseId": "http://example.org/asking-kb", "knowledgeBaseName": "Asking KB", "knowledgeBaseDescription": "Asks for measurements of sensors in rooms", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "AskKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "graphPattern": "?m rdf:type ex:Measurement . ?m ex:hasValueInCelsius ?v . ?m ex:measuredBy ?d. ?d rdf:type ex:Device . ?d ex:isInRoom ?r ." } ] }, { "knowledgeBaseId": "http://example.org/sensor-1", "knowledgeBaseName": "Sensor 1", "knowledgeBaseDescription": "Knows in which room it is", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "AnswerKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "graphPattern": "?m rdf:type ex:Measurement . ?m ex:hasValueInCelsius ?v . ?m ex:measuredBy ?d. ?d rdf:type ex:Device . ?d ex:isInRoom ?r ." } ] }, { "knowledgeBaseId": "http://example.org/sensor-2", "knowledgeBaseName": "Sensor 2", "knowledgeBaseDescription": "Does not know in which room it is", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "AnswerKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "graphPattern": "?m rdf:type ex:Measurement . ?m ex:hasValueInCelsius ?v . ?m ex:measuredBy ?d. ?d rdf:type ex:Device ." } ] }, { "knowledgeBaseId": "http://example.org/rooms-kb", "knowledgeBaseName": "Rooms KB", "knowledgeBaseDescription": "Knows where sensors are", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "AnswerKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "graphPattern": "?d rdf:type ex:Device . ?d ex:isInRoom ?r ." } ] } ] ```

Binding JSON (http://example.org/sensor-1)

[
  {"m": "<http://example.org/sensors/1>", "v": "12", "d": "<http://example.org/devices/1>", "r": "<http://example.org/rooms/1>"}
]

Binding JSON (http://example.org/sensor-2)

[
  {"m": "<http://example.org/sensors/2>", "v": "17", "d": "<http://example.org/devices/2>"}
]

Binding JSON (http://example.org/rooms-kb)

[
  {"d": "<http://example.org/devices/2>", "r": "<http://example.org/rooms/2>"}
]
Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Mar 25, 2022, 13:47

Example with converting units (slide 22)

:warning: DOESN'T WORK for some reason. :warning: For some reason, it asks the sensor for its Fahrenheit measurements, but doesn't ask the converter. Fixed after #361

Click to expand ```json [ { "knowledgeBaseId": "http://example.org/asking-kb", "knowledgeBaseName": "Asking KB", "knowledgeBaseDescription": "Asks for measurements in Celsius", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "AskKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "graphPattern": "?m rdf:type ex:Measurement . ?m ex:hasValueInCelsius ?celsius ." } ] }, { "knowledgeBaseId": "http://example.org/sensor-1", "knowledgeBaseName": "Sensor 1", "knowledgeBaseDescription": "Measures in Fahrenheit", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "AnswerKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "graphPattern": "?m rdf:type ex:Measurement . ?m ex:hasValueInFahrenheit ?fahrenheit ." } ] }, { "knowledgeBaseId": "http://example.org/converter", "knowledgeBaseName": "Converter", "knowledgeBaseDescription": "Converts Fahrenheit to Celsius", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "ReactKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "argumentGraphPattern": "?m rdf:type ex:Measurement . ?m ex:hasValueInFahrenheit ?fahrenheit .", "resultGraphPattern": "?m ex:hasValueInCelsius ?celsius ." } ] } ] ```

Binding JSON (http://example.org/sensor-1)

[{"m": "<http://example.org/measurements/1>", "fahrenheit": "69.8"}]

Binding JSON (http://example.org/converter)

[{"m": "<http://example.org/measurements/1>", "celsius": "21.0"}]
Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Mar 25, 2022, 15:34

Mmm, maybe try to change the result graph pattern of the converter to only:

?m ex:hasValueInCelsius ?vc .

It might end up in a loop because the argument overlaps with the result graph pattern :smile:

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Mar 25, 2022, 16:03

Loops! :ghost:

I'll give this a try!

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Mar 25, 2022, 16:17

It just tried it, but I can see the popup of the converter at the edge of my screen, but I cannot enter any fields. So, not sure if it works, but the popup location seems a bit off.

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Mar 28, 2022, 11:03

Trivial POST/REACT example

Click to expand ```json [ { "knowledgeBaseId": "http://example.org/poster", "knowledgeBaseName": "POSTer", "knowledgeBaseDescription": "POSTer", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "PostKnowledgeInteraction", "argumentGraphPattern": "?a ?b .", "resultGraphPattern": null } ] }, { "knowledgeBaseId": "http://example.org/reacter", "knowledgeBaseName": "REACTer", "knowledgeBaseDescription": "REACTer", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "ReactKnowledgeInteraction", "argumentGraphPattern": "?a ?b .", "resultGraphPattern": null } ] } ] ```

Binding JSON (http://example.org/poster)

(in the outgoing bindings)

[{"a": "<http://example.org/maths>", "b": "<http://example.org/science>"}]

Binding JSON (http://example.org/reacter)

[]
Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Mar 28, 2022, 11:08

Oh hey, after testing again with the updated graph patterns (without the ?m rdf:type ex:Measurement . triple pattern in the result graph pattern) and correct JSON bindings (with a value for ?m) it works..!

The issues with the popups 'appearing' in the bottom-left corner had to do with not cleaning up removed popups properly.

There is however the issue that Sensor 1 is called upon twice by the reasoner, and then the converter is called once. But it works!

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Mar 28, 2022, 11:26

Hmmm, it doesn't work consistently though... Trying to figure out what causes it to fail now.

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Mar 29, 2022, 11:22

All Knowledge Networks above are working correctly now :smile: and can be used for the workshop.

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Mar 31, 2022, 12:29

Not all examples from the WP5 Reasoner Explanation slides are already tested. The following 4 are present in the presentation and the checked ones are tested and working.

reasoning to infer new data:

reasoning to orchestrate data exchange

The other two are not that simple for several reasons:

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Apr 4, 2022, 10:13

Not designed to work together

Click to expand ```json [ { "knowledgeBaseId": "http://example.org/AppKB", "knowledgeBaseName": "AppKB", "knowledgeBaseDescription": "AppKB", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "PostKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "argumentGraphPattern": "?l rdf:type ex:OnOffLamp . ?l ex:isOn ?o ." } ] }, { "knowledgeBaseId": "http://example.org/Lamp1KB", "knowledgeBaseName": "Lamp1KB", "knowledgeBaseDescription": "Lamp1KB", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "ReactKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "argumentGraphPattern": "?l rdf:type ex:OnOffLamp . ?l ex:isOn ?o ." } ] }, { "knowledgeBaseId": "http://example.org/Lamp2KB", "knowledgeBaseName": "Lamp2KB", "knowledgeBaseDescription": "Lamp2KB", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "ReactKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "argumentGraphPattern": "?l rdf:type ex:DimmableLamp . ?l ex:hasBrightness ?b ." } ] }, { "knowledgeBaseId": "http://example.org/DomainKnowledgeKB", "knowledgeBaseName": "DomainKnowledgeKB", "knowledgeBaseDescription": "DomainKnowledgeKB", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "ReactKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "argumentGraphPattern": "?s rdf:type ex:OnOffLamp . ?s ex:isOn \"true\"^^", "resultGraphPattern": "?s rdf:type ex:DimmableLamp . ?s ex:hasBrightness \"100\" ." } ] } ] ```

Binding JSON (http://example.org/AppKB)

[
    {
    "l": "<lamp1>",
    "o": "\"true\"^^<http://www.w3.org/2001/XMLSchema#boolean>"
    },
    {
    "l": "<lamp2>",
    "o": "\"true\"^^<http://www.w3.org/2001/XMLSchema#boolean>"
    }
]

If no binding set is described here, use the empty ([]) bindingset

Binding JSON (http://example.org/DomainKnowledgeKB)

[{"s":"<lamp2>"}]
Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Apr 8, 2022, 09:09

marked the checklist item Import/Export of scenario with multiple KBs as completed

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Apr 8, 2022, 09:09

marked the checklist item possible GUI improvements as completed

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Apr 8, 2022, 09:09

marked the checklist item no connection to KI when other side is invisible as completed

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Apr 8, 2022, 09:09

marked the checklist item only show relevant graph pattern text boxes for different KI types. as completed

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Apr 8, 2022, 09:09

marked the checklist item extract visualization into empty git repository (for now on our internal gitlab) as completed

Sophietje commented 2 years ago

In GitLab by @han.kruiger.tno.nl on Apr 8, 2022, 09:15

Final fixes before the workshop:

Sophietje commented 2 years ago

In GitLab by @barry.nouwt.tno.nl on Apr 14, 2022, 10:21

Example which demonstrates the reasoner cannot deal with loops.

DOES NOT WORK ENIRELY YET!! It does loop indefinitely, but the bindings seem incorrect.

Network JSON

Click to expand ```json [ { "knowledgeBaseId": "http://example.org/asking-kb", "knowledgeBaseName": "Asking KB", "knowledgeBaseDescription": "Asks for all ancestors.", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "AskKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "graphPattern": "?x ex:ancestorOf ?y ." } ] }, { "knowledgeBaseId": "http://example.org/ancestor-kb", "knowledgeBaseName": "Ancestor KB", "knowledgeBaseDescription": "Knows some of the ancestor relations.", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "AnswerKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "graphPattern": "?a ex:ancestorOf ?b ." } ] }, { "knowledgeBaseId": "http://example.org/transitive-ancestor-kb", "knowledgeBaseName": "Transitive Ancestor KB", "knowledgeBaseDescription": "Can derive new ancestor relations.", "reasonerEnabled": true, "knowledgeInteractions": [ { "knowledgeInteractionType": "ReactKnowledgeInteraction", "prefixes": { "ex": "http://example.org/", "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#" }, "argumentGraphPattern": "?x ex:ancestorOf ?y . ?y ex:ancestorOf ?z .", "resultGraphPattern": "?x ex:ancestorOf ?z ." } ] } ] ```

Binding JSON (http://example.org/ancestor-kb)

[
  {"a": "<barry>", "b": "<fenna>"},
  {"a": "<janny>", "b": "<janny>"}
]

Binding JSON (http://example.org/transitive-ancestor-kb)

[
  {"x": "<janny>", "z": "<fenna>"}
]