KNowledgeOnWebScale/surface

Proposed alternative syntax for Surface

Opened this issue · 3 comments

What about something like that, where

  • { ... } is a positive surface
  • {! ... } is a negative surface
  • {? ... } is a query surface
  • {* ... } is a neutral surfac
  • {@:MySurfaceType ... } is a custom type surface
# every student is a person
{! _:x a :Student !{ _x: a Person }}.
# every cat is dead or alive (or both)
{! _x: a :Cat !{ _:x a :Alive } !{ _x a :Dead }}.

We also need a way to declare a bnode in a surface that is only used in triples from inner surfaces. We could enclose them in |, like:

# everyone knows Bob
{! |_:x| !{ _:x :knows :bob }}

NB: my first attempt was {! _:x | ... }, which looks like "x such that ...." in math notation, but that would be tricky to parse, especially if more than 3 variables are declared -- is it an invalid triple, or a list of declared variables?
The proposal above is visually similar, and also reminiscent of closures in Rust and Ruby ;)

That are great proposals for experiments. At this stage for us RDF Surfaces is a kind of assembly language for logic for us. Jos and I discussed today that transpilers could be imagined to translate your syntax into the current RDF Surfaces syntax to experiment with the look and feel and developer friendliness. A very literal translation would still require programmers to write programs in first-order logic.

josd commented

For me it is really nice to have it in N3 esp. for its built-ins and some surfaces are just built-ins.
It is also very nice to see a surface as, yes, just a triple so that we can reason over them and annotate them as RDF-star triples (like we already do for instance in https://github.com/eyereasoner/eye/blob/master/reasoning/blogic/socrates-star.n3).

Here is an example of a Lisp-like syntactic sugar along the lines that you suggested that can be added on top of RDF surfaces: N3L. The logical meaning of these programs stays the same and still is like programming in first-order logic. What should happen with the logic in a reasoner is the core question.