Skip to content

Commit 3d15840

Browse files
committed
Add missing JavaDoc
1 parent 2646af7 commit 3d15840

38 files changed

+308
-15
lines changed

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

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,45 @@
2020
import org.eclipse.esmf.aspectmodel.shacl.violation.Violation;
2121

2222
import org.apache.jena.rdf.model.RDFNode;
23+
2324
/**
24-
* 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
25-
* and returns a (possibly empty) list of violations.
26-
*
25+
* 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
26+
* input and returns a (possibly empty) list of violations.
27+
* <br/>
2728
* Not implemented: sh:qualifiedValueShape, sh:qualifiedMinCount, sh:qualifiedMaxCount
2829
*/
2930
public interface Constraint extends BiFunction<RDFNode, EvaluationContext, List<Violation>> {
31+
/**
32+
* Determines whether this constraint can be used on a node shape, as certain constraints (e.g., sh:minCount) can only be used on
33+
* property shapes.
34+
*
35+
* @return the allowed value
36+
*/
3037
default boolean canBeUsedOnNodeShapes() {
3138
return true;
3239
}
3340

41+
/**
42+
* The name of the constraint as given by sh:name
43+
*
44+
* @return the name
45+
*/
3446
String name();
3547

48+
/**
49+
* Visitor pattern for Constraints: Accept the constraint visitor
50+
*
51+
* @param visitor the visitor
52+
* @param <T> the visitor's result type
53+
* @return the value corresponding to the visitor
54+
*/
3655
<T> T accept( Visitor<T> visitor );
3756

57+
/**
58+
* The visitor interface for Constraints
59+
*
60+
* @param <T> the return type for the visitor
61+
*/
3862
interface Visitor<T> {
3963
T visit( Constraint constraint );
4064

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
import org.apache.jena.graph.Node;
1717

18+
/**
19+
* Represents a <a href="https://www.w3.org/TR/shacl-js/#js-api-bnode">SHACL JS BlankNode</a>.
20+
*/
1821
public class JsBlankNode extends JsTerm {
1922
public final String id;
2023

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import org.apache.jena.graph.Node;
1717
import org.apache.jena.graph.Triple;
1818

19+
/**
20+
* Utility class that translates between SHACL JS objects and their RDF representation
21+
*/
1922
public class JsFactory {
2023
public static JsTerm asJsTerm( final Node node ) {
2124
if ( node.isURI() ) {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import org.apache.jena.graph.Node;
1717
import org.apache.jena.graph.NodeFactory;
1818

19+
/**
20+
* Represents a <a href="https://www.w3.org/TR/shacl-js/#js-api-literals">SHACL JS Literal</a>
21+
*/
1922
public class JsLiteral extends JsTerm {
2023
public final String lex;
2124
public final String language;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
import org.apache.jena.graph.Node;
1717

18+
/**
19+
* Represents a <a href="https://www.w3.org/TR/shacl-js/#js-api-iri">SHACL JS Named Node</a>
20+
*/
1821
public class JsNamedNode extends JsTerm {
1922
public final String uri;
2023

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
import org.apache.jena.graph.Triple;
1717

18+
/**
19+
* Represents a <a href="https://www.w3.org/TR/shacl-js/#js-api-triples">SHACL JS Triple</a>
20+
*/
1821
public class JsTriple {
1922
private final Triple triple;
2023
public final JsTerm subject;

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/fix/Fix.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515

1616
import org.eclipse.esmf.aspectmodel.shacl.violation.EvaluationContext;
1717

18+
/**
19+
* A fix that can be applied to a violation to remove it
20+
*/
1821
public interface Fix {
1922
EvaluationContext context();
2023

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/violation/ClassTypeViolation.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,21 @@
1313

1414
package org.eclipse.esmf.aspectmodel.shacl.violation;
1515

16+
import org.eclipse.esmf.aspectmodel.shacl.constraint.ClassConstraint;
17+
1618
import org.apache.jena.rdf.model.Resource;
1719

20+
/**
21+
* Violation of a {@link ClassConstraint}
22+
*
23+
* @param context the evaluation context of this violation
24+
* @param allowedClass the allowed class
25+
* @param actualClass the actually encountered class
26+
*/
1827
public record ClassTypeViolation( EvaluationContext context, Resource allowedClass, Resource actualClass ) implements Violation {
28+
/**
29+
* The error code for this violation
30+
*/
1931
public static final String ERROR_CODE = "ERR_CLASS_TYPE";
2032

2133
@Override

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/violation/ClosedViolation.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,27 @@
1313

1414
package org.eclipse.esmf.aspectmodel.shacl.violation;
1515

16+
import java.util.List;
1617
import java.util.Set;
1718
import java.util.stream.Collectors;
18-
import java.util.stream.Stream;
19+
20+
import org.eclipse.esmf.aspectmodel.shacl.constraint.ClosedConstraint;
1921

2022
import org.apache.jena.rdf.model.Property;
2123

24+
/**
25+
* Violation of a {@link ClosedConstraint}
26+
*
27+
* @param context the evaluation context of this violation
28+
* @param allowedProperties the properties that are allowed on the value node
29+
* @param ignoredProperties the properties that were ignored in the validation
30+
* @param actual the actually encountered property
31+
*/
2232
public record ClosedViolation( EvaluationContext context, Set<Property> allowedProperties, Set<Property> ignoredProperties,
2333
Property actual ) implements Violation {
34+
/**
35+
* The error code for this violation
36+
*/
2437
public static final String ERROR_CODE = "ERR_CLOSED";
2538

2639
@Override

core/esmf-aspect-model-validator/src/main/java/org/eclipse/esmf/aspectmodel/shacl/violation/DatatypeViolation.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@
2727
import org.apache.jena.vocabulary.RDF;
2828
import org.apache.jena.vocabulary.XSD;
2929

30+
/**
31+
* Violation of a {@link DatatypeConstraint}
32+
*
33+
* @param context the evaluation context
34+
* @param allowedTypeUri the URI of the XSD or RDF class type that was allowed
35+
* @param actualTypeUri the URI that was encountered instead
36+
*/
3037
public record DatatypeViolation( EvaluationContext context, String allowedTypeUri, String actualTypeUri ) implements Violation {
3138
public static final String ERROR_CODE = "ERR_TYPE";
3239

0 commit comments

Comments
 (0)