diff --git a/README.md b/README.md index 537686c..4d42cae 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,6 @@ in his 2009 ISWC Invited Talk: [BLOGIC](https://www.slideshare.net/PatHayes/blog See the living document [RDF Surfaces Primer](https://w3c-cg.github.io/rdfsurfaces/). -### Examples and Test Cases +### Latest Examples and Test Cases -- https://github.com/eyereasoner/Notation3-By-Example/tree/main/blogic -- https://github.com/eyereasoner/eye/tree/master/logic +- https://github.com/eyereasoner/rdfsurfaces-tests diff --git a/index.bs b/index.bs index 5c414a7..b70dff8 100644 --- a/index.bs +++ b/index.bs @@ -48,12 +48,12 @@ Introduction {#Introduction} Logo This document presents a [Notation3](https://w3c.github.io/N3/spec/) sublanguage -to express a revised RDF logic as envisoned by [Pat Hayes](https://www.ihmc.us/groups/phayes/) in his 2009 ISWC Invited +to express a revised RDF logic as envisioned by [Pat Hayes](https://www.ihmc.us/groups/phayes/) in his 2009 ISWC Invited Talk: [BLOGIC](https://www.slideshare.net/PatHayes/blogic-iswc-2009-invited-talk). RDF Surfaces logic can be thought as an implementation of [Charles Sanders Peirce](https://en.wikipedia.org/wiki/Charles_Sanders_Peirce)'s [Existential Graphs](http://www.jfsowa.com/peirce/ms514.htm) in RDF. -An RDF surface is a kind of a sheet of paper on which RDF graphs can be written. +An RDF surface is a kind of sheet of paper on which RDF graphs can be written. All triples that are part of an RDF graph are then on this sheet of paper, including all [[URI]]s, literals and [Blank nodes](https://www.w3.org/TR/rdf11-mt/#blank-nodes). A sheet of paper can contain more than one RDF graph. An RDF graph can't be split @@ -86,7 +86,7 @@ A *positive surface* with one triple containing a blank node `[] a :City`, which
Two *positive surfaces*, one with the triple `[] a :City` (which means *"There is something that is a city"*), -and another one with the triple `[] a :Cat` (which means *"There is something is a cat"*). +and another one with the triple `[] a :Cat` (which means *"There is something that is a cat"*). blank surface @@ -107,15 +107,15 @@ This means, "There is something that is a city AND There is something that is a **Positive surface** -There are special sheets of paper that can be interpreted as a logical statement. +The default surface on which RDF graphs are written is called the **positive surface**. For instance, the sheet of paper in Example 1 is an example of a **positive surface** -(we use in this document a paper with a black border as a positive surface). Any -RDF graph written on this surface is interpreted as logical assertion (true). An empty +(in this document, we use a paper with a black border as a positive surface). Any +RDF triple written on this surface is interpreted as logical assertion (true). An empty sheet of positive paper is an empty claim and is treated as a logical tautology (true). -When there is there is more than one RDF graph on the surface, then it is a logical conjunction (AND). +When there is more than one RDF triple on the surface, it is a logical conjunction (AND). If we interpret the sheets of paper with the black border in the examples above as -positive surfaces, then they express: +positive surfaces, then they express: - Example 1: true - Example 2: It is true that: Ghent a City. @@ -125,16 +125,14 @@ positive surfaces, then they express: The [blank nodes](https://www.w3.org/TR/rdf11-mt/#blank-nodes) need to be interpreted as existential quantified variables on logical paper. -A positive surface is the default surface, when no other surface information is provided. - **Negative surface** -In the same way as a *positive surface* asserts a logical truth, a **negative surface** +In the same way that a *positive surface* asserts a logical truth, a **negative surface** asserts a logical negation. The examples below will use a sheet of paper with a red border as a negative surface. -An empty *negative surface* on the default positive surface expresses a logical contradicton. When there are one -or more RDF graphs written on an *negative* surface they mean the negation of those RDF graphs. +An empty *negative surface* on the default positive surface expresses a logical contradiction. When one +or more RDF graphs are written on a *negative* surface, they mean the negation of those RDF graphs. A blank node on a negative surface is interpreted as a universal quantified variable. The reason is that: @@ -164,7 +162,7 @@ A *negative surface* with one triple `[] a :City` means **Propositional logic** -With combination of conjunction, by putting triples on a *positive surface*, +With combinations of conjunction, by putting triples on a *positive surface*, and negation, by putting triples on a *negative surface*, any **compound truth-functional statement** can be symbolized with positive and negative sheets of paper: @@ -185,14 +183,10 @@ Propositional logic using *positive* and *negative* surfaces. **First-order logic** -First-order logic can be added to the RDF surfaces by interpreting the blank node as -an existential quantified variable and using the rule that a universal quantified variable can made from an +First-order logic can be added to the RDF surfaces by interpreting a blank node as +an existential quantified variable and using the rule that a universal quantified variable can be made from an existential quantified variable by placing it in an enclosing negative surface: -``` -∀ x : P(x) ⇔ NOT(∃ x : NOT P(x)): -``` - - A blank node on a *positive surface* references an existential quantified variable. - A blank node on a *negative surface* references a universal quantified variable. @@ -204,22 +198,27 @@ First-order logic using *positive* and *negative* surfaces. **First-order logic in Notation3** -RDF Surfaces provides a way to express the notion of *positive* and *negative surfaces* -in Notation3 with help of the built-ins `log:onPositiveSurface` and `log:onNegativeSurface`. +RDF Surfaces provide a way to express the notion of *positive* and *negative surfaces* +in Notation3 with help of the built-in `log:onNegativeSurface`. A `log:onNegativeSurface` +is true when at least one of the nested triples in the object is false. A *positive* surface +can be constructed from double nested `log:onNegativeSurface` built-ins. A *negative* surface +can be constructed from a single `log:onNegativeSurface` built-in. -The subject of both built-ins are the blank nodes that need to be put on the -surface (so that they become existential or universal quantified variables depending on the type -of surface). +The subjects of both built-ins are the blank nodes that need to be put on the +surfaces (so that they become existential or universal quantified variables, +depending on the nesting level of the surface).
-*"Something is a city"* in Notation3 . +*"Something is a city"* in Notation3.
 @prefix : <http://example.org/ns#> .
 @prefix log: <http://www.w3.org/2000/10/swap/log#> .
 
-(_:X) log:onPositiveSurface {
+() log:onNegativeSurface {
+  (_:X) log:onNegativeSurface {
     _:X a :City .
+  }
 } .
 
@@ -238,6 +237,23 @@ _:X a :City .
+
+*"Everything is a city"* in Notation3. Notice how we can make universal or existential +quantified variables by placing blank nodes on an odd or even nested surface. + +
+@prefix : <http://example.org/ns#> .
+@prefix log: <http://www.w3.org/2000/10/swap/log#> .
+
+(_:X) log:onNegativeSurface {
+  () log:onNegativeSurface {
+    _:X a :City .
+  }
+} .
+
+ +
+
*"Nothing is a problem"* in Notation3 . @@ -293,14 +309,15 @@ mean alive, or dead, or both alive and dead.
-A surface can be queried by providing a query surface. The results of this -query will be the final result of the reasoning engine interpreting the surfaces. +A surface can be queried by providing a query surface with the `log:onNegativeAnswerSurface` +built-in. The results of this query will be the final result of the reasoning engine +interpreting the surfaces.
`:Ghent a :City` is a triple on the implicit positive surface. The two nested negative surfaces express that for any subject `_:S` on the positive service -that is a `:City`, it implies that `_:S` needs be be also a `:HumanCommunity`. +that is a `:City`, it is implied that `_:S` if also a `:HumanCommunity`.
 @prefix ex: <http://example.org/ns#>.
@@ -317,12 +334,15 @@ ex:Ghent a ex:City.
 }.
 
 # Query
-(_:S _:C) log:onQuerySurface {
+(_:S _:C) log:onNegativeSurface {
     _:S a _:C.
+    () log:onNegativeAnswerSurface {
+      _:S a _:C.
+    } .
 }.
 
-When this surface is executed by a reasoner the result would be: +When this surface is executed by a reasoner, the result would be:
 @prefix ex: <http://example.org/ns#>.
@@ -333,12 +353,13 @@ ex:Ghent a ex:HumanCommunity.
 
 
-More test cases can be found at [https://github.com/w3c-cg/rdfsurfaces/blob/master/etc.md](https://github.com/w3c-cg/rdfsurfaces/blob/master/etc.md). +More test cases can be found at +[https://github.com/eyereasoner/rdfsurfaces-tests](https://github.com/eyereasoner/rdfsurfaces-tests). Document Conventions ===================== -Within this document, the following namespace prefix bindings to [[URI]]-s are used: +Within this document, the following namespace prefix bindings to [[URI]]s are used: @@ -367,9 +388,9 @@ Surface {#Surface} ============================== Surfaces are written as triples where the `subject` is a list of zero or more blank nodes. -The `object` is a RDF graph or the `true` or `false` literal. The blank nodes in the +The `object` is an graph or the `true` or `false` literal. The blank nodes in the subject list are treated as marks on the object RDF graph. The `predicate` specifies -the kind of surface. Any kind of surface may be used but the following built-in have +the kind of surface. Any kind of surface may be used, but the following built-ins have special semantics:
@@ -380,23 +401,14 @@ special semantics: - - - -
`log:onPositiveSurface` - Positive surfaces claim that an RDF graph on them is true
`log:onNegativeSurface` - Negative surfaces claim that an RDF graph on them is false -
`log:onNeutralSurface` - Neutral surfaces don't claim that the RDF graph on them is true or false -
`log:onQuerySurface` - Query surfaces use the RDF graph on them as a query + Negative surface claim that any RDF graph in the object position is false.
-A surface can contain zero or more other surfaces. These surfaces are then nested. -Nested surfaces can share the same [[URI]]-s and literals (by copying the data), +A surface can contain zero or more other surfaces. These surfaces are "nested". +Nested surfaces can share the same [[URI]]s and literals (by copying the data), but can't share blank nodes. Any blank nodes that are written inside a surface (not as subject of an RDF Surface) are to be interpreted as *coreferences* to the blank node graffiti defined on a parent RDF Surface. If no such parent RDF Surface @@ -407,19 +419,19 @@ blank node graffiti on the default positive surface.
An `ex:myFirstSurface` is created which contains two triples and a nested surface. The -blank node in `_:X a ex:OtherStatement` is a coreference to the `_:X` graffiti on +blank node in `_:X a ex:OtherStatement` is a co-reference to the `_:X` graffiti on `ex:myFirstSurface`. In the nested surface `ex:mySecondSurface`, the blank node in `_:X ex:is true` is also a reference to the `_:X` blank node graffiti on `ex:myFirstSurface`. -The blank node `_:Y` coreference in `ex:mySecondSurface` doesn't refer to a parent blank +The blank node `_:Y` co-reference in `ex:mySecondSurface` doesn't refer to a parent blank node graffiti. It is assumed that the default positive surface contains that graffiti. In the nested surface `ex:myThirdSurface`, the blank node in `_:X ex:is false` is a -coreference to the `_:X` blank node graffiti on `ex:myThirdSurface`. The new graffiti -shields the `_:X` that was defined on `ex:myFirstSurface`: the scope of `_:X` coreferences is now -limited to `ex:myThirdSurface`. +co-reference to the `_:X` blank node graffiti on `ex:myThirdSurface`. The new graffiti +shields the `_:X` that was defined on `ex:myFirstSurface`: the scope of `_:X` +co-references is now limited to `ex:myThirdSurface`.
 @prefix ex: <http://example.org/ns#> .
@@ -444,42 +456,45 @@ limited to `ex:myThirdSurface`.
 
 ## Positive Surface ## {#PositiveSurface}
 
-A positive surface is an RDF graph which claims that an RDF Graph on it is true.
-This is the current default interperation of [RDF Semantics](https://www.w3.org/TR/rdf11-mt/).
+A positive surface is an RDF Graph which claims that an RDF Graph on it is true.
+This is the current default interpretation of [RDF Semantics](https://www.w3.org/TR/rdf11-mt/).
 When no surfaces are provided, an implicit positive surface is assumed in the RDF document.
 
 
-The two surfaces below are equal. +The two surfaces below are equal (because a double negation of a statement is the same as +claiming the statement is true: positive):
 @prefix : <http://example.org/ns#> .
 @prefix log: <http://www.w3.org/2000/10/swap/log#> .
 
-() log:onPositiveSurface {
-    :Alice a :Person .
-}
+:Alice a :Person .
 
-and +and
 @prefix : <http://example.org/ns#> .
 @prefix log: <http://www.w3.org/2000/10/swap/log#> .
 
-:Alice a :Person .
+() log:onNegativeSurface {
+  () log:onNegativeSurface {
+    :Alice a :Person .
+  } .
+}
 
-The semantics of a positive surface is interpreted as a logical truth: +The semantics of a positive surface are interpreted as a logical truth: -- An empty positive surface is a tautology -- When a triple is placed on a positive surface, then the surface is valid when the triple is true. -- When two or more triples are placed on a positive surface, then the surface is valid when the logical conjunction of all triples is true. +- An empty positive surface is a tautology. +- When a triple is placed on a positive surface, the surface is valid when the triple is true. +- When two or more triples are placed on a positive surface, the surface is valid when the logical conjunction of all triples is true.
The surface below should be interpreted as: "Alice is a person and knows Bob, and Bob is a -person that knows Alice". +person and knows Alice". As a logical statement: @@ -500,43 +515,55 @@ As RDF Surface: :Alice a :Person . :Alice :knows :Bob . -() log:onPositiveSurface { +() log:onNegativeSurface { + () log:onNegativeSurface { :Bob a :Person . :Bob :knows :Alice . + } . } .
-When a blank node is marked on a positive surface, then it is interpreted as an existential -variable in the scope of the positive surface. +When a blank node is marked on an even-nested negative surface, it is interpreted +as an existential quantified variable in the scope of the nested surface.
-The surface below should be interpreted as : "There is a person that -knows Alice". +The surface below should be interpreted as: "There is a person that knows Alice". As a logical statement: ``` - ∃ _:X : _:X a :Person AND _:X :knows :Alice +∃ _:X : _:X a :Person AND _:X :knows :Alice +``` + +Or, rewritten using NOT: + +``` +NOT( NOT(∃ _:X : _:X a :Person AND _:X :knows :Alice) ) ``` +We make use of the logical rule that a negation of a negation cancels, and creates a positive statement. + As RDF Surface:
 @prefix : <http://example.org/ns#> .
 @prefix log: <http://www.w3.org/2000/10/swap/log#> .
 
-(_:X) log:onPositiveSurface {
+() log:onNegativeSurface {
+  (_:X) log:onNegativeSurface {
     _:X a :Person .
     _:X :knows :Alice .
+  } .
 } .
 
-In RDF Surfaces an default positive surface is implicitly assumed for each RDF document. On this default positive surface all -existential variables are implicitly quantified. Example 19 can be rewritten as: +In RDF Surfaces, a default positive surface is implicitly assumed for each +RDF document. On this default positive surface, all existential variables +are implicitly quantified. Example 20 can be rewritten as:
A default positive surface with an implicit `_:X` existential variable. @@ -551,23 +578,56 @@ _:X :knows :Alice .
-Note: The use of a positive surface is deprecated and will be removed from future versions of the RDF Surface Primer. -A deeply nested positive surface is syntactic sugar for a double nested negative surface. +When a blank node is marked on an odd-nested negative surface, it is interpreted +as a universal quantified variable in the scope of the nested surface. + +
+The surface below should be interpreted as: "Everything is a person and knows Alice". + +As a logical statement: + +``` +∀ _:X : _:X a :Person AND _:X :knows :Alice +``` + +Or, rewritten using NOT: + +``` +NOT( ∃ _:X : NOT(_:X a :Person AND _:X :knows :Alice) ) +``` + +We make here use of the local rule that `NOT( ∃ _:X ... )` is equal to `∀ _:X NOT( ...)`. + +As RDF Surface: + +
+@prefix : <http://example.org/ns#> .
+@prefix log: <http://www.w3.org/2000/10/swap/log#> .
+
+(_:X) log:onNegativeSurface {
+  () log:onNegativeSurface {
+    _:X a :Person .
+    _:X :knows :Alice .
+  } .
+} .
+
+ +
## Negative Surface ## {#NegativeSurface} A negative surface is an RDF graph which claims that an RDF Graph on it is false. The -intepretation of the negative surface is the negation of RDF Graph on it. +interpretation of the negative surface is the negation of the RDF Graph on it. -The semantics of a negative surface is interpreted as a logical falsehood: +The semantics of a negative surface are interpreted as a logical falsehood: - An empty negative surface is a contradiction. -- When a triple is placed on a negative surface, then the surface is valid when the triple is false. -- When two or more triples are placed on a positive surface, then the surface is valid when the logical conjunction of all triples is false. +- When a triple is placed on a negative surface, the surface is valid when the triple is false. +- When two or more triples are placed on a positive surface, the surface is valid when the logical conjunction of all triples is false.
The surface below should be interpreted as: "Alice is a person and knows Bob and Bob is -not a person that knows Alice". +not a person and does not know Alice". As a logical statement: @@ -596,7 +656,7 @@ As RDF Surface:
-When a blank node is marked on a negative surface, then it should be interpreted as an existential +When a blank node is marked on a negative surface, it should be interpreted as an existential quantified variable in the scope of the negative surface.
@@ -645,7 +705,7 @@ As RDF Surface:
-When two or more negative surfaces are nested in a parent negative surface, then it should +When two or more negative surfaces are nested in a parent negative surface, it should be interpreted as a logical disjunction.
@@ -696,7 +756,7 @@ As RDF Surface:
-With combinations of AND and NOT other logical truth function can be build. E.g. +Other logical truth functions can be built with combinations of AND and NOT, such as the following: - Disjunction: `P ∨ Q` : `NOT( NOT(P) AND NOT(Q))` - Material implication `P → Q` : `NOT( P AND NOT Q )` . @@ -705,160 +765,10 @@ With combinations of AND and NOT other logical truth function can be build. E.g. Negative surfaces should also follow the law of double negation elimination: `P = NOT(NOT(P))`. -## Neutral Surface ## {#NeutralSurface} - -A neutral surface makes no claims at all about the graphs written on it. Neutral surfaces can be used, for instance, -to store information about RDF Collections. Triples on a neutral surface will not be "executed" -in any way by a reasoner. Unless, the triples are copied to a positive or negative surface. - -Nesting a neutral surface in another neutral surface will create a nesting of two surfaces. - -Writing blank node graffiti on a neutral surface doesn't have specific semantic meaning. - -
-The surface below contains on the (default) positive surface factual information about -`http://example.org/ns#Alice` and `http://example.org/ns#Bob` and two books: -`http://example.org/ns#Book1` and `http://example.org/ns#Book2`. The positive surface -also contains structural information to group Books and Authors in an arbitrary author and -book list. - -
-@prefix : <http://example.org/ns#> .
-@prefix log: <http://www.w3.org/2000/10/swap/log#> .
-@prefix ldp: <http://www.w3.org/ns/ldp#> .
-
-:Alice a :Person , :BookerPrizeWinner ;
-  :name "Alice" .
-
-:Bob a :Person ;
-  :name "Bob" .
-
-:Book1 a :Book ;
-  :title "Learn RDF in 21 days" ;
-  :author :Alice .
-
-:Book2 a :Book ;
-  :title "The RDF Surface programming language" ;
-  :author :Bob .
-
-() log:onNeutralSurface {
-  :BookList1 a ldp:Container ;
-    ldp:contains :Book1 , :Book2 .
-
-  :AuthorList1 a ldp:Container ;
-    ldp:contains :Alice , :Bob .   
-} .
-
-
- -## Query Surface ## {#QuerySurface} - -A query surface is used to return to external applications a single (positive) RDF Surface -specified by a graph template. The result is an RDF Surface formed by taking each query -solution in the solution sequence, substituting for the variables in the graph template, -and combining the triples into a single RDF Surface by set union. - -The semantics of a query surface is as follows: - -- An empty query surface is an empty template which doesn't match any triple on the default surface. -- A query surface which contains one or more triples, the triples will create a basic graph pattern that will be matched against all entailments that can be -concluded from the default positive surface. -- Blank nodes on a query surface are interpreted as universal quantified variables. - -
-A query surface that exposes all the triples on the default surface, plus all its entailments. - -
-@prefix : <http://example.org/ns#> .
-@prefix log: <http://www.w3.org/2000/10/swap/log#> .
-
-(_:S _:P _:O) log:onQuerySurface {
-    _:S _:P _:O .
-} .
-
- -The query above mimics the result of a SPARQL query (except for the added entailments): - -
-CONSTRUCT {
-    ?S ?P ?O .
-}
-WHERE {
-    ?S ?P ?O .
-}
-
- -
- -
-Return the MyExample surface which only contains one triple: - -
-@prefix : <http://example.org/ns#> .
-@prefix log: <http://www.w3.org/2000/10/swap/log#> .
-
-(_:S _:P _:O) log:onQuerySurface {
-    () log:onMyExampleSurface {
-        _:S _:P _:O .
-    } .
-} .
-
- -The query above mimics the result of a SPARQL query (except for the added entailments): - -
-@prefix : <http://example.org/ns#> .
-@prefix log: <http://www.w3.org/2000/10/swap/log#> .
-
-CONSTRUCT {
-    () log:onMyExampleSurface {
-        ?S ?P ?O .
-    } .
-}
-WHERE {
-    () log:onMyExampleSurface {
-        ?S ?P ?O .
-    } .
-}
-
- -Return all triples on MyExample surfaces: - -
-@prefix : <http://example.org/ns#> .
-@prefix log: <http://www.w3.org/2000/10/swap/log#> .
-
-(_:G) log:onQuerySurface {
-    () log:onMyExampleSurface _:G .
-} .
-
- -
- -
-Return all negative surfaces (without blank node graffiti) which contain one single triple about `http://example.org/ns#Alice`. - -
-@prefix : <http://example.org/ns#> .
-@prefix log: <http://www.w3.org/2000/10/swap/log#> .
-
-(_:P _:O) log:onQuerySurface {
-    () log:onNegativeSurface {
-        :Alice _:P _:O .
-    } .
-} .
-
- -
- -## Question and Answer Surface +## Answer Surface Issue: TODO -## Other Surfaces ## {#OtherSurface} - -Issue: TODO - Examples {#Examples} ================ @@ -866,10 +776,8 @@ Issue: TODO See: -- [https://github.com/eyereasoner/eye/tree/master/reasoning/blogic](https://github.com/eyereasoner/eye/tree/master/reasoning/blogic) -- [https://github.com/eyereasoner/Notation3-By-Example/tree/main/blogic](https://github.com/eyereasoner/Notation3-By-Example/tree/main/blogic) -- [https://github.com/eyereasoner/Notation3-By-Example/tree/main/examples](https://github.com/eyereasoner/Notation3-By-Example/tree/main/examples) - +- [https://github.com/eyereasoner/eye/tree/master/reasoning/rdfsurfaces](https://github.com/eyereasoner/eye/tree/master/reasoning/rdfsurfaces) +- [https://github.com/eyereasoner/rdfsurfaces-tests](https://github.com/eyereasoner/rdfsurfaces-tests)
 {
diff --git a/index.html b/index.html
index 6535cf7..ccbd42e 100644
--- a/index.html
+++ b/index.html
@@ -1488,7 +1488,8 @@
 		}
 	}
 
-  
+  
+