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

Replace Class Metadata Configuration with an N3 Rule using Reasoning #13

Open
BenjaminHofstetter opened this issue Jul 17, 2024 · 0 comments
Labels
enhancement New feature or request n3

Comments

@BenjaminHofstetter
Copy link
Contributor

BenjaminHofstetter commented Jul 17, 2024

This started in n3-class-metadata

The goal is to:

  • Make the configuration simpler
  • Make the code simpler
  • Make SPARQL Query generation simpler
  • Use better semantics inside blueprint

The current configuration is similar to this...

+----------------+
| ClassMetadata  |
|  - icon        |
|  - color       |
|  - label       |
|  - comment     |
|  - searchPrio  |          +----------------------+
| sh:targetNode  |--------->| :Person a rdfs:Class |
+----------------+          +----------------------+

What is wrong with that approach:

  • Hard to remember
  • This has no semantics
  • ...it only has an effect in code
  • All instances of this class appear in the UI ... this is a kind of side effect

First Try:
Create an N3 rules for this and use the eye reasoner to add the information directly to the subjects.

  {
    ?s a <https://schema.org/Organization> 
  } => {
    ?s <https://flux.described.at/searchPrio> 3 ;
         <https://flux.described.at/label> "Organization" ;
         <https://flux.described.at/comment> "" .
         <https://flux.described.at/icon> "fa-solid fa-building" ;
         <https://flux.described.at/colorIndex> "1"  ;
     .
  } .

You can read the rule like { if } => { then } .
Then use the rule to "reason" the Icon, Color, SearchPriority, and the "Class" Label.

Findings after the implementation:

  • it's possible to migrate the old "sh:targetNode" to n3 rules ... so no hard migration needed
  • eye is a bit slow. It took 700ms inside eye reasoning for 16 rules.
  • for simple rules with exactly this pattern I did my own implementation for this. It takes 4ms
  • the structure isn't good enough. We have cases where a subject has two icons, and two colors and two labels.

Second try:

  {
    ?s a <https://schema.org/Organization> 
  } => {
    ?s <https://flux.described.at/searchPrio> 3 ;
         <https://flux.described.at/label> "Organization" ;
         <https://flux.described.at/comment> "" .
         <https://flux.described.at/icon> "fa-solid fa-building" ;
         <https://flux.described.at/colorIndex> "1"  ;
     .
  } .
@BenjaminHofstetter BenjaminHofstetter added enhancement New feature or request n3 labels Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request n3
Projects
None yet
Development

No branches or pull requests

1 participant