Skip to content

Commit 94a925d

Browse files
committed
Fix formatting and remove unused imports
1 parent f241939 commit 94a925d

File tree

69 files changed

+245
-140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+245
-140
lines changed

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/constraint/AllowedLanguagesConstraint.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,18 @@
1616
import java.util.List;
1717

1818
import org.apache.jena.rdf.model.RDFNode;
19+
1920
import org.eclipse.esmf.aspectmodel.shacl.Shape;
2021
import org.eclipse.esmf.aspectmodel.shacl.violation.EvaluationContext;
2122
import org.eclipse.esmf.aspectmodel.shacl.violation.LanguageFromListViolation;
2223
import org.eclipse.esmf.aspectmodel.shacl.violation.Violation;
2324

2425
/**
2526
* Implements <a href="https://www.w3.org/TR/shacl/#LanguageInConstraintComponent">sh:languageIn</a>
27+
*
2628
* @param allowedLanguages the list of allowed language tags
2729
*/
28-
public record AllowedLanguagesConstraint(List<String> allowedLanguages) implements Constraint {
30+
public record AllowedLanguagesConstraint( List<String> allowedLanguages ) implements Constraint {
2931
@Override
3032
public List<Violation> apply( final RDFNode rdfNode, final EvaluationContext context ) {
3133
final List<Violation> nodeKindViolations = new NodeKindConstraint( Shape.NodeKind.Literal ).apply( rdfNode, context );

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/constraint/AllowedValuesConstraint.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@
1616
import java.util.List;
1717

1818
import org.apache.jena.rdf.model.RDFNode;
19+
1920
import org.eclipse.esmf.aspectmodel.shacl.violation.EvaluationContext;
2021
import org.eclipse.esmf.aspectmodel.shacl.violation.ValueFromListViolation;
2122
import org.eclipse.esmf.aspectmodel.shacl.violation.Violation;
2223

2324
/**
2425
* Implements <a href="https://www.w3.org/TR/shacl/#InConstraintComponent">sh:in</a> *
26+
*
2527
* @param allowedValues the list of allowed values
2628
*/
27-
public record AllowedValuesConstraint(List<RDFNode> allowedValues) implements Constraint {
29+
public record AllowedValuesConstraint( List<RDFNode> allowedValues ) implements Constraint {
2830
@Override
2931
public List<Violation> apply( final RDFNode rdfNode, final EvaluationContext context ) {
3032
return allowedValues.contains( rdfNode ) ?

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/constraint/AndConstraint.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,14 @@
1717
import java.util.stream.Collectors;
1818

1919
import org.apache.jena.rdf.model.RDFNode;
20+
2021
import org.eclipse.esmf.aspectmodel.shacl.violation.EvaluationContext;
2122
import org.eclipse.esmf.aspectmodel.shacl.violation.Violation;
2223

2324
/**
2425
* Implements <a href="https://www.w3.org/TR/shacl/#AndConstraintComponent">sh:and</a>
2526
*/
26-
public record AndConstraint(List<Constraint> constraints) implements Constraint {
27+
public record AndConstraint( List<Constraint> constraints ) implements Constraint {
2728
@Override
2829
public List<Violation> apply( final RDFNode rdfNode, final EvaluationContext context ) {
2930
return constraints().stream().flatMap( constraint -> constraint.apply( rdfNode, context ).stream() ).collect( Collectors.toList() );

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/constraint/ClassConstraint.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import org.apache.jena.rdf.model.Statement;
2121
import org.apache.jena.rdf.model.StmtIterator;
2222
import org.apache.jena.vocabulary.RDF;
23+
2324
import org.eclipse.esmf.aspectmodel.shacl.RdfTypes;
2425
import org.eclipse.esmf.aspectmodel.shacl.Shape;
2526
import org.eclipse.esmf.aspectmodel.shacl.violation.ClassTypeViolation;
@@ -30,9 +31,10 @@
3031

3132
/**
3233
* Implements <a href="https://www.w3.org/TR/shacl/#ClassConstraintComponent">sh:class</a>
34+
*
3335
* @param allowedClass the allowed class
3436
*/
35-
public record ClassConstraint(Resource allowedClass) implements Constraint {
37+
public record ClassConstraint( Resource allowedClass ) implements Constraint {
3638
@Override
3739
public List<Violation> apply( final RDFNode rdfNode, final EvaluationContext context ) {
3840
if ( !rdfNode.isResource() ) {
@@ -41,13 +43,15 @@ public List<Violation> apply( final RDFNode rdfNode, final EvaluationContext con
4143
final Resource resource = rdfNode.asResource();
4244
final StmtIterator iterator = context.resolvedModel().listStatements( resource, RDF.type, (RDFNode) null );
4345
if ( !iterator.hasNext() ) {
44-
return List.of( new MissingTypeViolation( context.withElement( resource ).withProperty( RDF.type ).withOffendingStatements( List.of() ) ) );
46+
return List.of(
47+
new MissingTypeViolation( context.withElement( resource ).withProperty( RDF.type ).withOffendingStatements( List.of() ) ) );
4548
}
4649
final Statement typeAssertionStatement = iterator.next();
4750
final RDFNode assertedTypeNode = typeAssertionStatement.getObject();
4851
if ( !assertedTypeNode.isResource() ) {
4952
return List.of(
50-
new NodeKindViolation( context.withElement( resource ).withProperty( RDF.type ).withOffendingStatements( List.of( typeAssertionStatement ) ),
53+
new NodeKindViolation(
54+
context.withElement( resource ).withProperty( RDF.type ).withOffendingStatements( List.of( typeAssertionStatement ) ),
5155
Shape.NodeKind.BlankNodeOrIRI,
5256
Shape.NodeKind.forNode( rdfNode ) ) );
5357
}

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/constraint/ClosedConstraint.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,20 @@
2121
import org.apache.jena.rdf.model.RDFNode;
2222
import org.apache.jena.rdf.model.Resource;
2323
import org.apache.jena.rdf.model.Statement;
24+
2425
import org.eclipse.esmf.aspectmodel.shacl.Shape;
2526
import org.eclipse.esmf.aspectmodel.shacl.path.FirstEffectiveProperty;
26-
import org.eclipse.esmf.aspectmodel.shacl.path.PathNodeRetriever;
2727
import org.eclipse.esmf.aspectmodel.shacl.violation.ClosedViolation;
2828
import org.eclipse.esmf.aspectmodel.shacl.violation.EvaluationContext;
2929
import org.eclipse.esmf.aspectmodel.shacl.violation.NodeKindViolation;
3030
import org.eclipse.esmf.aspectmodel.shacl.violation.Violation;
3131

3232
/**
3333
* Implements <a href="https://www.w3.org/TR/shacl/#ClosedConstraintComponent">sh:closed</a>
34+
*
3435
* @param ignoredProperties allowed ignored properties
3536
*/
36-
public record ClosedConstraint(Set<Property> ignoredProperties) implements Constraint {
37+
public record ClosedConstraint( Set<Property> ignoredProperties ) implements Constraint {
3738
@Override
3839
public List<Violation> apply( final RDFNode rdfNode, final EvaluationContext context ) {
3940
if ( !rdfNode.isResource() ) {
@@ -46,7 +47,9 @@ public List<Violation> apply( final RDFNode rdfNode, final EvaluationContext con
4647
final Resource resource = rdfNode.asResource();
4748
final FirstEffectiveProperty allowedFirstProperties = new FirstEffectiveProperty();
4849
final Set<Property> allowedProperties = shapeNode.properties().stream()
49-
.flatMap( property -> property.path().accept( resource, allowedFirstProperties ).stream() ).collect( Collectors.toSet() );
50+
.flatMap( property -> property.path().accept( resource, allowedFirstProperties ).stream() )
51+
.filter( property -> !ignoredProperties.contains( property ) )
52+
.collect( Collectors.toSet() );
5053

5154
return resource.getModel().listStatements( resource, null, (RDFNode) null )
5255
.mapWith( Statement::getPredicate )

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/constraint/Constraint.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
import java.util.List;
1717
import java.util.function.BiFunction;
1818

19-
import org.apache.jena.rdf.model.RDFNode;
2019
import org.eclipse.esmf.aspectmodel.shacl.violation.EvaluationContext;
2120
import org.eclipse.esmf.aspectmodel.shacl.violation.Violation;
2221

22+
import org.apache.jena.rdf.model.RDFNode;
2323
/**
2424
* Represents a SHACL constraint component as a function that takes the <a href="https://www.w3.org/TR/shacl/#value-nodes">value node</a> as input
2525
* and returns a (possibly empty) list of violations.

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/constraint/DatatypeConstraint.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import org.apache.jena.rdf.model.Literal;
1919
import org.apache.jena.rdf.model.RDFNode;
20+
2021
import org.eclipse.esmf.aspectmodel.shacl.Shape;
2122
import org.eclipse.esmf.aspectmodel.shacl.violation.DatatypeViolation;
2223
import org.eclipse.esmf.aspectmodel.shacl.violation.EvaluationContext;
@@ -25,9 +26,10 @@
2526

2627
/**
2728
* Implements <a href="https://www.w3.org/TR/shacl/#DatatypeConstraintComponent">sh:datatype</a>
29+
*
2830
* @param allowedTypeUri the allowed data type URI
2931
*/
30-
public record DatatypeConstraint(String allowedTypeUri) implements Constraint {
32+
public record DatatypeConstraint( String allowedTypeUri ) implements Constraint {
3133
@Override
3234
public List<Violation> apply( final RDFNode rdfNode, final EvaluationContext context ) {
3335
if ( !rdfNode.isLiteral() ) {

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/constraint/DisjointConstraint.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@
1717

1818
import org.apache.jena.rdf.model.Property;
1919
import org.apache.jena.rdf.model.RDFNode;
20+
2021
import org.eclipse.esmf.aspectmodel.shacl.violation.DisjointViolation;
2122
import org.eclipse.esmf.aspectmodel.shacl.violation.EvaluationContext;
2223
import org.eclipse.esmf.aspectmodel.shacl.violation.Violation;
2324

2425
/**
2526
* Implements <a href="https://www.w3.org/TR/shacl/#DisjointConstraintComponent">sh:disjoint</a>
27+
*
2628
* @param otherProperty the property of which the value must not match the given property value
2729
*/
28-
public record DisjointConstraint(Property otherProperty) implements Constraint {
30+
public record DisjointConstraint( Property otherProperty ) implements Constraint {
2931
@Override
3032
public boolean canBeUsedOnNodeShapes() {
3133
return false;

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/constraint/EqualsConstraint.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,17 @@
1717

1818
import org.apache.jena.rdf.model.Property;
1919
import org.apache.jena.rdf.model.RDFNode;
20+
2021
import org.eclipse.esmf.aspectmodel.shacl.violation.EqualsViolation;
2122
import org.eclipse.esmf.aspectmodel.shacl.violation.EvaluationContext;
2223
import org.eclipse.esmf.aspectmodel.shacl.violation.Violation;
2324

2425
/**
2526
* Implements <a href="https://www.w3.org/TR/shacl/#EqualsConstraintComponent">sh:equals</a>
27+
*
2628
* @param otherProperty this value nodes' value must be less than otherProperty's value
2729
*/
28-
public record EqualsConstraint(Property otherProperty) implements Constraint {
30+
public record EqualsConstraint( Property otherProperty ) implements Constraint {
2931
@Override
3032
public boolean canBeUsedOnNodeShapes() {
3133
return false;

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/constraint/HasValueConstraint.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,17 @@
1616
import java.util.List;
1717

1818
import org.apache.jena.rdf.model.RDFNode;
19+
1920
import org.eclipse.esmf.aspectmodel.shacl.violation.EvaluationContext;
2021
import org.eclipse.esmf.aspectmodel.shacl.violation.InvalidValueViolation;
2122
import org.eclipse.esmf.aspectmodel.shacl.violation.Violation;
2223

2324
/**
2425
* Implements <a href="https://www.w3.org/TR/shacl/#HasValueConstraintComponent">sh:hasValue</a>
26+
*
2527
* @param allowedValue the allowed value
2628
*/
27-
public record HasValueConstraint(RDFNode allowedValue) implements Constraint {
29+
public record HasValueConstraint( RDFNode allowedValue ) implements Constraint {
2830
@Override
2931
public List<Violation> apply( final RDFNode rdfNode, final EvaluationContext context ) {
3032
return rdfNode.equals( allowedValue ) ?

0 commit comments

Comments
 (0)