(defrule tipoReservaIndividual_ClienteCadastrado (cadastroCliente 1) => (printout t "Digite seu nome" crlf) (bind ?*nomeClienteIndividual* (read)) (printout t "Digite o ano inicial da reserva (aaaa):") (bind ?ano (read)) (printout t "Digite o ano inicial da reserva (mm):") (bind ?mes (read)) (printout t "Digite o ano inicial da reserva (dd):") (bind ?dia (read)) ( if(< ?mes 10) then (bind ?mes (str-cat 0 ?mes)) ) ( if(< ?dia 10) then (bind ?dia (str-cat 0 ?dia)) ) (bind ?*dataInicial* (str-cat ?ano (str-cat - (str-cat ?mes (str-cat - ?dia))))) (printout t "Digite a data final da reserva (aaaa-mm-dd)" crlf) (bind ?*dataFinal* (read)) (printout t "Digite o tipo do quarto (Presidencial, Luxo, Simples)" crlf) (bind ?*tipoQuarto* (read)) (printout t "Digite a categoria do quarto (Fumantes, Não_Fumantes)" crlf) (bind ?*categoria* (read)) (printout t "-----------------------------------" crlf) (bind ?diasTotaisAtuais (+ (* ?*ano* 365) (+ (* ?*mes* 43) ?*dia* ))) (bind ?diasTotaisReserva (+ (* ?ano 365) (+ (* ?mes 30) ?dia ))) (bind ?periodoIndisponivel false) (make-instance periodoParaComparacao of http://www.owl-ontologies.com/Ontology1243979326.owl#Periodo (http://www.owl-ontologies.com/Ontology1243979326.owl#Data_Final_Periodo ?*dataFinal*) (http://www.owl-ontologies.com/Ontology1243979326.owl#Data_Inicial_Periodo ?*dataInicial*) ) (printout t "periodo inserido com sucesso, digite ok para continuar" crlf) (bind ?ler (read)) ( if(< ?diasTotaisAtuais ?diasTotaisReserva ) then (printout t "Periodo indisponivel para marcaçao de reservas1" crlf) (bind ?periodoIndisponivel true) elif(< (slot-get http://www.owl-ontologies.com/Ontology1243979326.owl#periodoParaComparacao http://www.owl-ontologies.com/Ontology1243979326.owl#Data_Inicial_Periodo) (slot-get http://www.owl-ontologies.com/Ontology1243979326.owl#Periodo_De_Abertura http://www.owl-ontologies.com/Ontology1243979326.owl#Data_Inicial_Periodo)) then (printout t "Periodo indisponivel para marcaçao de reservas2" (slot-get http://www.owl-ontologies.com/Ontology1243979326.owl#Periodo_De_Abertura http://www.owl-ontologies.com/Ontology1243979326.owl#Data_Inicial_Periodo) crlf) (printout t "" (slot-get http://www.owl-ontologies.com/Ontology1243979326.owl#periodoParaComparacao http://www.owl-ontologies.com/Ontology1243979326.owl#Data_Inicial_Periodo) crlf) (bind ?periodoIndisponivel true) elif(> ?*dataFinal* (slot-get http://www.owl-ontologies.com/Ontology1243979326.owl#Periodo_De_Abertura http://www.owl-ontologies.com/Ontology1243979326.owl#Data_Final_Periodo)) then (printout t "Periodo indisponivel para marcaçao de reservas3" crlf) (bind ?periodoIndisponivel true) ) ( if(<> ?periodoIndisponivel true) then (assert (disponivel false)) (assert (naoDisponivel true)) ( if(= ?*tipoQuarto* Luxo) then (assert (verificar 1)) elif(= ?*tipoQuarto* Simples) then (assert (verificar 2)) elif(= ?*tipoQuarto* Presidencial) then (assert (verificar 3)) ) ) ) ********************** (defrule verificarDisponibilidadeTipoLuxo (verificar 1) (object (is-a http://www.owl-ontologies.com/Ontology1243979326.owl#Hotel) (http://www.owl-ontologies.com/Ontology1243979326.owl#Nome_Do_Hotel ?nome ) (http://www.owl-ontologies.com/Ontology1243979326.owl#has_Quartos $? ?quarto $?) (OBJECT ?hotel) ) (object (is-a http://www.owl-ontologies.com/Ontology1243979326.owl#QuartoLuxo) (http://www.owl-ontologies.com/Ontology1243979326.owl#Numero_Quarto ?numeroQuarto) (http://www.owl-ontologies.com/Ontology1243979326.owl#Categoria_Quarto ?categoriaQuarto) (http://www.owl-ontologies.com/Ontology1243979326.owl#Disponivel ?diponibilidade) (OBJECT ?quarto) ) => ( if(= ?*categoria* ?categoriaQuarto) then ( if(= TRUE ?diponibilidade) then (remove disponivel) (assert (disponivel true)) (remove naoDisponivel) (assert (naoDisponivel false)) ) ) )