Andy,

I was able to isolate a standalone example:
https://github.com/namedgraph/spinrdf-test

With 3.0.1 it succeeds. Change Jena version to 3.16.0-SNAPSHOT by
uncommenting the other <version> in pom.xml and it will fail:
https://github.com/namedgraph/spinrdf-test/blob/master/pom.xml#L28

I don't understand how or where spl:objectCount() and spl:instanceOf()
are executed, but i think it demonstrates clearly that some behaviour
has changed between those versions, even though SpinRDF code hasn't.

Will post on https://github.com/spinrdf/spinrdf/issues as well.


Martynas

On Wed, May 20, 2020 at 12:37 PM Martynas Jusevičius
<[email protected]> wrote:
>
> Hi,
>
> I've narrowed down the differences to the counts produced by
> spl:objectCount() SPIN function.
>
> SELECT  *
> WHERE
>   { ?this  a                     ?TYPE_CLASS
>       { BIND(<http://spinrdf.org/spl#objectCount>(?this, ?predicate)
> AS ?objCount)
>         FILTER ( bound(?minCount) && ( ?objCount < ?minCount ) )
>       }
>     UNION
>       { BIND(<http://spinrdf.org/spl#objectCount>(?this, ?predicate)
> AS ?objCount)
>         FILTER ( bound(?maxCount) && ( ?objCount > ?maxCount ) )
>       }
>     UNION
>       { FILTER bound(?valueType)
>         ?this  ?predicate  ?value
>         FILTER ( ! <http://spinrdf.org/spl#instanceOf>(?value, ?valueType) )
>       }
>   }
>
> Bindings: ( ?predicate, spin:body )( ?comment, "the body of the
> Template" )( ?minCount, 0 )( ?TYPE_CLASS, spin:Template )( ?maxCount,
> 1 )
>
> 3.15.0-SNAPSHOT
>
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> | this
>                                 | TYPE_CLASS                         |
> objCount | predicate                      | value |
> =================================================================================================================================================================================================
> | <http://spinrdf.org/spin#Templates>
>                                 | <http://spinrdf.org/spin#Template> |
> 2        | <http://spinrdf.org/spin#body> |       |
> | <http://spinrdf.org/spin#ConstructTemplates>
>                                 | <http://spinrdf.org/spin#Template> |
> 2        | <http://spinrdf.org/spin#body> |       |
> | 
> <https://github.com/AtomGraph/Processor/blob/develop/http-tests/custom#DefaultSubjectUpdateTemplate>
> | <http://spinrdf.org/spin#Template> | 2        |
> <http://spinrdf.org/spin#body> |       |
> | <http://spinrdf.org/spin#AskTemplates>
>                                 | <http://spinrdf.org/spin#Template> |
> 2        | <http://spinrdf.org/spin#body> |       |
> | 
> <https://github.com/AtomGraph/Processor/blob/develop/http-tests/custom#DefaultSubjectQueryTemplate>
>  | <http://spinrdf.org/spin#Template> | 2        |
> <http://spinrdf.org/spin#body> |       |
> | <http://spinrdf.org/spin#UpdateTemplates>
>                                 | <http://spinrdf.org/spin#Template> |
> 2        | <http://spinrdf.org/spin#body> |       |
> | <http://spinrdf.org/spl#Argument>
>                                 | <http://spinrdf.org/spin#Template> |
> 2        | <http://spinrdf.org/spin#body> |       |
> | <http://spinrdf.org/spin#SelectTemplates>
>                                 | <http://spinrdf.org/spin#Template> |
> 2        | <http://spinrdf.org/spin#body> |       |
> -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> 3.0.1
>
> ----------------------------------------------------
> | this | TYPE_CLASS | objCount | predicate | value |
> ====================================================
> ----------------------------------------------------
>
> I'll try to create an example now.
>
>
> On Tue, May 19, 2020 at 6:14 PM Andy Seaborne <[email protected]> wrote:
> >
> > That's a long jump.
> >
> > (and it's a SpinRDF question)
> >
> >  >> Are there some obvious suspects here or do I need to create a
> >  >> reproducible example?
> >
> > reproducible example (noting that the query has custom functions which
> > have names that suggest they are not proper "functions" (i.e. their
> > return is not a function of their arguments alone and they access the
> > data graph .. which might be a query).
> >
> > I can't see why it might now have answers when it didn't before.
> >
> >      Andy
> >
> > On 19/05/2020 13:04, Martynas Jusevičius wrote:
> > > With 3.0.1, no such internal *violations* are produced.
> > >
> > > On Tue, May 19, 2020 at 2:03 PM Martynas Jusevičius
> > > <[email protected]> wrote:
> > >>
> > >> Hi,
> > >>
> > >> After upgrading our code as well as SPINRDF from 3.0.1 to
> > >> 3.16.0-SNAPSHOT, some constraint violation-related tests are failing.
> > >>
> > >> With 3.16.0-SNAPSHOT, it seems that a bunch of constraint violations
> > >> are coming from the SPIN vocabulary iself, e.g. "Attribute spin:body :
> > >>   [0,1]" on spin:ConstructTemplates, spin:SelectTemplates etc.
> > >> With 3.0.1, no such internal validations are produced.
> > >>
> > >> The models being validated use a basic RDFS inference (subclassing etc.)
> > >>
> > >> I have tracked the source of the difference to query execution in
> > >> SPINConstraints.runQueryOnClass():
> > >> https://github.com/spinrdf/spinrdf/blob/master/src/main/java/org/spinrdf/constraints/SPINConstraints.java#L614
> > >>
> > >> Since SPINRDF code hasn't changed, only the Jena versions, could there
> > >> be differences in query execution? The specific query that produces
> > >> different results is this:
> > >>
> > >> CONSTRUCT
> > >>    {
> > >>      _:c0 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
> > >> <http://spinrdf.org/spin#ConstraintViolation> .
> > >>      _:c0 <http://spinrdf.org/spin#violationRoot> ?this .
> > >>      _:c0 <http://spinrdf.org/spin#violationPath> ?predicate .
> > >>    }
> > >> WHERE
> > >>    { ?this  a  ?TYPE_CLASS
> > >>        { FILTER ( bound(?minCount) && (
> > >> <http://spinrdf.org/spl#objectCount>(?this, ?predicate) < ?minCount )
> > >> ) }
> > >>      UNION
> > >>        { FILTER ( bound(?maxCount) && (
> > >> <http://spinrdf.org/spl#objectCount>(?this, ?predicate) > ?maxCount )
> > >> ) }
> > >>      UNION
> > >>        { FILTER bound(?valueType)
> > >>          ?this  ?predicate  ?value
> > >>          FILTER ( ! <http://spinrdf.org/spl#instanceOf>(?value, 
> > >> ?valueType) )
> > >>        }
> > >>    }
> > >>
> > >> The query string and initial bindings are the same with both versions,
> > >> for example:
> > >>
> > >> ( ?predicate, spin:body )( ?comment, "the body of the Template" )(
> > >> ?minCount, 0 )( ?TYPE_CLASS, spin:Template )( ?maxCount, 1 )
> > >>
> > >> Are there some obvious suspects here or do I need to create a
> > >> reproducible example?
> > >>
> > >> Thanks,
> > >>
> > >> Martynas

Reply via email to