W3C home > Mailing lists > Public > public-rdf-shapes@w3.org > April 2014

Signs '!' and '^' and the problem with open/closed types

From: Daniel Fernández Álvarez <danifdezalvarez@gmail.com>
Date: Tue, 22 Apr 2014 20:14:43 +0200
Message-ID: <CAJ56QOg=+qX24HLjb_hdYNk3Uik14dHsMFWhCeMwhqcqGJn3mA@mail.gmail.com>
To: public-rdf-shapes@w3.org
Hello everyone

I am Daniel Fernández, from the University of Oviedo. I am trying to
produce an implementation of ShEx in python, but I have some specific
doubts about the syntax. Precisely, I have doubts with the use and meaning
of the signs ‘!’ and ‘^’.

I have been checking two formal definitions of ShEx, both made by Eric, and
I have found that these signs do not appear in the definition
http://www.w3.org/2013/ShEx/Definition.html, but they do appear in
http://www.w3.org/2013/ShEx/ShEx.bnf, so I am not sure if they are going to
be part of the final syntax. Anyway, I will ask my questions assuming that
they can be used.

I understand that ‘!’ is used for negation and ‘^’ for entering relations.


! :a xsd:string,

^ :b <A>


That would mean that a node is of type <A> if it does not have an edge
labelled with “a” pointing to a string and if it does have another node of
type <A> pointing to it.

The main problem with these signs belongs to a wider discussion that Sam,
Slawek and Iovka introduced: open types and closed types. I think “!” only
makes sense in definitions of open types and ‘^’ introduces a problem of
meaning if we use it in closed types. I will use the syntax that Sam,
Slawek and Iovka suggested in their mail to distinguish the open types from
the closed ones: ‘..’ at the end of the definition if the type is open.


! :a xsd:string



! :a xsd:string



Using ‘! :a xsd:string’ in the definition of the type <C> does not provide
any meaning. C is closed, so, by definition, nodes with more relations of
the ones defined in <C> would not match <C>, so there is no need to negate
some specific relations, because they are already excluded.

However, in <D>, ‘! :a xsd:string’ does provide useful meaning. Nodes that
match with <D> are every nodes of the graph but those that have at least
one “a” edge pointing to a string.

On the other hand, If we use “^” in closed types, I think we introduce a
bigger problem than thinking if it is useful or not. At least for me, the
meaning of using it is not clear. i.e.:


^ :a <A>



^ :a <A>



To consider a node of type <E>, it looks clear that it must have another
node of type <A> pointing to it… but what does ‘^ :a <A>’ say about the
rest of entering relations? If we define closed types as types that only
accept relations that are specified in their definition, and no more than
these relations, then we could interpret that  <E> can only be pointed by
an <A> with an “a”. No more relations would be allowed.

We could even think that a type such as <C>, that does not have any rule
referring to entering edges, would not match with any node with an entering
edge. It looks that several possibilities are available:

-          To consider closed types “not so close” according to the use of
‘^’. To allow any entering relations, meanwhile the specified ones exist.

-          Assuming that if we don’t have entering rules, then the type
does not specify any restriction over entering relations. But, if we have
at least a sign ‘^’ in the definition of the type, then only the specified
entering relations are allowed, and not any other apart from them.

-          To consider closed types as closed with entering relations as
they are with outgoing ones. I mean, if no “^” is used, then there can’t be
any edge pointing to the node.

I think all the options have pros and cons… and it would be worthy to
discuss them.

It looks like we do not have this problem with open types. <F> would match
with any node that is pointed by an <A> with an “a”, not mattering the rest
of the relations (entering or not).

Apart from that, I have noticed that in the grammar
http://www.w3.org/2013/ShEx/ShEx.bnf, where the signs ‘!’ and ‘^’ do
appear, they are placed in the rule “arc”. I think that it would mean that
syntax does not allow ‘!’ and ‘^’ over blocks of rules. i.e:

<G> {

! :a xsd:string




! (:a xsd:string,

:b xsd:string)



<G> would be a valid definition but <H> would not. Am I correct in this?
And, if I am, is it a final decision?

Best regards,

Daniel Fernández
Received on Friday, 25 April 2014 13:25:12 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:02:37 UTC