Tests
test/Allgemein: pass
bindingscope Allgemein {
predicate String: [] ist Standort fuer Kostenstelle String: [].
predicate String: [] ist Pausenmodell fuer Kostenstelle String: [].
predicate String: [] ist Pausenmodell fuer Standort String: [].
predicate String: [] ist Pausenmodell fuer Angestellte in Kostenstelle String: [].
predicate String: [] ist Pausenmodell fuer Angestellte in Standort String: [].
predicate String: [] ist Pausenmodell fuer Angestellte.
predicate String: [] ist Pausenmodell generell.
fact "Karlsruhe" ist Standort fuer Kostenstelle "Einkauf".
fact "Karlsruhe" ist Standort fuer Kostenstelle "Entwicklung".
fact "Durchhausen" ist Standort fuer Kostenstelle "Schulung".
fact "Durchhausen" ist Standort fuer Kostenstelle "Fertigung".
fact "P4" ist Pausenmodell fuer Kostenstelle "Einkauf".
fact "P6" ist Pausenmodell fuer Angestellte in Kostenstelle "Schulung".
fact "P3" ist Pausenmodell fuer Angestellte in Standort "Karlsruhe".
fact "P1" ist Pausenmodell fuer Angestellte.
fact "P2" ist Pausenmodell generell.
rule String: p ist Pausenmodell fuer Angestellte in Kostenstelle "Einkauf" {
String: p ist Pausenmodell fuer Kostenstelle "Einkauf".
}
};(define (test/Allgemein _)
(define-predicate
((: x string?) ist (: α) generell)
(fact ("P2" 'Pausenmodell)))
(define-predicate
((: x string?) ist (: α) fuer (: β) (: y string?))
(fact ("Karlsruhe" 'Standort 'Kostenstelle "Einkauf"))
(fact ("Karlsruhe" 'Standort 'Kostenstelle "Entwicklung"))
(fact ("Durchhausen" 'Standort 'Kostenstelle "Schulung"))
(fact ("Durchhausen" 'Standort 'Kostenstelle "Fertigung"))
(fact ("P1" 'Pausenmodell 'Angestellte ""))
(fact ("P4" 'Pausenmodell 'Kostenstelle "Einkauf")))
(define-predicate
((: x string?) ist (: α) fuer (: β) in (: γ) (: y string?))
(fact ("P6" 'Pausenmodell 'Angestellte 'Kostenstelle "Schulung"))
(fact ("P3" 'Pausenmodell 'Angestellte 'Standort "Karlsruhe"))
(rule (x 'Pausenmodell 'Angestellte 'Kostenstelle "Einkauf")
|:-|
(ist-fuer° x 'Pausenmodell 'Kostenstelle "Einkauf")))
(⊦= '(("P6" Pausenmodell Angestellte Kostenstelle "Schulung")
("P3" Pausenmodell Angestellte Standort "Karlsruhe")
("P4" Pausenmodell Angestellte Kostenstelle "Einkauf"))
(°->list/ground (fresh° l (a b c d e) (ist-fuer-in° a b c d e)))))
((eta 0.028) (memory #(12582912 2306712 1048576)) (stdout "") (stderr ""))
test/genealogie: pass
bindingscope genealogie {
predicate String: [] ist Vater von String: [].
predicate String: [] ist Grossvater von String: [].
predicate String: [] ist Bruder von String: [].
predicate String: [] ist Cousin von String: [].
fact "Winfred" ist Vater von "Kurt".
fact "Winfred" ist Vater von "Klaus".
fact "Max" ist Vater von "Winfred".
fact "Max" ist Vater von "Willi".
fact "Emil" ist Vater von "Max".
fact "Willi" ist Vater von "Karl".
rule String: a ist Grossvater von String: c {
String: a ist Vater von String: b.
String: b ist Vater von String: c.
}
rule String: a ist Bruder von String: b {
String: papa ist Vater von String: a.
String: papa ist Vater von String: b.
}
rule String: a ist Cousin von String: b {
String: opa ist Grossvater von String: a.
String: opa ist Grossvater von String: b.
}
goal {
String: vater ist Vater von String: sohn.
show String: vater String: sohn.
fail.
}
goal {
"Emil" ist Vater von String: sohn.
show String: sohn.
fail.
}
goal {
String: grossvater ist Grossvater von String: enkel.
show String: grossvater String: enkel.
fail.
}
goal {
String: a ist Bruder von String: b.
show String: a String: b.
fail.
}
goal {
String: a ist Cousin von String: b.
show String: a String: b.
fail.
}
};(define (test/genealogie _)
(define-predicate
((: a string?) ist (: α) von (: c))
(fact ("Winfred" 'Vater "Kurt"))
(fact ("Winfred" 'Vater "Klaus"))
(fact ("Max" 'Vater "Winfred"))
(fact ("Max" 'Vater "Willi"))
(fact ("Emil" 'Vater "Max"))
(fact ("Willi" 'Vater "Karl"))
(rule (a 'Grossvater c)
(|:-| b)
(ist-von° a 'Vater b)
(ist-von° b 'Vater c))
(rule (a 'Bruder c)
(|:-| papa)
(ist-von° papa 'Vater a)
(ist-von° papa 'Vater c))
(rule (a 'Cousin c)
(|:-| opa)
(ist-von° opa 'Grossvater a)
(ist-von° opa 'Grossvater c)))
(⊦= '(("Winfred" Vater "Kurt")
("Winfred" Vater "Klaus")
("Max" Vater "Winfred")
("Max" Vater "Willi")
("Emil" Vater "Max")
("Willi" Vater "Karl")
("Kurt" Bruder "Kurt")
("Kurt" Bruder "Klaus")
("Max" Grossvater "Kurt")
("Max" Grossvater "Klaus")
("Klaus" Bruder "Kurt")
("Klaus" Bruder "Klaus")
("Max" Grossvater "Karl")
("Emil" Grossvater "Winfred")
("Emil" Grossvater "Willi")
("Winfred" Bruder "Winfred")
("Winfred" Bruder "Willi")
("Willi" Bruder "Winfred")
("Willi" Bruder "Willi")
("Max" Bruder "Max")
("Karl" Bruder "Karl")
("Kurt" Cousin "Kurt")
("Kurt" Cousin "Klaus")
("Kurt" Cousin "Karl")
("Klaus" Cousin "Kurt")
("Klaus" Cousin "Klaus")
("Klaus" Cousin "Karl")
("Karl" Cousin "Kurt")
("Karl" Cousin "Klaus")
("Karl" Cousin "Karl")
("Winfred" Cousin "Winfred")
("Winfred" Cousin "Willi")
("Willi" Cousin "Winfred")
("Willi" Cousin "Willi"))
(°->list/ground (fresh° l (a b c) (ist-von° a b c)))))
((eta 0.008) (memory #(12582912 2308488 1048576)) (stdout "") (stderr ""))
test/genealogie/refined: pass
(define (test/genealogie/refined _)
(define-knowledge
genealogie
(fact ((|:a| string?) ist Vater von (|:c| string?))
(text/plain
("Winfred" "Kurt")
("Winfred" "Klaus")
("Max" "Winfred")
("Max" "Willi")
("Emil" "Max")
("Willi" "Karl")))
(rule ((|:a| string) ist Grossvater von (|:c| string))
(|:-| (|:b| string))
(|:a| ist Vater von |:b|)
(|:b| ist Vater von |:c|)))
(⊦= '(("Winfred" "Kurt")
("Winfred" "Klaus")
("Max" "Winfred")
("Max" "Willi")
("Emil" "Max")
("Willi" "Karl"))
(°->list/ground (fresh° l (a b) (genealogie-ist-Vater-von° a b))))
(⊦= '(("Max" "Kurt")
("Max" "Klaus")
("Max" "Karl")
("Emil" "Winfred")
("Emil" "Willi"))
(°->list/ground
(fresh° l (a b) (genealogie-ist-Grossvater-von° a b))))
(⊦= '(("Max" "Kurt")
("Max" "Klaus")
("Max" "Karl")
("Emil" "Winfred")
("Emil" "Willi"))
(°->list/ground
(fresh° l (|:a| |:b|) (genealogie |:a| ist Grossvater von |:b|))))
(⊦= 2 (hash-table-size genealogie-hash-table)))
((eta 0.003) (memory #(12582912 2310416 1048576)) (stdout "") (stderr ""))
test/postgresql°: pass
(define (test/postgresql° _)
(define-knowledge
genealogie
(fact ((|:a| string?) ist Vater von (|:c| string?))
(text/postgresql "SELECT $1::text, 2::int2" "hello")
(text/plain
("Winfred" "Kurt")
("Winfred" "Klaus")
("Max" "Winfred")
("Max" "Willi")
("Emil" "Max")
("Willi" "Karl"))))
(⊦= '(("Winfred" "Kurt")
("Winfred" "Klaus")
("Max" "Winfred")
("Max" "Willi")
("Emil" "Max")
("Willi" "Karl")
("hello" 2))
(°->list/ground
(fresh° l (|:a| |:b|) (genealogie |:a| ist Vater von |:b|))))
(⊦= '(("hello" 2))
(°->list/ground
(fresh° (l) (postgresql° l "SELECT $1::text, 2::int2" "hello"))))
(define-record simple-pair first second)
(⊦= `(,(make-simple-pair "hello" 2))
(°->list/ground
(fresh°
(l)
(postgresql°/record
'simple-pair
l
"SELECT $1::text, 2::int2"
"hello"))))
(⊦= `((,(cons 'greet "hello") ,(cons 'int2 2)))
(°->list/ground
(fresh°
(l)
(postgresql°/alist
l
"SELECT $1::text as greet, 2::int2"
"hello"))))
(⊦= `(,(make-simple-pair "hello" 2))
(°->list/ground
(fresh°/record
l
('simple-pair first second)
(postgresql°/record
'simple-pair
l
"SELECT $1::text, 2::int2"
"hello"))))
(⊦= `((1
,(sql-null)
,(sql-null)
,(sql-null)
,(sql-null)
,(sql-null)
,(sql-null)
0
"2026-06-19 13:09:06.372196"
"eUpsertDHeading"
"db"
"-"
"MTopic"
"{\"eventid\": 5, \"eventkey\": \"eUpsertDHeading\", \"username\": \"db\", \"valuekey\": \"MTopic\", \"eventtime\": \"2026-06-19T13:09:06.372196\", \"valuesjson\": {\"hlabel\": \"Thematik\", \"mdtext\": \"Ein thematisches Item repräsentiert die Identität einer Sammlung, die beliebige Items enthalten kann. Die thematische Beziehung zwischen dem zugeordneten Item und dem thematischen Item wird durch die Relation [rIsTopicFor]() aufgebaut.\\n\\nEin thematisches Item hat nur eine einzige Strukturspalte zugeordnet, die den Namen des Themas repräsentiert.\\n\\nThematische Sammlungen, die nur aus thematischen Items bestehen, sind möglich und sinnvoll, z.B. als Übersichtslisten über bestimmte Themenbereiche. Im Normalfall wird eine thematische Sammlung jedoch aus Items der Anwendung bestehen, die selbst nicht dem Typ [MTopic]() angehören.\\n\\nThematische Items können untereinander in einer hierarchischen Beziehung stehen, die insgesamt beliebig viele Ebenen umfassen kann. Diese Hierarchie wird durch eine weitere spezielle Relation unterstützt: [rHasSubTopic]().\", \"ietftag\": \"de\"}, \"eventlocation\": 0}"
,(sql-null)))
(°->list/ground
(fresh°
(l)
(postgresql°
(cons 5 l)
"select * from gdms.event order by 1;")))))
((eta 0.077) (memory #(12582912 2338968 1048576)) (stdout "") (stderr ""))
Categories: scheme