Closed jeswr closed 1 year ago
There is a missing declaration of _:SCOPE in the graffiti of the last surface in data_2.n3s Adding it like
@prefix ex: <http://example.org/> .
@prefix fn: <http://www.w3.org/2006/xpath-functions#>.
@prefix crypto: <http://www.w3.org/2000/10/swap/crypto#>.
@prefix graph: <http://www.w3.org/2000/10/swap/graph#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#> .
@prefix time: <http://www.w3.org/2000/10/swap/time#> .
@prefix func: <http://www.w3.org/2007/rif-builtin-function#>.
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
@prefix dialog: <urn:dialog:> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix rulelogic: <urn:rule:logic:>.
# Assert validated birthdays
(
_:Graffiti _:G
_:Actor _:BirthDate
) log:onNegativeSurface {
_:Graffiti dialog:onVerifiedSurface _:G.
_:G log:includes {
_:Actor vcard:bday _:BirthDate.
}.
() log:onNegativeSurface {
_:Actor vcard:bday _:BirthDate .
}.
}.
# Check for present actor
(
_:Graffiti _:G
_:Message _:Actor
_:Result _:Warning
_:AssertedGraph
_:SCOPE
) log:onNegativeSurface {
(
{
_:Graffiti dialog:onVerifiedSurface _:G.
_:G log:includes {
_:Message a dialog:DialogMessage.
_:Message dialog:actor _:Actor.
}
}
{ _:AssertedGraph log:equalTo {} }
{
_:AssertedGraph log:equalTo {
() log:onWarningSurface {
_:Warning a dialog:Warning;
dialog:message "No actor was present in the dialog message. No alcoholic beverages will be displayed";
dialog:questions {
(
_:VerifiedSurface _:RequestedActor _:BirthDate
) dialog:onQuestionSurface {
() dialog:onVerifiedSurface _:VerifiedSurface.
() log:onAnswerSurface {
_:VerifiedSurface log:includes {
_:Message dialog:actor _:RequestedActor.
_:RequestedActor vcard:bday _:BirthDate.
}.
}.
}.
}.
}.
}.
}
) log:ifThenElseIn _:SCOPE .
() log:onNegativeSurface _:AssertedGraph.
}.
# Check for present birthdate
(
_:Graffiti _:G
_:Message _:Actor _:BirthDate
_:Result _:Warning
_:AssertedGraph
_:SCOPE
) log:onNegativeSurface {
_:Graffiti dialog:onVerifiedSurface _:G.
_:G log:includes {
_:Message a dialog:DialogMessage.
_:Message dialog:actor _:Actor.
}.
(
{ _:Actor vcard:bday _:BirthDate. }
{ _:AssertedGraph log:equalTo {}. }
{
_:AssertedGraph log:equalTo {
() log:onWarningSurface {
_:Warning a dialog:Warning;
dialog:message "No actor birthdate was given. No alcoholic beverages will be displayed";
dialog:questions {
(_:RequestedBirthDate) dialog:onQuestionSurface {
_:Actor vcard:bday _:RequestedBirthDate.
() log:onAnswerSurface {
_:Actor vcard:bday _:RequestedBirthDate.
}.
}
}.
}.
}.
}
) log:ifThenElseIn _:SCOPE .
() log:onNegativeSurface _:AssertedGraph.
}.
# Check if older than 18
(
_:Graffiti _:G
_:Message
_:Actor
_:BirthDate
_:LocalTime
_:DateToCheck
_:AssertedGraph
_:Warning
_:SCOPE
) log:onNegativeSurface {
_:Graffiti dialog:onVerifiedSurface _:G.
_:G log:includes {
_:Message a dialog:DialogMessage.
_:Message dialog:actor _:Actor.
}.
_:Actor vcard:bday _:BirthDate.
"" time:localTime _:LocalTime.
(_:LocalTime "P18Y0M"^^xsd:yearMonthDuration) func:subtract-yearMonthDuration-from-dateTime _:DateToCheck.
# Check if the actor was born before 18 years ago
(
{ _:BirthDate math:lessThan _:DateToCheck. }
{
_:AssertedGraph log:equalTo { _:Actor a rulelogic:Adult. }.
}
{
_:AssertedGraph log:equalTo {
() log:onWarningSurface {
_:Warning a dialog:Warning;
dialog:message "Actor is a minor. No alcoholic beverages will be displayed".
# This does not warrant an additional question. We have sufficient information to decide we should not show alcoholic beverages
}.
}.
}
) log:ifThenElseIn _:SCOPE .
() log:onNegativeSurface _:AssertedGraph.
}.
makes the eye-js eyereasoner happy
$ eyereasoner --nope --quiet --no-qnames data_0.n3s data_1.n3s data_2.n3s --pass-only-new
<https://myuserpod.com/rubend/profile/card#me> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <urn:rule:logic:Adult>.
The error message is indeed tricky, what happens is that log:ifThenElseIn for a non-variable scope is invoking another reasoner instance (via shell/2) to run the log:ifThenElseIn in that external scope.
This fixes it - thanks!
Tested using
eye v8.1.0
(via eye-js)Not sure where to start debugging on this one. We get the following error when the command
eye --nope --quiet --no-qnames data_0.n3s data_1.n3s data_2.n3s
is run with the 3 files given below. However when any of the files are omitted from the command the error does not occur.data_0.n3s
data_1.n3s
data_2.n3s