Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domain knowledge (facts + rules) should be loadable via the REST API. #616

Open
bnouwt opened this issue Feb 21, 2025 · 1 comment
Open
Assignees

Comments

@bnouwt
Copy link
Collaborator

bnouwt commented Feb 21, 2025

At first I thought Notation3 would be a good format (and I still think it is), because it supports both facts and rules in a single file/format. Unfortunately, it is not available as a usable Java implementation, because jen3 is a forked version of Apache Jena, while Apache Jena's N3 support is just a synonym to turtle and the some holds for RDF4J. Other Notation3 implementations are written in JavaScript.

Also considered SHACL Rules, but those also can include SPARQL inside rule antecedents/consequents, which complicates things for the knowledge engine and SWRL is a separate format for rules which does not support writing simple facts.

So, in the end I concluded to just reuse the Apache Jena rules format and its parser implementation for loading rules and use regular turtle for loading triples. The Java API for this can remain the same with the setDomainKnowledge(Set<Rule> rules) method, because the triples will be represented by a special rule that returns the domain knowledge triples. If necessary, I can separate the triples into different groups, for example:

  • -> ?s rdf:type ?o
  • -> ?m ?p saref:Measurement

which returns a fraction of all the triples. Maybe this improves performance.

How should the REST API look like? If I create two additional operations (one for loading domain knowledge rules and one for loading domain knowledge facts) I think it becomes difficult to combine these two into a single collection with domain knowledge.

@bnouwt bnouwt self-assigned this Feb 21, 2025
@bnouwt
Copy link
Collaborator Author

bnouwt commented Feb 27, 2025

  • Create code to convert turtle into Apache Jena Rules syntax.
  • Create code to convert Apache Jena Rules into KE rules and detecting/collecting facts into fact rules.
  • Create REST API POST /domainknowledge that sets the domain knowledge for a particular smart connector
  • Create unit test via REST API and Java API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant