Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-2315

SHACL: bug in execution of SPARQL validation for a specified focusNode via validation API

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Jena 4.4.0
    • Jena 4.5.0
    • SHACL
    • None
    • Patch

    Description

      Description:

      While running validation focused on single explicit focus node.  It seems that due to the missing return statement validation will never be effective at all.

      Reproduction:

      While running validation focused on single resource node. E.g. by calling:

      ```

      new ShaclPlainValidator().validate(shapes, data, node);

      ```

      Example data:

      ```

      <someResource>
           a <someClass> ;
          <someunknownProperty> <someUnimportantValue> ;
      .

      ```

      Example shape:

      ```

      <propertyShape
          a              sh:NodeShape ;
          sh:severity    sh:Warning ;
          sh:target [
                        a sh:SPARQLTarget ;   
                        sh:select """
                              SELECT DISTINCT ?node
                              WHERE

      {                             ?node a ?class .                         }

                              """ ;
                    ] ;   
          sh:sparql      [ sh:message "Resource {$this} has unknown property {$path}" ;
                           sh:select """
                                  SELECT DISTINCT $this ?path
                                  WHERE {
                                      $this ?path ?value .
                                      $this a ?class .
                                      FILTER NOT EXISTS

      {                                      ?path <http://www.w3.org/2000/01/rdf-schema#domain> ?class                                 }

                                  }
                              """ ] ;
      .

      ```

      Attachments

        Issue Links

          Activity

            People

              andy Andy Seaborne
              jak_ub Jakub Wach
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: