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

Added zero cardinality constraint rules #317

Merged
merged 1 commit into from
Sep 26, 2020
Merged
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
11 changes: 9 additions & 2 deletions modules/slang/src/main/scala/es/weso/slang/SLang2Clingo.scala
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,16 @@ trait SLang2Clingo {
| node(X), pred(P), shape(S),
| #count { V: arcWithShape(X,P,S,V) } = T .
|
|countPropShape(X,P,S,0):-
| node(X),
| pred(P),
| shape(S),
| not arcWithShape(X,P,S,_).
|
|% #show arcWithShape/4 .
|arcWithShape(X,P,S,V):-arc(X,P,V),hasShape(V,S).
|
|node(X):-shapeMap(X,_).
|node(X):-arc(X,_,_).
|node(X):-arc(_,_,X).
|pred(P):-arc(_,P,_).
Expand All @@ -179,7 +186,7 @@ trait SLang2Clingo {
private def ground(node: RDFNode,
label: Label,
rdf: RDFReader,
schema: SchemaS): IO[Program] =
schema: SchemaS): IO[Program] =
for {
shape <- schema.getLabel(label).fold(
IO.raiseError[SLang](new RuntimeException(s"Label $label not found in Schema. Available labels: ${schema.availableLabels.mkString(",")}"))
Expand Down Expand Up @@ -277,7 +284,7 @@ trait SLang2Clingo {

private def getPred(pp: PropPath): IRI = pp match {
case Pred(iri) => iri
case _ =>
case _ =>
throw new Exception(s"Unsupported $pp yet")
}

Expand Down