Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-1574 better target node support #2020

Merged
merged 5 commits into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ public int hashCode() {
public String toString() {
return "AndPropertyShape{" +
"and=" + toString(and) +
", id=" + id +
'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,8 @@ public String toString() {
return "ClassPropertyShape{" +
"classResource=" + classResource +
", path=" + getPath() +
", id=" + id +

'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public String toString() {
return "DatatypePropertyShape{" +
"datatype=" + datatype +
", path=" + getPath() +
", id=" + id +

'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public String toString() {
return "InPropertyShape{" +
"in=" + Arrays.toString(in.toArray()) +
", path=" + getPath() +
", id=" + id +

'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public String toString() {
return "LanguageInPropertyShape{" +
"languageIn=" + Arrays.toString(languageIn.toArray()) +
", path=" + getPath() +
", id=" + id +

'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ public String toString() {
return "MaxCountPropertyShape{" +
"maxCount=" + maxCount +
", path=" + getPath() +
", id=" + id +

'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public String toString() {
return "MaxExclusivePropertyShape{" +
"maxExclusive=" + maxExclusive +
", path=" + getPath() +
", id=" + id +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public String toString() {
return "MaxInclusivePropertyShape{" +
"maxInclusive=" + maxInclusive +
", path=" + getPath() +
", id=" + id +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public String toString() {
return "MaxLengthPropertyShape{" +
"maxLength=" + maxLength +
", path=" + getPath() +
", id=" + id +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ public String toString() {
return "MinCountPropertyShape{" +
"minCount=" + minCount +
", path=" + getPath() +
", id=" + id +
'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public String toString() {
return "MinExclusivePropertyShape{" +
"minExclusive=" + minExclusive +
", path=" + getPath() +
", id=" + id +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public String toString() {
return "MinInclusivePropertyShape{" +
"minInclusive=" + minInclusive +
", path=" + getPath() +
", id=" + id +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public String toString() {
return "MinLengthPropertyShape{" +
"minLength=" + minLength +
", path=" + getPath() +
", id=" + id +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public String toString() {
return "NodeKindPropertyShape{" +
"nodeKind=" + nodeKind +
", path=" + getPath() +
", id=" + id +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*/
public class NodeShape implements PlanGenerator, RequiresEvalutation, QueryGenerator {

private Resource id;
final Resource id;

private List<PathPropertyShape> propertyShapes = Collections.emptyList();
private List<PathPropertyShape> nodeShapes = Collections.emptyList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ public int hashCode() {
public String toString() {
return "NotPropertyShape{" +
"orPropertyShape=" + orPropertyShape +
", id=" + id +
'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ public int hashCode() {
public String toString() {
return "OrPropertyShape{" +
"or=" + toString(or) +
", id=" + id +
'}';
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public String toString() {
"pattern='" + pattern + '\'' +
", flags='" + flags + '\'' +
", path=" + getPath() +
", id=" + id +
'}';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
public abstract class PropertyShape implements PlanGenerator, RequiresEvalutation {

final boolean deactivated;
private Resource id;
final Resource id;

NodeShape nodeShape;
PathPropertyShape parent;
Expand Down Expand Up @@ -98,7 +98,7 @@ public String getPlanAsGraphvizDot(PlanNode planNode, ConnectionsGroup connectio
stringBuilder.append("labelloc=t;\nfontsize=30;\nlabel=\"" + this.getClass().getSimpleName() + "\";")
.append("\n");

stringBuilder.append(System.identityHashCode(connectionsGroup)
stringBuilder.append(System.identityHashCode(connectionsGroup.getBaseConnection())
+ " [label=\"Base sail\" nodeShape=pentagon fillcolor=lightblue style=filled];").append("\n");
stringBuilder
.append(System.identityHashCode(connectionsGroup.getPreviousStateConnection())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.eclipse.rdf4j.model.Statement;
import org.eclipse.rdf4j.model.Value;
import org.eclipse.rdf4j.model.vocabulary.SHACL;
import org.eclipse.rdf4j.query.algebra.evaluation.util.ValueComparator;
import org.eclipse.rdf4j.repository.sail.SailRepositoryConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -15,6 +16,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
import java.util.stream.Stream;

public class ShaclProperties {
Expand Down Expand Up @@ -48,14 +50,17 @@ public class ShaclProperties {
String flags = "";

Set<Resource> targetClass = new HashSet<>(0);
Set<Value> targetNode = new HashSet<>(0);
TreeSet<Value> targetNode = new TreeSet<>(new ValueComparator());
hmottestad marked this conversation as resolved.
Show resolved Hide resolved
Set<IRI> targetSubjectsOf = new HashSet<>(0);
Set<IRI> targetObjectsOf = new HashSet<>(0);

boolean deactivated = false;

boolean uniqueLang = false;

public ShaclProperties() {
}

public ShaclProperties(Resource propertyShapeId, SailRepositoryConnection connection) {

try (Stream<Statement> stream = connection.getStatements(propertyShapeId, null, null).stream()) {
Expand Down Expand Up @@ -192,4 +197,103 @@ public ShaclProperties(Resource propertyShapeId, SailRepositoryConnection connec

}

public List<Resource> getClazz() {
return clazz;
}

public List<Resource> getOr() {
return or;
}

public List<Resource> getAnd() {
return and;
}

public List<Resource> getNot() {
return not;
}

public Long getMinCount() {
return minCount;
}

public Long getMaxCount() {
return maxCount;
}

public Resource getDatatype() {
return datatype;
}

public Resource getIn() {
return in;
}

public Long getMinLength() {
return minLength;
}

public Long getMaxLength() {
return maxLength;
}

public Resource getLanguageIn() {
return languageIn;
}

public Resource getNodeKind() {
return nodeKind;
}

public Resource getPath() {
return path;
}

public Literal getMinExclusive() {
return minExclusive;
}

public Literal getMaxExclusive() {
return maxExclusive;
}

public Literal getMinInclusive() {
return minInclusive;
}

public Literal getMaxInclusive() {
return maxInclusive;
}

public List<String> getPattern() {
return pattern;
}

public String getFlags() {
return flags;
}

public Set<Resource> getTargetClass() {
return targetClass;
}

public TreeSet<Value> getTargetNode() {
return targetNode;
}

public Set<IRI> getTargetSubjectsOf() {
return targetSubjectsOf;
}

public Set<IRI> getTargetObjectsOf() {
return targetObjectsOf;
}

public boolean isDeactivated() {
return deactivated;
}

public boolean isUniqueLang() {
return uniqueLang;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ public int hashCode() {
public String toString() {
return "TargetClass{" +
"targetClass=" + Arrays.asList(targetClass.toArray()) +
", id=" + id +
'}';
}
}
Loading