-
Notifications
You must be signed in to change notification settings - Fork 20
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
Query result includes variable name? #40
Comments
I think so too. Interestingly, the "Prolog on Broser" returned only two solutions. At this time, I also have no ideas why the "GetAllSolutions()" method returned three answers in this situation. |
I'm afraid but I was not able to reproduce the behavior that you reported. My test code is here: using Prolog;
var prolog = new PrologEngine(persistentCommandHistory: false);
prolog.ConsultFromString(
"person(adam). " +
"person(clara). " +
"loc(P,bedroom).");
var solutions = prolog.GetAllSolutions(null, query: "person(P), loc(P, bedroom).");
Console.WriteLine($"Count of all solutions is {solutions.Count}");
for (var i = 0; i < solutions.Count; i++)
{
var solution = solutions[i];
Console.WriteLine(solution);
} Could you disclose your project file? |
jsakamoto, I'm so glad you are maintaining this Prolog implementation! Thank you! In short, I must have inadvertently fixed whatever the problem was and you are welcome to close this thread and stop reading. However, I'd really like to learn more about what you are doing with C# and Prolog and learn from your experience. I'm new to C#, Xamarin.Forms, and Prolog. I think Prolog might be a good fit for the logic (and perhaps game-state) of a turn-based text-only game. C# and Xamarin.Forms permit CSProlog to run with a modern GUI on a cell phone, which is fantastic. Is that also what you're doing? I've attached my code and would welcome any advice you have to offer. I start the PrologEngine within a static class in App.xaml.cs and populate it in the same file. Where should this go within a Xamarin.Forms app? I employ the syntax I query the Prolog database from MainPageViewModel.cs to display the result (names of characters/persons) inside a Picker. This is not working--and worse--Visual Studio does not report an error. When I noticed CSProlog was adding an extra solution item, I wrote a method, ExtractSolution (also in App.xaml.cs) to process the results and remove the variable name. But, when I exclude the check |
@d-vyd Thank you for attaching the project file!
Thank you for your kindness. However, your project looks great to me, so I will try to figure out the project you attached as much as I can. By the way, maybe, as you already know, my OSS activity is just my hobby, so I can not spend a lot of time on such activities, including responding to issues. Maybe I can't reply this week at least because I have other issues that I have to answer to, but I hope for the success of your project! |
Yes, of course, I understand. I appreciate the time you volunteer to OSS and do not expect any more help than you can provide if and when you have free time. No rush. Have a great week.
…________________________________
From: jsakamoto ***@***.***>
Sent: Sunday, January 30, 2022 5:14 AM
To: jsakamoto/CSharpProlog ***@***.***>
Cc: d-vyd ***@***.***>; Mention ***@***.***>
Subject: Re: [jsakamoto/CSharpProlog] Query result includes variable name? (Issue #40)
@d-vyd<https://github.com/d-vyd> Thank you for attaching the project file!
you are welcome to close this thread and stop reading.
Thank you for your kindness.
However, your project looks great to me, so I will try to figure out the project you attached as much as I can.
By the way, maybe, as you already know, my OSS activity is just my hobby, so I can not spend a lot of time on such activities, including responding to issues.
Maybe I can't reply this week at least because I have other issues that I have to answer to, but I hope for the success of your project!
—
Reply to this email directly, view it on GitHub<#40 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGJMWF23MKM2EEJEE7A2E6LUYTCMNANCNFSM5MV4HPMQ>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
The Xamarin.Forms "Picker" is now working with Prolog and MVVM! I would still be interested in learning how you are using Prolog & C# whenever you have time. |
@jsakamoto , I was not handling the SolutionSet object correctly. You can close this issue. Whenever you have free time, I'd love to learn whether and how you are using C# and Prolog together! |
The answer set for this query
var solution = prolog.GetAllSolutions(null, query: "person(P), loc(P,bedroom).");
is:Solution 1
P (atom) = adam
Solution 2
P (atom) = clara
Solution 3
P (namedvar) = P
Given the content of the database, there should only be two solutions. Why is "P" included and how can I avoid it? Do I need to check for the type (namedvar) or phrase my queries differently?
The text was updated successfully, but these errors were encountered: