Re: Hello, n3

Hi William, all

> Thanks very much for helping to initiate this work, and your initial 
> list of issues with N3! It looks like you’ve done a lot of very 
> interesting work. Some initial two cents from my end:
>
>   * As an aside, I was wondering in what cases rules in consequences
>     would be useful from a logical point of view (don’t have access to
>     [1] right now).
>
I didn't want to "spam" this list with my papers, but I can send you a copy.


>   * Isn’t the following just as effective:
>
> { ?C1 rdfs:subClassOf  ?C2, ?x a ?C1 } => ?x a ?C2
>
> But I understand why it could be (syntactically) useful from a 
> pre-processing point of view—since only the initial rule body needs to 
> be instantiated with TBox terms (?).
>
That is exactly the point: The TBox of an owl  ontology can be 
preprocessed, you somehow "translate" the owl ontology into rules which 
you can then use to reason over your ABox.  Semantically, it does not 
make a difference whether you use your rule above or the newly produced 
rule I had in the previous mail. But (at least in the EYE reasoner) it 
highly influences the reasoning times whether you have a rule with 3 
variables which need to be resolved or with only one as it would be 
produced in my example.

> For me personally, the interesting part about N3 is the fact that it 
> supports a rule layer, making it much more than a “readable RDF 
> syntax”. It makes passing rules together with the dataset very easy 
> (although SPIN also supports this).
>
>   * As mentioned by Doerthe, and unbeknownst to me previously, N3
>     allows to describe statements directly using “formulae”, without
>     having to explicitly “s-p-o-encode” the described statements, i.e.,
>
> { :william dc:wrote :Moby_Dick } a n3:falsehood .
>
> As also referenced by Doerthe, this very much reminded me of the work 
> by Hartig et al., who introduced an extended semantics (RDF* and 
> SPARQL*) [1] for reification support. Doerthe, it’s not clear what you 
> mean by saying that reification is excluded by RDF semantics (then 
> again, there are whole parts on that page that are unclear to me ..).
>
First of all: I like the work on RDF* and even more on SPARQL* and think 
that N3 standardisation should go together with RDF*. But now to your 
question: The paper about RDF* basically says that the statement:

    << :william dc:wrote :Moby_Dick >> a n3:falsehood .

Is the same as saying:

    _:x a n3:falsehood.|
    _:x rdf:type rdf:Statement .||
    _:x rdf:subject :William .||
    _:x rdf:predicate dc:wrote .||
    _:x rdf:object :MobyDick .|

i.e. it is the same a rdf reification. The problem now is, that rdf 
semantics explicitly says that reification is not covered by their model 
theory:

    /"The RDF semantic conditions do not place formal constraints on the
    meaning of much of the RDF vocabulary which is intended for use in
    describing containers and bounded collections, or the reification
    vocabulary intended to enable an RDF graph to describe RDF triples.
    This appendix briefly reviews the intended meanings of this
    vocabulary" /

(quote from: https://www.w3.org/TR/rdf11-mt/#whatnot)
||

In other words: it is not formally defined what rdf reification means.

> ·From a “developability” point of view, it’s great that N3 can 
> represent lists in a non-triple form, but it doesn’t seem to be 
> mentioned in the Team Submission [2] (it is mentioned on the N3 logic 
> page [3]).
>
It is also mentioned in the Team Submission:

    /"Implementations may treat //list//as a data type rather than just
    a ladder of rdf:first and rdf:rest properties."/

(quote from: https://www.w3.org/TeamSubmission/2008/SUBM-n3-20080114/#lists)


> ·I believe there could be a semantic layer, aside from a syntactical 
> one, that facilitates working with lists (i.e., RDF collections). For 
> instance, when computerizing the OWL2 RL axiomatization, one often 
> runs into the following types of rules:
>
> { ?c owl:unionOf ?l, ?l _x:member_ ?cl } => ?cl owl:subClassOf ?c
>
> Where the _x:member_ can be supported by adding an extra few rules 
> [4]. Using rdfs:member seems to do something similar for RDF(S) 
> containers, but that’s much easier since containers do not represent 
> linked lists.
>
Here you mention one point I forgot on my list:

We should formalise *built-ins*: Cwm (and I think also the team 
submission) mentions a list of built-ins, you can find them at 
https://www.w3.org/2000/10/swap/doc/CwmBuiltins
Your x:member iseems to be the same as list:member from the N3 built-ins.

EYE supports even more built-ins. Some are taken from RIF, some are 
customized: http://eulersharp.sourceforge.net/2003/03swap/eye-builtins.html
I hope that we as a group will be able to extend the list of N3 built-in 
predicates such that it won't be necessary for any reasoner to have such 
own predicates (but that is my vision for later).

> Even in case all list elements need to be referenced:
>
> { ?c owl:intersectionOf ?l, @forall :cl (?l x:member :cl, :cl a ?t, ?y 
> a ?t) } => ?y a ?c
>
Note that the rule above is problematic since the scope of your @forAll 
is basically the whole Web, so you can never know whether the 
antecedence of this rule is true. What you can do, is set a scope, 
saying something like "for all c1 mentioned in a certain document", this 
is something we can test.

You can find one implementation of the OWL-RL rules in N3 on the Web 
site of EYE: http://eulersharp.sourceforge.net/2003/03swap/eye-owl2.html
The solution used there uses a special built-in of the EYE reasoner 
which takes scope into account built-ins (but a custom built-in is maybe 
not the best solution).

The rule you mention above is the same as

    {?C  owl:intersectionOf  <http://www.w3.org/2002/07/owl>  ?L.?L  rdf:first  <http://www.w3.org/1999/02/22-rdf-syntax-ns>  ?A.?X  a  ?A.?L  rdf:rest  <http://www.w3.org/1999/02/22-rdf-syntax-ns>  ?B.?S  e:findall  <http://eulersharp.sourceforge.net/2003/03swap/log-rules.html#findall>  (?Y  {?Y  list:in  <http://www.w3.org/2000/10/swap/list>  ?B.?X  a  ?Y}?B)} => {?X  a  ?C}.

Most of the built-ins used are explained on the  Cwm built-in list, but 
e:findall is a special  built-in of EYE 
(http://eulersharp.sourceforge.net/2003/03swap/log-rules.html#findall).
I will explain this one better. The predicate is used  as follows:

    ?SCOPE e:findall (?SELECT ?WHERE ?ANSWER).

The built-in is used to search for the occurrence of certain patterns 
(?Where, this is a graph) in the list of files taken into account 
(?SCOPE). The  ?SELECT-part can be a graph or also just a variable. It 
is what gets collected in case a match with the ?Where part is found. 
The variable ?ANSWER is then a list of these "collected" instances.

As a concrete example consider the following triples:

    :william a :Man; :wrote :PreviousEmail.
    :doerthe a :Woman; wrote :ThisEmail.
    :melville a :Man; :wrote :MobyDick, :Typee.

and the rule:

    {?x a :Man. ?s e:findall (?y {?x :wrote ?y} ?list).}=> {?list
    :writtenBy ?x}.

What now happens is, that the rule searches for every man (?x a :Man.) 
and collects for this man a list (?list) of all the things he wrote (?y 
in {?x :wrote ?y}). Here, the result is:

    (:PreviousEmail) :writtenBy :william.
    (:MobyDick :Typee) :writtenBy :melville.

The result somehow feels "closed" (I know that William wrote more) but 
by indicating a concrete scope, we stay monotonic here. We just search 
for everything wrotten by man *which is mentioned *in my triple set, 
that is a concrete scope.

So, I showed how this can be solved in EYE, but I strongly recommend 
that we get a joint solution for that. Such a solution could be a 
built-in, but I would start with "easier problems" first.


> As mentioned by Reynolds [5], such a rule could be replaced by 3 
> auxiliary rules for support by general-purpose rule engines.
>
I will have to read that, thank you for the pointer.
>
> Maybe such rule-based representations could form the basis for an 
> extended semantics (?) while N3-supporting reasoners could optimize 
> support for them.
>
I think such "extended semantics" can be built-ins, but we should agree 
on these to guarantee interoperability.
>
> Looking forward to your thoughts. Note that I tend to work more on the 
> application side of things ([4] was a rare venture for me, even though 
> it is already a bit applied).
>
I think that is very good for our group. I hope that will help us to 
come to a sound, but still useful specification. The usefulness is not 
always there when there is no one like you asking the right questions :)


Kind regards,
Dörthe//



> William
>
> [1] Hartig O, Thompson B. Foundations of an Alternative Approach to 
> Reification in RDF. CoRR 2014;abs/1406.3.
>
> [2] https://www.w3.org/TeamSubmission/n3
>
> [3] https://www.w3.org/DesignIssues/Notation3.html
>
> [4] http://www.semantic-web-journal.net/system/files/swj1881.pdf (code 7)
>
> [5] https://www.w3.org/TR/rif-owl-rl/#Forward_intersectionOf_rule
>
> *From:*Doerthe Arndt <doerthe.arndt@ugent.be>
> *Sent:* November-30-18 7:47 AM
> *To:* public-n3-dev@w3.org
> *Subject:* Re: Hello, n3
>
> Dear Nathan, all,
>
> Thank you for pushing this forward!  I am really happy that you are as 
> enthusiastic about this topic as I am. I always wanted to push forward 
> the formalisation of N3, so I guess, now is the time.
>
> A little bit more about my and our background:
>
> I have a master in Mathematics and I am currently finishing my PhD in 
> Computer Science which has N3 and its applications as a topic. I work 
> at imec in Gent (Belgium) and there, we had many research projects 
> using N3 and the EYE reasoner (I am sure Jos will tell us more about 
> his implementation in another mail, till then you can already check 
> http://eulersharp.sourceforge.net/ and http://n3.restdesc.org/).
>
> Some example projects :
>
>   * We implemented owl-rl rules in N3 and used it for ontology
>     reasoning (maybe an idea to also test it on the work of you,
>     William, but that is just a side note :) ). What was special about
>     N3 here was that N3 allows rules in the consequence of rules (
>     like {?C1 rdfs:subClassOf ?C2}=>{ {?x a ?C1}=>{?x a ?C2} }.). We
>     used this for preprocessing. [1]
>   * We also had several projects in which we used the fact that Cwm
>     and EYE both can produce proofs. We created a format to describe
>     possible restful Web API calls in forms of rules with existential
>     variables in the consequence (another nice feature of N3),
>     RESTdesc. The user can then give a goal he or she wants to reach
>     and by producing a proof the computer provides a plan  how this
>     goal can be reached. [2,2a]
>   * We used N3 for data validation. Here, we used a lot of the
>     built-ins of N3, but also  the RIF built-ins as they are
>     implemented in EYE. [3]
>
> We also already worked on the formalisation of N3 and identified 
> several problems which need to be fixed:
>
>   * *Implicit quantification:* When we used the reasoners Cwm and EYE,
>     we discovered, that they differed in their way of handling
>     implicit universal quantification. To give a concrete example,
>     consider the rule:
>
> {{?x :p :o} => {?x :p2 :o2}}=> {:a :b :c}.
>
> Cwm interprets that as:
>
> (∀x: p(x,o) → p2(x,o2)) → b(a,c)
>
> EYE interprets it as:
>
> ∀x: (p(x,o) → p2(x,o2)) → b(a,c)
>
> The reason for that the W3C team submission is not really clear here, 
> it says that universals are quantified "on the parent formula" (see 
> https://www.w3.org/TeamSubmission/n3/#Quantifica), but it does not say 
> what exactly this "parent" is.
>
>   * *Explicit quantification: *N3 provides a way to express explicit
>     quantification (by using @forall and @forsome). An example formula is:
>
>      @forAll <#h>. @forSome <#g>. <#g> <#loves> <#h> .
>
>     which means in FOL:
>
>     ∀h: ∃g: loves(h,g)
>
>     But the spec also says that /"If both universal and existential
>     quantification are specified for the same formula, then the scope
>     of the universal quantification is outside the scope of the
>     existentials" /(see
>     https://www.w3.org/TeamSubmission/n3/#Quantifica). So the formula
>
>     @forSome <#g>. @forAll <#h>. <#g> <#loves> <#h> .
>
>     also means
>
>     ∀h: ∃g: loves(h,g)
>
>     I at least think that this is counter intuitive (but maybe there
>     are good reasons to do it that way?).
>
>   * *No distinction between variables and constants:
>
>     *Related to the previous topic, it can be a problem that variables
>     and constants are not clearly distinguished. Look for example at
>     the first occurence of :h in this formula:
>
>     @forSome :g. :g :p *:h*.  @forAll :h. :g :loves :h .
>
>     Given the reversal of quantifiers when interpreting it (∀h: ∃g:
>     ...) it is not clear to me whether this :h is a universally
>     quantified variable or a constant.
>
>   * *Citation of Formulas:
>     *We need to agree how to interpret cited graphs like for example
>
>     :x :says {:s :p :o}.
>
>     I think this topic is quite challenging (for TriG, for example,
>     there was no agreement https://www.w3.org/TR/rdf11-datasets/).
>     RDF* [4] reduces such constructs to rdf reification which
>     unfortunately doesn't solve the problem of defining a semantics
>     since reification is excluded in rdf semantics (see:
>     https://www.w3.org/TR/rdf11-mt/#reification). There are many
>     different approaches we could follow like for example KIF [5],
>     Common Logic [6] or also make it more complex like they do in SUMO
>     [7].
>
> I worked on the quantification part and published a paper in 2015 
> about that [8] (it is only a first draft which especially does not yet 
> take the position of a quantifier into account) begin our discussions, 
> till then I can refer to my presentation about this topic here: 
> https://docs.google.com/presentation/d/1Tkh3JLuayBft63ltoeCCD68Zfa9wMFzjOz-h_xYX0PU/edit?usp=sharing 
> (I enabled commenting in case you want to ask questions). I 
> furthermore also did some work on formalising the proof calculus for 
> N3, this part can be found in our Paper Pragmatic Proof [2a].
>
> As you see. I am really interested in writing the spec, but I am also 
> willing to invest time in working on and testing implementation(s) and 
> I am looking forward to having detailed discussions.
>
> I am looking forward to working with you.
>
> Kind regards,
> Dörthe
>
> [1]  D. Arndt, B. De Meester, P. Bonte, J. Schaballie, J. Bhatti, W. 
> Dereuddre, R. Verborgh, F. Ongenae, F. De Turck, R. Van deWalle, E. 
> Mannens, Improving OWL RL reasoning in N3 by using specialized rules, 
> in: V. Tamma, M. Dragoni, R. Gonçalves, A. Ławrynowicz (Eds.), 
> Ontology Engineering: 12th International Experiences and Directions 
> Workshop on OWL, Vol. 9557 of Lecture Notes in Computer Science, 
> Springer, 2016, pp. 93–104. doi:10.1007/978-3-319-33245-1_10. URL 
> http://dx.doi.org/10.1007/978-3-319-33245-1_10
>
> [2] http://restdesc.org/
>
> [2a] R. Verborgh, D. Arndt, S. Van Hoecke, J. De Roo, G. Mels, T. 
> Steiner, J. Gabarró Vallés, The pragmatic proof: Hypermedia API 
> composition and execution, Theory and Practice of Logic Programming 17 
> (1) (2017) 1–48. doi:10.1017/S1471068416000016. URL 
> http://arxiv.org/pdf/1512.07780v1.pdf
>
> [3] D. Arndt, B. De Meester, A. Dimou, R. Verborgh, E. Mannens, Using 
> rule-based reasoning for RDF validation, in: S. Costantini, E. 
> Franconi, W. Van Woensel, R. Kontchakov, F. Sadri,
> D. Roman (Eds.), Proceedings of the International Joint Conference on 
> Rules and Reasoning, Vol. 10364 of Lecture Notes in Computer Science, 
> Springer, 2017, pp. 22–36. doi:10.1007/978-3-319-61252-2_3. Available 
> at: https://biblio.ugent.be/publication/8540876/file/8540882.pdf
>
> [4] O. Hartig, B. Thompson, Foundations of an alternative approach to 
> reification in RDF, CoRR abs/1406.3399. arXiv:1406.3399. URL 
> http://arxiv.org/abs/1406.3399
>
> [5] P. Hayes, C. Menzel, A semantics for the knowledge interchange 
> format, in: IJCAI 2001 Workshop on the IEEE Standard Upper Ontology, 
> Vol. 1, 2001, p. 145.
>
> [6] ISO/IEC 24707:2007 Information technology – Common Logic (CL), 
> standards.iso.org/ittf/PubliclyAvailableStandards/c039175_ISO_IEC_24707_2007%28E%29.zip 
> (2007).
>
> [7] C. Benzmüller, A. Pease, Higher-order aspects and context in sumo, 
> Web Semantics: Science, Services and Agents on the World Wide Web 12 
> (2012) 104–117.
>
> [8] D. Arndt, R. Verborgh, J. De Roo, H. Sun, E. Mannens, R. Van de 
> Walle, Semantics of Notation3 logic: A solution for implicit 
> quantification, in: N. Bassiliades, G. Gottlob,F. Sadri, A. Paschke, 
> D. Roman (Eds.), Rule Technologies: Foundations, Tools, and 
> Applications, Vol. 9202 of Lecture Notes in Computer Science, 
> Springer, 2015, pp. 127–143. URL 
> http://link.springer.com/chapter/10.1007/978-3-319-21542-6_9
>
> Hi all, thanks for joining the n3-dev CG.
>
> Since the holiday season is fast approaching, we should perhaps aim to 
> start ramping up communications and efforts from the new year.
>
> If you know anybody else who may be interested in joining, or should 
> be involved, please encourage them to join the CG via 
> https://www.w3.org/community/n3-dev/
>
> In the interim, please do share anything you think is pertinent, 
> including related background reading and references, or anything you'd 
> like to discuss. It may also be useful to start collating 
> implementations, any nuances or bugs that have been found after 
> working with the current specification [1] (see also [2]), also 
> suggestions on what could be improved / simplified / expanded / removed.
>
> Let's all get on the same page, agree what to do, and get it done.
>
> Personally I'll commit time, discussion, spec writing, mistakes, and 
> working reference implementation(s). Throughout the current decade 
> I've frequently thought or said I/you/we could do this with n3, so 
> before the turn of the next decade, /I want/ to be using n3+rules 
> daily, at scale, and will do my utmost to facilitate you all in using 
> it for what you want or need too.
>
> Thanks all, and I look forward to working you all in the coming months,
>
> Nathan
>
> [1] https://www.w3.org/TeamSubmission/n3/
>
> [2] https://www.w3.org/DesignIssues/Notation3.html
>
> -- 
> Dörthe Arndt
> Researcher Semantic Web
> imec - Ghent University - IDLab | Faculty of Engineering and Architecture | Department of Electronics and Information Systems
> Technologiepark-Zwijnaarde 19, 9052 Ghent, Belgium
> t: +32 9 331 49 59 | e:doerthe.arndt@ugent.be  <mailto:doerthe.arndt@ugent.be>  
>
-- 
Dörthe Arndt
Researcher Semantic Web
imec - Ghent University - IDLab | Faculty of Engineering and Architecture | Department of Electronics and Information Systems
Technologiepark-Zwijnaarde 19, 9052 Ghent, Belgium
t: +32 9 331 49 59 | e: doerthe.arndt@ugent.be

Received on Friday, 30 November 2018 19:40:13 UTC