public class SHACLUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static org.apache.jena.rdf.model.Resource[] |
RESULT_TYPES |
static String |
SHAPES_FILE_PART |
static String |
URN_X_SHACL |
| Constructor and Description |
|---|
SHACLUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
addDirectPropertiesOfClass(org.apache.jena.rdf.model.Resource cls,
Collection<org.apache.jena.rdf.model.Property> results) |
static void |
addNodesInTarget(org.apache.jena.rdf.model.Resource target,
org.apache.jena.query.Dataset dataset,
Set<org.apache.jena.graph.Node> results)
Adds all resources from a given sh:target to a given results Set of Nodes.
|
static org.apache.jena.rdf.model.Model |
createDefaultValueTypesModel(org.apache.jena.rdf.model.Model model)
Runs the rule to infer missing rdf:type triples for certain blank nodes.
|
static org.apache.jena.rdf.model.Model |
createIncludesModel(org.apache.jena.rdf.model.Model model,
String graphURI)
Creates an includes Model for a given input Model.
|
static URI |
createRandomShapesGraphURI() |
static boolean |
exists(org.apache.jena.graph.Graph graph) |
static boolean |
exists(org.apache.jena.rdf.model.Model model)
Checks whether the SHACL vocabulary is present in a given Model.
|
static Set<org.apache.jena.graph.Node> |
getAllFocusNodes(org.apache.jena.query.Dataset dataset,
boolean validateShapes)
Gets all focus nodes from the default Model of a given dataset.
|
static List<org.apache.jena.rdf.model.Property> |
getAllPropertiesOfClass(org.apache.jena.rdf.model.Resource cls)
Gets all the predicates of all declared sh:properties and sh:parameters
of a given class, including inherited ones.
|
static List<SHNodeShape> |
getAllShapesAtClassOrShape(org.apache.jena.rdf.model.Resource clsOrShape)
Gets all sh:Shapes that have a given class in their target, including ConstraintComponents
and the class or shape itself if it is marked as sh:Shape.
|
static List<SHNodeShape> |
getAllShapesAtNode(org.apache.jena.rdf.model.RDFNode node)
Gets all shapes associated with a given focus node.
|
static List<SHNodeShape> |
getAllShapesAtNode(org.apache.jena.rdf.model.RDFNode node,
Iterable<org.apache.jena.rdf.model.Resource> types) |
static Set<org.apache.jena.rdf.model.Resource> |
getAllSuperClassesAndShapesStar(org.apache.jena.rdf.model.Resource cls)
Gets all (transitive) superclasses including shapes that reference a class via sh:targetClass.
|
static List<SHResult> |
getAllTopLevelResults(org.apache.jena.rdf.model.Model model) |
static SHConstraintComponent |
getConstraintComponentOfValidator(org.apache.jena.rdf.model.Resource validator) |
static org.apache.jena.rdf.model.Resource |
getDefaultTypeForConstraintPredicate(org.apache.jena.rdf.model.Property predicate) |
static Collection<SHNodeShape> |
getDirectShapesAtClassOrShape(org.apache.jena.rdf.model.Resource clsOrShape)
Gets the directly associated sh:Shapes that have a given class in their target,
including ConstraintComponents and the class or shape itself if it is marked as sh:Shape.
|
static String |
getLocalPropertyLabel(org.apache.jena.rdf.model.Resource property,
org.apache.jena.rdf.model.Resource context)
Gets any locally-defined label for a given property.
|
static SHParameter |
getParameterAtClass(org.apache.jena.rdf.model.Resource cls,
org.apache.jena.rdf.model.Property predicate) |
static SHParameter |
getParameterAtInstance(org.apache.jena.rdf.model.Resource instance,
org.apache.jena.rdf.model.Property predicate) |
static SHPropertyShape |
getPropertyConstraintAtClass(org.apache.jena.rdf.model.Resource cls,
org.apache.jena.rdf.model.Property predicate) |
static SHPropertyShape |
getPropertyConstraintAtInstance(org.apache.jena.rdf.model.Resource instance,
org.apache.jena.rdf.model.Property predicate) |
static org.apache.jena.rdf.model.Resource |
getResourceDefaultType(org.apache.jena.rdf.model.Resource resource) |
static Iterable<org.apache.jena.rdf.model.RDFNode> |
getResourcesInTarget(org.apache.jena.rdf.model.Resource target,
org.apache.jena.query.Dataset dataset)
Gets all nodes from a given sh:target.
|
static List<org.apache.jena.rdf.model.RDFNode> |
getTargetNodes(org.apache.jena.rdf.model.Resource shape,
org.apache.jena.query.Dataset dataset) |
static List<org.apache.jena.rdf.model.Resource> |
getTypes(org.apache.jena.rdf.model.Resource subject) |
static boolean |
hasMinSeverity(org.apache.jena.rdf.model.Resource severity,
org.apache.jena.rdf.model.Resource minSeverity) |
static boolean |
isClassWithDefaultType(org.apache.jena.rdf.model.Resource cls) |
static boolean |
isInTarget(org.apache.jena.rdf.model.RDFNode focusNode,
org.apache.jena.query.Dataset dataset,
org.apache.jena.rdf.model.Resource target) |
static boolean |
isParameterAtInstance(org.apache.jena.rdf.model.Resource subject,
org.apache.jena.rdf.model.Property predicate) |
static boolean |
isSPARQLProperty(org.apache.jena.rdf.model.Property property) |
static org.apache.jena.graph.Node |
walkPropertyShapesHelper(org.apache.jena.graph.Node propertyShape,
org.apache.jena.graph.Graph graph) |
static org.apache.jena.rdf.model.Model |
withDefaultValueTypeInferences(org.apache.jena.rdf.model.Model model) |
static URI |
withShapesGraph(org.apache.jena.query.Dataset dataset) |
public static final org.apache.jena.rdf.model.Resource[] RESULT_TYPES
public static final String SHAPES_FILE_PART
public static final String URN_X_SHACL
public static void addDirectPropertiesOfClass(org.apache.jena.rdf.model.Resource cls,
Collection<org.apache.jena.rdf.model.Property> results)
public static void addNodesInTarget(org.apache.jena.rdf.model.Resource target,
org.apache.jena.query.Dataset dataset,
Set<org.apache.jena.graph.Node> results)
target - the value of sh:target (parameterized or SPARQL target)dataset - the dataset to operate onresults - the Set to add the resulting Nodes topublic static org.apache.jena.rdf.model.Model createIncludesModel(org.apache.jena.rdf.model.Model model,
String graphURI)
model - the Model to create the includes Model forgraphURI - the URI of the named graph represented by Modelpublic static URI createRandomShapesGraphURI()
public static Set<org.apache.jena.graph.Node> getAllFocusNodes(org.apache.jena.query.Dataset dataset, boolean validateShapes)
dataset - the DatasetvalidateShapes - true to include the validation of constraint componentspublic static List<SHResult> getAllTopLevelResults(org.apache.jena.rdf.model.Model model)
public static Set<org.apache.jena.rdf.model.Resource> getAllSuperClassesAndShapesStar(org.apache.jena.rdf.model.Resource cls)
cls - the class to start atpublic static SHConstraintComponent getConstraintComponentOfValidator(org.apache.jena.rdf.model.Resource validator)
public static org.apache.jena.rdf.model.Resource getDefaultTypeForConstraintPredicate(org.apache.jena.rdf.model.Property predicate)
public static SHParameter getParameterAtClass(org.apache.jena.rdf.model.Resource cls, org.apache.jena.rdf.model.Property predicate)
public static SHParameter getParameterAtInstance(org.apache.jena.rdf.model.Resource instance, org.apache.jena.rdf.model.Property predicate)
public static org.apache.jena.rdf.model.Resource getResourceDefaultType(org.apache.jena.rdf.model.Resource resource)
public static String getLocalPropertyLabel(org.apache.jena.rdf.model.Resource property, org.apache.jena.rdf.model.Resource context)
property - the property to get the label ofcontext - the context instancepublic static SHPropertyShape getPropertyConstraintAtClass(org.apache.jena.rdf.model.Resource cls, org.apache.jena.rdf.model.Property predicate)
public static SHPropertyShape getPropertyConstraintAtInstance(org.apache.jena.rdf.model.Resource instance, org.apache.jena.rdf.model.Property predicate)
public static List<org.apache.jena.rdf.model.Property> getAllPropertiesOfClass(org.apache.jena.rdf.model.Resource cls)
cls - the class to get the predicates ofpublic static Iterable<org.apache.jena.rdf.model.RDFNode> getResourcesInTarget(org.apache.jena.rdf.model.Resource target, org.apache.jena.query.Dataset dataset)
target - the value of sh:target (parameterizable or SPARQL target)dataset - the dataset to operate onpublic static List<SHNodeShape> getAllShapesAtNode(org.apache.jena.rdf.model.RDFNode node)
node - the (focus) nodepublic static List<SHNodeShape> getAllShapesAtNode(org.apache.jena.rdf.model.RDFNode node, Iterable<org.apache.jena.rdf.model.Resource> types)
public static List<SHNodeShape> getAllShapesAtClassOrShape(org.apache.jena.rdf.model.Resource clsOrShape)
clsOrShape - the class or Shape to get the shapes ofpublic static Collection<SHNodeShape> getDirectShapesAtClassOrShape(org.apache.jena.rdf.model.Resource clsOrShape)
clsOrShape - the class or Shape to get the shapes ofpublic static List<org.apache.jena.rdf.model.RDFNode> getTargetNodes(org.apache.jena.rdf.model.Resource shape, org.apache.jena.query.Dataset dataset)
public static List<org.apache.jena.rdf.model.Resource> getTypes(org.apache.jena.rdf.model.Resource subject)
public static boolean hasMinSeverity(org.apache.jena.rdf.model.Resource severity,
org.apache.jena.rdf.model.Resource minSeverity)
public static boolean isClassWithDefaultType(org.apache.jena.rdf.model.Resource cls)
public static boolean isParameterAtInstance(org.apache.jena.rdf.model.Resource subject,
org.apache.jena.rdf.model.Property predicate)
public static boolean isSPARQLProperty(org.apache.jena.rdf.model.Property property)
public static boolean exists(org.apache.jena.rdf.model.Model model)
model - the Model to checkpublic static boolean exists(org.apache.jena.graph.Graph graph)
public static org.apache.jena.rdf.model.Model withDefaultValueTypeInferences(org.apache.jena.rdf.model.Model model)
public static URI withShapesGraph(org.apache.jena.query.Dataset dataset)
public static boolean isInTarget(org.apache.jena.rdf.model.RDFNode focusNode,
org.apache.jena.query.Dataset dataset,
org.apache.jena.rdf.model.Resource target)
public static org.apache.jena.rdf.model.Model createDefaultValueTypesModel(org.apache.jena.rdf.model.Model model)
model - the input Modelpublic static org.apache.jena.graph.Node walkPropertyShapesHelper(org.apache.jena.graph.Node propertyShape,
org.apache.jena.graph.Graph graph)
Copyright © 2019 TopQuadrant, Inc.. All rights reserved.