Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8003243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:36:15+00:00 2026-06-04T16:36:15+00:00

I have a problem, while creating a question answer Prolog file. I have a

  • 0

I have a problem, while creating a question answer Prolog file. I have a database with locations and I can already get the question and write the answer out. But there are different types of objects, that require different prefixes. So I defined DCG for prefixes.

answer(P,A) :- location(P, Str, Nr),A = [there, is, article(G,K,N,P), noun(G,K,N,P), pre(P),Str,Nr].
question(A) --> questionsentence(P),{answer(P,A)}.

pre(P)  --> [in, P], {member(P, [road66])}.
pre(P)  --> [at, P], {member(P, [trafalgarsquare])}.

but what i get is something like this:

?-question(A, [where,is,a,kentuckys],[]).
A = [there, is, article(_G2791, _G2792, _G2793, kentuckys), noun(_G2791, _G2792, _G2793, kentuckys), prep(kentuckys), road66, 123] 

This works for verifying the input properly, but it seems to be useless for the output. How can I take just the variable and not the clause?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T16:36:16+00:00Added an answer on June 4, 2026 at 4:36 pm

    OK, I tried to translate the whole program to a more or less usefull and working example.

    location(kentuckys, road66, 121).
    location(soliver, trafalgarsquare, 15).
    location(marcopolo, trafalgarsquare, 15).
    location(internist, jumpstreet, 21).
    
    questionsentence(P,G) --> [where],[is], article(G), noun(G,P).
    answer(P,A,G) :- location(P, Str, Nr), prep(W,Str), article(G,Art,[]), flatten([there, is, Art, P, W, Str,Nr], A).
    question(A) --> questionsentence(P,G),{answer(P,A,G)}.
    
    article(m) --> [a].
    article(f) --> [an].
    noun(m, P) --> [P], {member(P, [kentuckys, soliver, marcopolo])}.
    noun(f, P) --> [P], {member(P, [internist])}.
    prep([at],Str)  :- member(Str, [trafalgarsquare, road66]).
    prep([in],Str)  :- member(Str, [jumpstreet]).
    

    Result:

    ?- question(A, [where,is,a,kentuckys],[]).
    A = [there, is, a, kentuckys, at, road66, 121] .
    

    I think, what I looked for was a construction like: article(G,Art,[]) to determine the depending DCG variable… actually I do not fathom yet how the two last arguments are working…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a flash file menu i am having problem while link it to
I have one question that if we are creating any table in database i.e.
i have a question about how to get the current line number while compiling
I have problem while using jquery maskedinput with asp.net textbox. I have a check
I have a problem while converting a string whose value is dd.mm.yyyy to DateTime
I have a problem while pasting my contents (or text) generated by Java code
I have a problem while executing a SSIS script component. To be honest I
I have a problem while scrolling images on tableview. I am getting a Signal
i have a problem while loading a UITableView on UITabBarController, i got this error
I have a problem while publishing on the Market. My application does not use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.