This is an automated email from the ASF dual-hosted git repository.

andy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/jena.git

commit bd36e356d29c012dc2580fb84627f953ef2dc84f
Author: Ali Ariff <[email protected]>
AuthorDate: Tue Feb 18 22:05:50 2025 +0100

    GH-3018: Report the offending object in UniqueLangConstraint
---
 .../org/apache/jena/shacl/engine/constraint/UniqueLangConstraint.java  | 2 +-
 jena-shacl/src/test/files/std/core/property/uniqueLang-001.ttl         | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/jena-shacl/src/main/java/org/apache/jena/shacl/engine/constraint/UniqueLangConstraint.java
 
b/jena-shacl/src/main/java/org/apache/jena/shacl/engine/constraint/UniqueLangConstraint.java
index 4ccaed47c0..70c31d60bd 100644
--- 
a/jena-shacl/src/main/java/org/apache/jena/shacl/engine/constraint/UniqueLangConstraint.java
+++ 
b/jena-shacl/src/main/java/org/apache/jena/shacl/engine/constraint/UniqueLangConstraint.java
@@ -78,7 +78,7 @@ public class UniqueLangConstraint implements Constraint {
                     String msg = toString()+" Duplicate langtag: 
"+obj.getLiteralLanguage();
                     vCxt.notifyValidationListener(() -> new 
ConstraintEvaluatedOnSinglePathNodeEvent(vCxt, shape,  focusNode, this, path, 
obj,
                                     false));
-                    vCxt.reportEntry(msg, shape, focusNode, path, null, this);
+                    vCxt.reportEntry(msg, shape, focusNode, path, obj, this);
                     results.add(tag);
                 }
                 seen.add(tag);
diff --git a/jena-shacl/src/test/files/std/core/property/uniqueLang-001.ttl 
b/jena-shacl/src/test/files/std/core/property/uniqueLang-001.ttl
index 9014c7fa11..6482bbb1aa 100644
--- a/jena-shacl/src/test/files/std/core/property/uniqueLang-001.ttl
+++ b/jena-shacl/src/test/files/std/core/property/uniqueLang-001.ttl
@@ -64,6 +64,7 @@ ex:ValidInstance1
           sh:resultSeverity sh:Violation ;
           sh:sourceConstraintComponent sh:UniqueLangConstraintComponent ;
           sh:sourceShape ex:TestShape-testProperty ;
+          sh:value "Myself"@en ;
         ] ;
       sh:result [
           rdf:type sh:ValidationResult ;
@@ -72,6 +73,7 @@ ex:ValidInstance1
           sh:resultSeverity sh:Violation ;
           sh:sourceConstraintComponent sh:UniqueLangConstraintComponent ;
           sh:sourceShape ex:TestShape-testProperty ;
+          sh:value "I"@en ;
         ] ;
       sh:result [
           rdf:type sh:ValidationResult ;
@@ -80,6 +82,7 @@ ex:ValidInstance1
           sh:resultSeverity sh:Violation ;
           sh:sourceConstraintComponent sh:UniqueLangConstraintComponent ;
           sh:sourceShape ex:TestShape-testProperty ;
+          sh:value "Ich"@de ;
         ] ;
     ] ;
   mf:status sht:approved ;

Reply via email to