Quantcast

Who i get the nth term from a literal.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Who i get the nth term from a literal.

Marcos Côrtes


Hello Jason developers.

I need do an agent that receive a ask with form (X(Y)), find the beliefs that unify with the ask and do the sum from the Y terms (first term). The x can be any valid functor name.

I do the .find_all(ASK, ASK, LIST) and it work fine. But I need extract the Y value from X(Y). I try unifies X(Y) = ELEMENT, but it does not work, and the interpret report a syntax error.

There is some way to do it?


thanks..



=============================
Olá...
eu preciso fazer o seguinte:

Tenho um agente que recebe uma pergunta da forma X(Y), onde X pode ser qualquer functor válido. Ele pega esta pergunta e consulta e realiza um find_all na BB para obter as crenças. Até ai ok. Mas eu preciso extrair o valor de Y para realizar uma soma antes dele responder, mas eu não consigo fazer isto.

Já tentei fazer X(Y) = ELEMENT, mas dá erro de sintaxe.

Não posso simplesmente mudar minha consulta para algo do tipo data(X, Y), pois eu preciso que seja daquele jeito pois terei de fazer algumas otimizações na BB no  meu experimento. É importante que os functors sejam iguais em uma consulta.

bom é isto. Obrigado e abs...

--
Ass: Marcos Côrtes
Mestrando Computação - UFF

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Who i get the nth term from a literal.

Jomi Fred Hubner-4
To retrieve the first term of all beliefs, you may try

        .findall(T1, B & B =.. [_,[T1|_],_], L)

(but do not ask me to explain it :-)

Jomi

On 28/08/2012, at 10:34, Marcos Côrtes wrote:

>
>
> Hello Jason developers.
>
> I need do an agent that receive a ask with form (X(Y)), find the beliefs that unify with the ask and do the sum from the Y terms (first term). The x can be any valid functor name.
>
> I do the .find_all(ASK, ASK, LIST) and it work fine. But I need extract the Y value from X(Y). I try unifies X(Y) = ELEMENT, but it does not work, and the interpret report a syntax error.
>
> There is some way to do it?
>
>
> thanks..
>
>
>
> =============================
> Olá...
> eu preciso fazer o seguinte:
>
> Tenho um agente que recebe uma pergunta da forma X(Y), onde X pode ser qualquer functor válido. Ele pega esta pergunta e consulta e realiza um find_all na BB para obter as crenças. Até ai ok. Mas eu preciso extrair o valor de Y para realizar uma soma antes dele responder, mas eu não consigo fazer isto.
>
> Já tentei fazer X(Y) = ELEMENT, mas dá erro de sintaxe.
>
> Não posso simplesmente mudar minha consulta para algo do tipo data(X, Y), pois eu preciso que seja daquele jeito pois terei de fazer algumas otimizações na BB no  meu experimento. É importante que os functors sejam iguais em uma consulta.
>
> bom é isto. Obrigado e abs...
>
> --
> Ass: Marcos Côrtes
> Mestrando Computação - UFF
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
> Jason-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jason-users

--
Jomi Fred Hubner
Federal University of Santa Catarina
Department of Automation and Systems Engineering
PO Box 476, Florianópolis, SC
88040-900 Brazil
http://www.das.ufsc.br/~jomi


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Who i get the nth term from a literal.

Jomi Hubner
BTW, it follows some notes about Jason syntax:

. B(X) is syntax error, a variable cannot have terms, but
. B[X] is ok, variables can have annotations, in this case, it unifies with any belief with exactly one annotation.

Other examples:

. B[X|_] unifies with any belief with at least one annotation
. B[source(percept)|_] unifies with all beliefs with the source(perception) annotation
. B[source(percept), source(_)|_] unifies with all beliefs with the source(perception) and another source annotation

HTH,

Jomi

On 28/08/2012, at 11:46, Jomi Fred Hubner wrote:

> To retrieve the first term of all beliefs, you may try
>
> .findall(T1, B & B =.. [_,[T1|_],_], L)
>
> (but do not ask me to explain it :-)
>
> Jomi
>
> On 28/08/2012, at 10:34, Marcos Côrtes wrote:
>
>>
>>
>> Hello Jason developers.
>>
>> I need do an agent that receive a ask with form (X(Y)), find the beliefs that unify with the ask and do the sum from the Y terms (first term). The x can be any valid functor name.
>>
>> I do the .find_all(ASK, ASK, LIST) and it work fine. But I need extract the Y value from X(Y). I try unifies X(Y) = ELEMENT, but it does not work, and the interpret report a syntax error.
>>
>> There is some way to do it?
>>
>>
>> thanks..
>>
>>
>>
>> =============================
>> Olá...
>> eu preciso fazer o seguinte:
>>
>> Tenho um agente que recebe uma pergunta da forma X(Y), onde X pode ser qualquer functor válido. Ele pega esta pergunta e consulta e realiza um find_all na BB para obter as crenças. Até ai ok. Mas eu preciso extrair o valor de Y para realizar uma soma antes dele responder, mas eu não consigo fazer isto.
>>
>> Já tentei fazer X(Y) = ELEMENT, mas dá erro de sintaxe.
>>
>> Não posso simplesmente mudar minha consulta para algo do tipo data(X, Y), pois eu preciso que seja daquele jeito pois terei de fazer algumas otimizações na BB no  meu experimento. É importante que os functors sejam iguais em uma consulta.
>>
>> bom é isto. Obrigado e abs...
>>
>> --
>> Ass: Marcos Côrtes
>> Mestrando Computação - UFF
>> ------------------------------------------------------------------------------
>> Live Security Virtual Conference
>> Exclusive live event will cover all the ways today's security and
>> threat landscape has changed and how IT managers can respond. Discussions
>> will include endpoint security, mobile security and the latest in malware
>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
>> Jason-users mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/jason-users
>
> --
> Jomi Fred Hubner
> Federal University of Santa Catarina
> Department of Automation and Systems Engineering
> PO Box 476, Florianópolis, SC
> 88040-900 Brazil
> http://www.das.ufsc.br/~jomi
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Jason-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/jason-users

--
Jomi Fred Hubner
Federal University of Santa Catarina
Department of Automation and Systems Engineering
PO Box 476, Florianópolis, SC
88040-900 Brazil
http://www.das.ufsc.br/~jomi


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jason-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jason-users
Loading...