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} 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
@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 .
+@prefix : <http://example.org/ns#> . +@prefix log: <http://www.w3.org/2000/10/swap/log#> . + +(_:X) log:onNegativeSurface { + () log:onNegativeSurface { + _:X a :City . + } +} . ++ +
@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.
`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. |
@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):-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.@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 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:-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:@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 . + } . } .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: + +## 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.+@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 . + } . +} . ++ +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. - -- -## 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. - --@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 . -} . ---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`. - -- -## 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)-@prefix : <http://example.org/ns#> . -@prefix log: <http://www.w3.org/2000/10/swap/log#> . - -(_:P _:O) log:onQuerySurface { - () log:onNegativeSurface { - :Alice _:P _:O . - } . -} . -- -{ diff --git a/index.html b/index.html index 6535cf7..ccbd42e 100644 --- a/index.html +++ b/index.html @@ -1488,7 +1488,8 @@ } } - + +