RE: ShEx negation of edge path

Hi all,

I spent some time on implementing the negation into my javascript validation script.

However I encountered some issues when negating a group as it has to negate 5 different states NONE,OPEN,PASS,FAIL,ERROR to negate.

This discussion however relates to the behavior of the ERROR state.

Please take a look at the discussion a put on the https://www.w3.org/2001/sw/wiki/ShEx/CurrentDiscussion about the error state behavior and the negation.

I am curious to your opinion about this topic.

Note that my script still follows erics definition. You can change it to my definition by changing
  //_0_or1, _1
  groupSummary =
    [[OPEN,NONE],
     [OPEN,OPEN],
     [FAIL,FAIL],
     [PASS,PASS],
     [ERROR,ERROR]]; //in discussion whether it should be this or [FAIL,FAIL]

Greetz,
Jesse

________________________________
Van: Olivier Rossel [olivier.rossel@gmail.com]
Verzonden: dinsdag 27 mei 2014 17:05
Aan: Iovka Boneva
CC: public-rdf-shapes@w3.org
Onderwerp: Re: ShEx negation of edge path

A point to investigate is when a semantic action is present.
For example:

<withANoHtmlLiteral>  {
   !  :aLiteral rdfResource %js{ return !_.o.contains("<html>"); %}
}

Functionnaly, I need to test two things at the same time:
 -> :aLiteral must be a literal i.e must not be a rdf:Resource
 -> :aLiteral must not contain the string '<html>'

In this example, how should the ! operator behave?
Should it negate only the boolean value coming from
the ShEx expression (and not affect the semantic action)?
Or should it let the ShEx expression plus the semantic action resolve,
and then negate the resulting boolean?

I am not sure at the moment.


On Mon, May 26, 2014 at 4:20 PM, Iovka Boneva <iovka.boneva@univ-lille1.fr<mailto:iovka.boneva@univ-lille1.fr>> wrote:
Hi Olivier,

I agree that this definition is probably the most natural: negate the boolean value.
However, it does not hold for one of the examples


1) forbid a and be to appear cojointly

<XXX>{
 .... ,
 ^ (:a xsd:string, :b xsd:string) ,
...
}
With this definition, 2 a's and 1 b would be accepted.

I think that property is expressed rather by
 ^ ( :a xsd:string+, :b xsd:string+) ,

(although I don't remember whether the Kleene + is part of the syntax).

Iovka



Le 26/05/2014 12:48, Olivier Rossel a écrit :
Hi Iovka,

This is indeed a non-trivial topic, with rough edges.

My initial idea is to try to match what is after the ^
and then negate the boolean result.

So for example:
<XXX>{
 (:a xsd:string | :b xsd:string)
}

would match these triples:
:x :a "a".

or these ones:
:x :b "b".

So negating it like that:
<XXX>{
 ^ (:a xsd:string | :b xsd:string)
}

simply make these triples to FAIL the validation.



So going back to your examples:
1) forbid a and be to appear cojointly

<XXX>{
 .... ,
 ^ (:a xsd:string, :b xsd:string) ,
...
}

2) forbid any a's and b's
<XXX>{
 .... ,
 ^ :a xsd:string,
 ^ :b xsd:string,
 ....
}

3) forbid two a's and one b
<XXX>{
 .... ,
 ^ (:a xsd:string{2}, :b xsd:string),
 ....
}

4) accept any combination except  when two a's and one b
<XXX>{
 .... ,
 (:a xsd:string*, :b xsd:string*) ^ (:a xsd:string{2}, :b xsd:string),
 ....
}

(note that  there is no , to separate the two statements).

These are honestly very rough examples.
May be we should get in touch with people who have worked
on the implementation of negation in SPARQL 1.1
They probably have very precise idea of the rough edges of negation.










On Mon, May 26, 2014 at 12:22 PM, Iovka Boneva <iovka.boneva@univ-lille1.fr<mailto:iovka.boneva@univ-lille1.fr>> wrote:
Dear Olivier,

Regarding negation, one of the difficulties is in defining clear and intuitive semantics. For instance, take
<XXX> {
 ^ (:a xsd:string | :b xsd:string)
}
What does it mean ? What is forbidden for the properties of an XXX-typed node ?
- forbids a and be to appear cojointly ?
- forbids any a's and b's ?
- what about two a's and one b ? is it forbidden or not ?
- what about two a's and two b's ?

What did you mean in your example ?

Best regards,
Iovka


Le 26/05/2014 11:25, Olivier Rossel a écrit :
For my information:

Will it be possible to negate a group?
Something (roughly) like:
<XXX> {
 ^ (:p1 rdf:Resource | :p2 xsd:string)
}

Will it also be possible to negate a valueReference to a shape value?
<XXX> {
 ^ (:p3 @<YYY>)
}

Will I be able to say something like:
<XXX> {
 ^ :p3 @<YYY> ,
 ^ (:p3 xsd:string | :p3 xsd:dateTime)
}


On Mon, May 26, 2014 at 11:04 AM, Dam, Jesse van <jesse.vandam@wur.nl<mailto:jesse.vandam@wur.nl>> wrote:
Hi Alasdair and other,

I would like to make you aware that is there is also my javscript based validation set, however this uses the SHEX/RDF representation instead of the SHEXc format.
For the definition of the Shex/RDF in itself see https://www.w3.org/2001/sw/wiki/ShEx/RDF_serialization. Self validation succeeds and any test case is first validated before tested.

The not operator is not implemented here yet, but I will add that this week.

Here you can find https://github.com/jessevdam/shextest/ the complete set. It is completely coded in javascript. You can start the webserver using ruby(uses sinatra) and go to localhost:4567.

The validation is bit different form to other validators and some test cases are failing as I try to find discussion point to improve SHEX. See the discussion page on https://www.w3.org/2001/sw/wiki/ShEx/CurrentDiscussion for the current most important discussion points. This test script contains a definition for a start element, however the final form of this is yet determined and will be part of a future discussion.

This and next week I will try to include a parser for the ShexC format.

Greetz Jesse


________________________________
Van: Gray, Alasdair J G [A.J.G.Gray@hw.ac.uk<mailto:A.J.G.Gray@hw.ac.uk>]
Verzonden: maandag 26 mei 2014 10:12
Aan: Jose Emilio Labra Gayo
CC: Eric Prud'hommeaux; public-rdf-shapes@w3.org<mailto:public-rdf-shapes@w3.org>
Onderwerp: Re: ShEx negation of edge path


On 24 May 2014, at 06:46, Jose Emilio Labra Gayo <jelabra@gmail.com<mailto:jelabra@gmail.com><mailto:jelabra@gmail.com<mailto:jelabra@gmail.com>>> wrote:

On Fri, May 23, 2014 at 5:05 PM, Gray, Alasdair J G <A.J.G.Gray@hw.ac.uk<mailto:A.J.G.Gray@hw.ac.uk><mailto:A.J.G.Gray@hw.ac.uk<mailto:A.J.G.Gray@hw.ac.uk>>> wrote:
Hi Eric, All,

I want to be able to express the constraint that a certain resource in an RDF document should not have certain a property.

Specifically, I want to express that the follow triple is not permitted because ex:resource is not permitted to have an ex:invalidProperty edge.
ex:resource ex:invalidProperty “Some value” .

You can negations with symbol !. For example:

<Shape> { ! ex:invalidProperty . }

That’s what I thought would be in the syntax.

However, I think, negations are not yet implemented in the Javascript implementation.

Thanks for that piece of information.

I have just added negations to the Scala implementation (http://labra.github.io/ShExcala/)

Unfortunately the deployment environment I’m working with requires that I use the Javascript implementation, although I may try the Scala version to validate the approach.

Best regards

Alasdair

Best regards, Jose Labra

Thanks

Alasdair

Alasdair J G Gray
Lecturer in Computer Science, Heriot-Watt University, UK.
Email: A.J.G.Gray@hw.ac.uk<mailto:A.J.G.Gray@hw.ac.uk><mailto:A.J.G.Gray@hw.ac.uk<mailto:A.J.G.Gray@hw.ac.uk>>
Web: MailScanner has detected a possible fraud attempt from "www.macs.hw.ac.uk<http://www.macs.hw.ac.uk>" claiming to be http://www.alasdairjggray.co.uk<http://www.macs.hw.ac.uk/~ajg33<http://www.macs.hw.ac.uk/%7Eajg33>>
ORCID: http://orcid.org/0000-0002-5711-4872
Telephone: +44 131 451 3429<tel:%2B44%20131%20451%203429><tel:%2B44%20131%20451%203429>
Twitter: @gray_alasdair






________________________________

Sunday Times Scottish University of the Year 2011-2013
Top in the UK for student experience
Fourth university in the UK and top in Scotland (National Student Survey 2012)

We invite research leaders and ambitious early career researchers to join us in leading and driving research in key inter-disciplinary themes. Please see www.hw.ac.uk/researchleaders<http://www.hw.ac.uk/researchleaders><http://www.hw.ac.uk/researchleaders> for further information and how to apply.

Heriot-Watt University is a Scottish charity registered under charity number SC000278.



--
Saludos, Labra

Alasdair J G Gray
Lecturer in Computer Science, Heriot-Watt University, UK.
Email: A.J.G.Gray@hw.ac.uk<mailto:A.J.G.Gray@hw.ac.uk><mailto:A.J.G.Gray@hw.ac.uk<mailto:A.J.G.Gray@hw.ac.uk>>
Web: MailScanner has detected a possible fraud attempt from "www.macs.hw.ac.uk<http://www.macs.hw.ac.uk>" claiming to be http://www.alasdairjggray.co.uk<http://www.macs.hw.ac.uk/~ajg33<http://www.macs.hw.ac.uk/%7Eajg33>>
ORCID: http://orcid.org/0000-0002-5711-4872
Telephone: +44 131 451 3429<tel:%2B44%20131%20451%203429>
Twitter: @gray_alasdair






________________________________

Sunday Times Scottish University of the Year 2011-2013
Top in the UK for student experience
Fourth university in the UK and top in Scotland (National Student Survey 2012)

We invite research leaders and ambitious early career researchers to join us in leading and driving research in key inter-disciplinary themes. Please see www.hw.ac.uk/researchleaders<http://www.hw.ac.uk/researchleaders> for further information and how to apply.

Heriot-Watt University is a Scottish charity registered under charity number SC000278.

Received on Tuesday, 27 May 2014 16:01:38 UTC