KNowledgeOnWebScale / surface

RDF Surfaces
https://knowledgeonwebscale.github.io/surface/
7 stars 1 forks source link

Proposed alternative syntax for Surface #5

Open pchampin opened 1 year ago

pchampin commented 1 year ago

What about something like that, where

# 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 ;)

phochste commented 1 year ago

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 1 year ago

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).

phochste commented 1 year ago

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.