-
Notifications
You must be signed in to change notification settings - Fork 3
/
diff.txt
7703 lines (7703 loc) · 200 KB
/
diff.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1968,9584d1967
< (slot cuadro
< (type INSTANCE)
< (create-accessor read-write))
< (slot relevancia
< (type INTEGER)
< (create-accessor read-write))
< (slot complejidad
< (type INTEGER)
< (create-accessor read-write))
< (slot sala
< (type INTEGER)
< (create-accessor read-write))
< (slot valoracion
< (type INTEGER)
< (default 0)
< (create-accessor read-write))
< )
<
<
< ;;; Declaracion de MODULOS!!!! ----------------------------
<
< ;;; Modulo principal de utilidades
< (defmodule MAIN (export ?ALL))
<
< ;;; Modulo de recopilacion de los datos del grupo + preferencias
< (defmodule recopilacion-grupo
< (import MAIN ?ALL)
< (export ?ALL)
< )
<
< (defmodule recopilacion-preferencias
< (import MAIN ?ALL)
< (import recopilacion-grupo deftemplate ?ALL)
< (export ?ALL)
< )
<
< (defmodule procesado-datos
< (import MAIN ?ALL)
< (import recopilacion-grupo deftemplate ?ALL)
< (import recopilacion-preferencias deftemplate ?ALL)
< (export ?ALL)
< )
<
< (defmodule generacion_soluciones
< (import MAIN ?ALL)
< (export ?ALL)
< )
<
< (defmodule resultados_al_grupo
< (import MAIN ?ALL)
< (export ?ALL)
< )
<
< ;;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
<
<
<
<
< ;;; Declaracion de templates --------------------------
<
< ;;; Template para los datos del grupo
<
< (deftemplate MAIN::datos_grupo
< (slot descripcion (type STRING) (default "desc")) ;tamanyo del grupo
< (slot nivel (type INTEGER)(default -1)) ;conocimiento
< (slot edad (type INTEGER)(default -1)) ;edad general del grupo
< (slot dias (type INTEGER)(default -1)) ;nº dias en visitar el museo
< (slot horasdia (type INTEGER)(default -1)) ;nº horas/dia
< (slot tiempo (type INTEGER)(default -1)) ;total de tiempo
< )
<
< ;;; Template para las preferencias del usuario
< (deftemplate MAIN::preferencias_grupo
< (multislot autores_favoritos (type INSTANCE))
< (multislot tematicas_obras_fav (type INSTANCE))
< (multislot estilos_favoritos (type INSTANCE))
< (multislot epocas_favoritas (type INSTANCE))
< )
<
< ;;; Template para una lista de recomendaciones sin orden
< (deftemplate MAIN::lista-cuadros-desordenada
< (multislot cuadros_aux (type INSTANCE))
< )
<
< ;;; Template para una lista de recomendaciones con orden
< (deftemplate MAIN::lista-cuadros-ordenada
< (multislot cuadros (type INSTANCE))
< )
<
< ;;; Cuadros ordenados
< (defclass ListaCuadros
< (is-a USER)
< (role concrete)
< (multislot cuadros
< (type INSTANCE)
< (create-accessor read-write))
< )
<
< (deftemplate MAIN::lista-cuadros-ordenada
< (multislot cuadros (type INSTANCE))
< )
<
<
< ;;; Funcion para hacer una pregunta no-numerica-univalor
< (deffunction pregunta-datos (?pregunta)
< (format t "%s " ?pregunta)
< (bind ?respuesta (read))
< (while (not (lexemep ?respuesta)) do
< (format t "%s " ?pregunta)
< (bind ?respuesta (read))
< )
< ?respuesta
< )
<
< ;;; Funcion para hacer una pregunta numerica-univalor
< (deffunction MAIN::pregunta-numerica (?pregunta ?rangini ?rangfi)
< (format t "%s (De %d hasta %d) " ?pregunta ?rangini ?rangfi)
< (bind ?respuesta (read))
< (while (not(and(>= ?respuesta ?rangini)(<= ?respuesta ?rangfi))) do
< (format t "%s (De %d hasta %d) " ?pregunta ?rangini ?rangfi)
< (bind ?respuesta (read))
< )
< ?respuesta
< )
<
<
< ;;; Funcion para hacer pregunta con muchas opciones
< (deffunction MAIN::pregunta-opciones (?pregunta $?valores-posibles)
< (bind ?linea (format nil "%s" ?pregunta))
< (printout t ?linea crlf)
< (progn$ (?var ?valores-posibles)
< (bind ?linea (format nil " %d. %s" ?var-index ?var))
< (printout t ?linea crlf)
< )
< (bind ?respuesta (pregunta-numerica "Escoge una opcion:" 1 (length$ ?valores-posibles)))
< ?respuesta
< )
<
< ;;; Funcion para hacer una pregunta general con una serie de respuestas admitidas
< (deffunction MAIN::pregunta-opciones2 (?question $?allowed-values)
< (format t "%s "?question)
< (progn$ (?curr-value $?allowed-values)
< (format t "[%s]" ?curr-value)
< )
< (printout t ": ")
< (bind ?answer (read))
< (if (lexemep ?answer)
< then (bind ?answer (lowcase ?answer)))
< (while (not (member ?answer ?allowed-values)) do
< (format t "%s "?question)
< (progn$ (?curr-value $?allowed-values)
< (format t "[%s]" ?curr-value)
< )
< (printout t ": ")
< (bind ?answer (read))
< (if (lexemep ?answer)
< then (bind ?answer (lowcase ?answer))))
< ?answer
< )
< ;;; Funcion para hacer una pregunta de tipo si/no
< (deffunction MAIN::pregunta-si-no (?question)
< (bind ?response (pregunta-opciones ?question si no))
< (if (or (eq ?response si) (eq ?response s))
< then TRUE
< else FALSE)
< )
<
< ;;; Funcion para hacer una pregunta multi-respuesta con indices
< (deffunction MAIN::pregunta-multirespuesta (?pregunta $?valores-posibles)
< (bind ?linea (format nil "%s" ?pregunta))
< (printout t ?linea crlf)
< (progn$ (?var ?valores-posibles)
< (bind ?linea (format nil " %d. %s" ?var-index ?var))
< (printout t ?linea crlf)
< )
< (format t "%s" "Indica los numeros referentes a los pintores separados por un espacio: ")
< (bind ?resp (readline))
< (bind ?numeros (str-explode ?resp))
< (bind $?lista (create$ ))
< (progn$ (?var ?numeros)
< (if (and (integerp ?var) (and (>= ?var 0) (<= ?var (length$ ?valores-posibles))))
< then
< (if (not (member$ ?var ?lista))
< then (bind ?lista (insert$ ?lista (+ (length$ ?lista) 1) ?var))
< )
< )
< )
< (if (member$ 0 ?lista) then (bind ?lista (create$ 0)))
< ?lista
< )
< ;;; Funcion para hacer pregunta con indice de respuestas posibles
< (deffunction MAIN::pregunta-indice (?pregunta $?valores-posibles)
< (bind ?linea (format nil "%s" ?pregunta))
< (printout t ?linea crlf)
< (progn$ (?var ?valores-posibles)
< (bind ?linea (format nil " %d. %s" ?var-index ?var))
< (printout t ?linea crlf)
< )
< (bind ?respuesta (pregunta-numerica "Escoge una opcion:" 1 (length$ ?valores-posibles)))
< ?respuesta
< )
<
< (defrule MAIN::initialRule "Regla inicial"
< (declare (salience 10))
< =>
< (printout t"----------------------------------------------------------" crlf)
< (printout t" Personalizacion de visitas a un museo " crlf)
< (printout t"----------------------------------------------------------" crlf)
< (printout t crlf)
< (printout t"¡Bienvenido! A continuacion se le formularan una serie de preguntas para poder recomendarle una visita adecuada a sus preferencias." crlf)
< (printout t crlf)
< (focus recopilacion-grupo)
< )
<
< ;;Recopilacion de datos de entrada --------------------------------------------------------------------
<
< (defrule recopilacion-grupo::establecer-tamanyo "Establece el tamanyo del grupo"
< (not (datos_grupo))
< =>
< (bind ?d (pregunta-numerica "¿De cuantos visitantes esta formado el grupo? " 1 100))
< (if (= ?d 1) then (bind ?descripcion "Individual"))
< (if (= ?d 2) then (bind ?descripcion "Pareja"))
< (if (and(> ?d 2) (< ?d 13)) then (bind ?descripcion "Grupo pequeno (3-12)"))
< (if (and(> ?d 12) (< ?d 26)) then (bind ?descripcion"Grupo mediano (13-25)"))
< (if (> ?d 25) then (bind ?descripcion "Grupo grande (+25)"))
< (assert (datos_grupo (descripcion ?descripcion)))
< )
<
<
< (defrule recopilacion-grupo::establecer-edad "Establece la edad media del grupo"
< ?g <- (datos_grupo (edad ?edad))
< (test (< ?edad 0))
< =>
< (bind ?edad (pregunta-numerica "¿Cual es la media de edad del grupo? " 1 110))
< (modify ?g (edad ?edad))
< )
<
< (defrule recopilacion-grupo::establecer-dias "Establece el nº dias de la visita"
< ?g <- (datos_grupo (dias ?dias))
< ;?g <- (datos_grupo (horasdia ?horasdia))
< ;?g <- (datos_grupo (tiempo ?tiempo))
< (test (< ?dias 0) ;(< ?horasdia 0) (< ?tiempo 0))
< )
< =>
< (bind ?dias (pregunta-numerica "¿Durante cuantos dias realizara la visita?" 1 365))
< (modify ?g (dias ?dias))
< ;(bind ?horasdia (pregunta-numerica "¿Cuantas horas dedicara diariamente a visitar el museo?" 1 24))
< ;(modify ?g (horasdia ?horasdia))
< ;(modify ?g (tiempo (bind ?tiempo (* ?horasdia ?dias))))
< )
<
< (defrule recopilacion-grupo::establecer-horas "Establece el nº dias de horas de la visita"
< ?g <- (datos_grupo (horasdia ?horasdia))
< (test (< ?horasdia 0))
< =>
< (bind ?horasdia (pregunta-numerica "¿Cuantas horas dedicara diariamente a visitar el museo?" 1 24))
< (modify ?g (horasdia ?horasdia))
< )
<
< (defrule recopilacion-grupo::establecer-tiempo "Establece el nº dias de horas de la visita"
< ?g <- (datos_grupo (dias ?dias))
< ?d <- (datos_grupo (horasdia ?horasdia))
< ?t <- (datos_grupo (tiempo ?tiempo))
< ; (test (and(> ?horasdia 0) (> ?dias 0)))
< (test (< ?tiempo 0))
< =>
< (modify ?t (tiempo (bind ?tiempo (* ?horasdia ?dias))))
< )
<
< (defrule recopilacion-grupo::preguntas-calcula-nivel "Pregunta al usuario sus conocimientos"
< ?g <- (datos_grupo (nivel ?nivel))
< (test( < ?nivel 0))
< =>
< (bind ?puntuacio 0)
< (bind ?respuesta (pregunta-si-no "Conoces 'El Grito' de Munch?"))
< (if (eq ?respuesta TRUE)
< then (bind ?puntuacio (+ 1 ?puntuacio))
< )
<
< (bind ?respuesta (pregunta-si-no "Conoces 'Las Meninas' de Velazquez?"))
< (if (eq ?respuesta TRUE)
< then (bind ?puntuacio (+ 1 ?puntuacio))
< )
<
< (bind ?respuesta (pregunta-si-no "Conoces 'El nacimiento de Venus' de Botticelli?"))
< (if (eq ?respuesta TRUE)
< then (bind ?puntuacio (+ 1 ?puntuacio))
< )
<
< (bind ?formatos (create$ "La Gioconda (la Mona Lisa)." "El jardin de las delicias." "La ultima cena."))
< (bind ?respuesta (pregunta-indice "Cual de los siguientes titulos no pertenece a un cuadro de Leonardo da Vinci " ?formatos))
< (if (= ?respuesta 2) then (bind ?puntuacio (+ 1 ?puntuacio)))
<
< (bind ?formatos (create$ "La persistencia de la memoria." "Alegoria de la poesia." "American Gothic." "Alegoria de la fe."))
< (bind ?respuesta (pregunta-indice "Cual de estas obras es de Dali" ?formatos))
< (if (= ?respuesta 1) then (bind ?puntuacio (+ 1 ?puntuacio)))
<
< (bind ?formatos (create$ "El Greco." "Alegoria de la poesia." "Francisco de Goya." "Diego Velazquez."))
< (bind ?respuesta (pregunta-indice "¿Quien pinto el cuadro 'Las Hilanderas'?" ?formatos))
< (if (= ?respuesta 3) then (bind ?puntuacio (+ 1 ?puntuacio)))
<
<
< (bind ?formatos (create$ "Klimt" "Tiziano" "Yanyez" "El Greco"))
< (bind ?respuesta (pregunta-indice "¿Quien pinto 'El Beso'?" ?formatos))
< (if (= ?respuesta 1) then (bind ?puntuacio (+ 1 ?puntuacio)))
<
< (modify ?g (nivel ?puntuacio))
< ; (printout t"----------------------------------------------------------" crlf)
< )
<
< (defrule recopilacion-grupo::pasar-a-preferencias "Pasa a la recopilacion de preferencias"
< (declare (salience 10))
< ;(printout t"----------------------------------------------------------" crlf)
< ;(focus recopilacion-preferencias)
<
< ?g <- (datos_grupo (descripcion ~"desc")(edad ?e) (dias ?d) (horasdia ?horasdia) (nivel ?nivel) (tiempo ?tiempo))
< (test (> ?e -1))
< (test (> ?d -1))
< (test (> ?nivel -1))
< (test (> ?tiempo -1))
< (test (> ?horasdia -1))
< =>
< (focus recopilacion-preferencias)
< )
<
< (deffacts recopilacion-preferencias::hechos-iniciales "Establece hechos para poder recopilar informacion"
< ; (printout t"----------------------------------------------------------" crlf)
< (autores_fav ask)
< (tematicas_obras ask)
< (estilos_fav ask)
< (epocas_fav ask)
< (preferencias_grupo )
< )
<
< (defrule recopilacion-preferencias::establecer-pintores-favoritos "Establece los pintores favoritos del grupo"
< ?hecho <- (autores_fav ask)
< ?pref <- (preferencias_grupo)
< =>
< (bind $?obj-pintores (find-all-instances ((?inst Pintor)) TRUE))
< (bind $?nom-pintores (create$ ))
< (loop-for-count (?i 1 (length$ $?obj-pintores)) do
< (bind ?curr-obj (nth$ ?i ?obj-pintores))
< (bind ?curr-nom (send ?curr-obj get-Nombre))
< (bind $?nom-pintores(insert$ $?nom-pintores (+ (length$ $?nom-pintores) 1) ?curr-nom))
< )
< (bind ?escogido (pregunta-multirespuesta "Escoja sus pintores favoritos(o 0 en el caso contrario): " $?nom-pintores))
< (assert (autores_fav TRUE))
< (bind $?respuesta (create$ ))
< (loop-for-count (?i 1 (length$ ?escogido)) do
< (bind ?curr-index (nth$ ?i ?escogido))
< (if (= ?curr-index 0) then (assert (autores_fav FALSE)))
< (bind ?curr-autor (nth$ ?curr-index ?obj-pintores))
< (bind $?respuesta(insert$ $?respuesta (+ (length$ $?respuesta) 1) ?curr-autor))
< )
<
< (retract ?hecho)
< (modify ?pref (autores_favoritos $?respuesta))
< )
<
<
< (defrule recopilacion-preferencias::establecer-tematicas-favorias "Establece las tematicas favoritas del grupo "
< ?hecho <- (tematicas_obras ask)
< ?pref <- (preferencias_grupo)
< =>
< (bind $?obj-tematicas (find-all-instances ((?inst Tematica)) TRUE))
< (bind $?nom-tematicas (create$ ))
< (loop-for-count (?i 1 (length$ $?obj-tematicas)) do
< (bind ?curr-obj (nth$ ?i ?obj-tematicas))
< (bind ?curr-nom (send ?curr-obj get-Nombre_tematica))
< (bind $?nom-tematicas(insert$ $?nom-tematicas (+ (length$ $?nom-tematicas) 1) ?curr-nom))
< )
< (bind ?escogido (pregunta-multirespuesta "Escoja sus tematicas favoritas(o 0 en el caso contrario): " $?nom-tematicas))
<
< (bind $?respuesta (create$ ))
< (assert (tematicas_obras TRUE))
< (loop-for-count (?i 1 (length$ ?escogido)) do
< (bind ?curr-index (nth$ ?i ?escogido))
< (if (= ?curr-index 0) then (assert (tematicas_obras_fav FALSE)))
< (bind ?curr-tematica (nth$ ?curr-index ?obj-tematicas))
< (bind $?respuesta(insert$ $?respuesta (+ (length$ $?respuesta) 1) ?curr-tematica))
< )
<
< (retract ?hecho)
< (modify ?pref (tematicas_obras_fav $?respuesta))
< )
<
< (defrule recopilacion-preferencias::establecer-estilos-favoritos "Establece los estilos favoritos del grupo"
< ?hecho <- (estilos_fav ask)
< ?pref <- (preferencias_grupo)
< =>
< (bind $?obj-estilos (find-all-instances ((?inst Estilo)) TRUE))
< (bind $?nom-estilos (create$ ))
< (loop-for-count (?i 1 (length$ $?obj-estilos)) do
< (bind ?curr-obj (nth$ ?i ?obj-estilos))
< (bind ?curr-nom (send ?curr-obj get-Nombre_estilo))
< (bind $?nom-estilos(insert$ $?nom-estilos (+ (length$ $?nom-estilos) 1) ?curr-nom))
< )
< (bind ?escogido (pregunta-multirespuesta "Escoja sus estilos favoritos(o 0 en el caso contrario): " $?nom-estilos))
<
< (bind $?respuesta (create$ ))
< (assert (estilos_fav TRUE))
< (loop-for-count (?i 1 (length$ ?escogido)) do
< (bind ?curr-index (nth$ ?i ?escogido))
< (if (= ?curr-index 0) then (assert (estilos_favoritos FALSE)))
< (bind ?curr-estilos (nth$ ?curr-index ?obj-estilos))
< (bind $?respuesta(insert$ $?respuesta (+ (length$ $?respuesta) 1) ?curr-estilos))
< )
<
< (retract ?hecho)
< (modify ?pref (estilos_favoritos $?respuesta))
< )
<
< (defrule recopilacion-preferencias::establecer-epocas-favoritas "Establece las epocas favoritas del grupo"
< ?hecho <- (epocas_fav ask)
< ?pref <- (preferencias_grupo)
< =>
< (bind $?obj-epocas (find-all-instances ((?inst Epoca)) TRUE))
< (bind $?nom-epocas (create$ ))
< (loop-for-count (?i 1 (length$ $?obj-epocas)) do
< (bind ?curr-obj (nth$ ?i ?obj-epocas))
< (bind ?curr-nom (send ?curr-obj get-Nombre_epoca))
< (bind $?nom-epocas(insert$ $?nom-epocas (+ (length$ $?nom-epocas) 1) ?curr-nom))
< )
< (bind ?escogido (pregunta-multirespuesta "Escoja sus epocas favoritas(o 0 en el caso contrario): " $?nom-epocas))
<
< (bind $?respuesta (create$ ))
< (assert (epocas_fav TRUE))
< (loop-for-count (?i 1 (length$ ?escogido)) do
< (bind ?curr-index (nth$ ?i ?escogido))
< (if (= ?curr-index 0) then (assert (epocas_favoritas FALSE)))
< (bind ?curr-epocas (nth$ ?curr-index ?obj-epocas))
< (bind $?respuesta(insert$ $?respuesta (+ (length$ $?respuesta) 1) ?curr-epocas))
< )
<
< (retract ?hecho)
< (modify ?pref (epocas_favoritas $?respuesta))
< )
<
< (defrule recopilacion-preferencias::pasar_procesado_datos "Pasa al modulo de procesado de datos"
< (declare (salience -1))
< ?h1 <- (autores_fav TRUE|FALSE)
< ?h2 <- (tematicas_obras TRUE|FALSE)
< ?h3 <- (estilos_fav TRUE|FALSE)
< ?h4 <- (epocas_fav TRUE|FALSE)
< =>
< (printout t "Procesando los datos obtenidos..." crlf)
< (focus procesado-datos)
< )
<
< ;;; Modulo procesado de datos ---------------------------------------------------
<
<
< (defrule procesado-datos::anadir-cuadros "Se añade todos los cuadros"
< ?hecho <- (formato Cuadro)
< =>
< (bind $?lista (find-all-instances ((?inst Cuadro)) TRUE))
< (progn$ (?curr-con ?lista)
< (make-instance (gensym) of Recomendacion (cuadro ?curr-con)
< (complejidad (send ?curr-con get-complejidad))
< (relevancia (send ?curr-con get-relevancia)) (sala (send ?curr-con get-sala)))
< )
< (retract ?hecho)
< )
<
< (defrule procesado-datos::aux-autores "Crea hechos para poder procesar los autores favoritos"
< (preferencias_grupo (autores_favoritos $?gen))
< ?hecho <- (autores_fav ?aux)
< (test (or (eq ?aux TRUE) (eq ?aux FALSE)))
< =>
< (retract ?hecho)
< (if (eq ?aux TRUE)then
< (progn$ (?curr-gen $?gen)
< (assert (autores_fav ?curr-gen))
< )
< )
< )
<
< (defrule procesado-datos::aux-tematicas "Crea hechos para poder procesar las tematicas favoritas"
< (preferencias_grupo (tematicas_obras_fav $?gen))
< ?hecho <- (tematicas_obras ?aux)
< (test (or (eq ?aux TRUE) (eq ?aux FALSE)))
< =>
< (retract ?hecho)
< (if (eq ?aux TRUE)then
< (progn$ (?curr-gen $?gen)
< (assert (tematicas_obras ?curr-gen))
< )
< )
< )
<
< (defrule procesado-datos::aux-estilos "Crea hechos para poder procesar los estilos favoritos"
< (preferencias_grupo (estilos_favoritos $?gen))
< ?hecho <- (estilos_fav ?aux)
< (test (or (eq ?aux TRUE) (eq ?aux FALSE)))
< =>
< (retract ?hecho)
< (if (eq ?aux TRUE)then
< (progn$ (?curr-gen $?gen)
< (assert (estilos_fav ?curr-gen))
< )
< )
< )
<
< (defrule procesado-datos::aux-autores "Crea hechos para poder procesar las espocas favoritas"
< (preferencias_grupo (epocas_favoritas $?gen))
< ?hecho <- (epocas_fav ?aux)
< (test (or (eq ?aux TRUE) (eq ?aux FALSE)))
< =>
< (retract ?hecho)
< (if (eq ?aux TRUE)then
< (progn$ (?curr-gen $?gen)
< (assert (epocas_fav ?curr-gen))
< )
< )
< )
<
< ;;;;;;;;;;;;;;;;;;;;;;;;;;;APLICAMOS LOS FILTROS DE LAS PREGUNTAS
<
<
< (defrule procesado-datos::valorar-edad "Se quitan los cuadros que no cumplen las preguntas"
< (preferencias_grupo (epocas_favoritas ?epf) (estilos_favoritos ?esf)
< (tematicas_obras_fav ?tof) (autores_favoritos ?af))
< ?rec <- (object (is-a Recomendacion) (cuadro ?recom))
< ?cont <-(object (is-a Cuadro) (Pintado_por ?pintado) (Tematica_cuadro ?tematica) (Estilo_cuadro ?estilo)
< (Epoca_cuadro ?epoca))
< ;desigualdad que hay que cumplir (solo pasaran las contrarias a lo que queremos, por lo tanto las que se borran)
< (test (not(= ?epf ?epoca)))
< (test (not(= ?esf ?estilo)))
< (test (not(= ?tof ?tematica)))
< (test (not(= ?af ?pintado)))
< =>
< (send ?rec delete)
< )
<
< (defrule procesado-datos::puntuar-epocas "Se puntuan las epocas que cumplen con las preferencias"
< (preferencias_grupo (epocas_favoritas ?epf))
< ?rec <- (object (is-a Recomendacion) (cuadro ?recom) (valoracion ?valor))
< ?cont <- (object (is-a Cuadro) (Epoca_cuadro ?epoca))
< (test (= ?epf ?e; Tue Nov 29 17:18:57 CET 2016
< ;
< ;+ (version "3.5")
< ;+ (build "Build 663")
<
< ;;Ontologia --------------------------------------------------------------------
<
< (defclass %3ACLIPS_TOP_LEVEL_SLOT_CLASS "Fake class to save top-level slot information"
< (is-a USER)
< (role abstract)
< (single-slot Nombre_tematica
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Epoca_cuadro
< (type INSTANCE)
< ;+ (allowed-classes Epoca)
< ;+ (cardinality 0 1)
< ;+ (inverse-slot Cuadros_epoca)
< (create-accessor read-write))
< (single-slot Pintado_por
< (type INSTANCE)
< ;+ (allowed-classes Pintor)
< ;+ (cardinality 0 1)
< ;+ (inverse-slot Ha_pintado)
< (create-accessor read-write))
< (multislot Tematica_pref
< (type INSTANCE)
< ;+ (allowed-classes Preferencia)
< ;+ (inverse-slot Pref_tematica)
< (create-accessor read-write))
< (multislot Epocas_pintor
< (type INSTANCE)
< ;+ (allowed-classes Epoca)
< ;+ (inverse-slot Pintores_epoca)
< (create-accessor read-write))
< (single-slot Titulo
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Pref_epoca
< (type INSTANCE)
< ;+ (allowed-classes Epoca)
< ;+ (inverse-slot Epoca_pref)
< (create-accessor read-write))
< (single-slot Nombre
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Epoca_pref
< (type INSTANCE)
< ;+ (allowed-classes Preferencia)
< ;+ (inverse-slot Pref_epoca)
< (create-accessor read-write))
< (single-slot Conocimiento_visita
< (type INSTANCE)
< ;+ (allowed-classes Conocimiento)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Descripcion
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Tamanyo_visita
< (type INSTANCE)
< ;+ (allowed-classes Tamanyo)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot h
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Ha_pintado
< (type INSTANCE)
< ;+ (allowed-classes Cuadro)
< ;+ (inverse-slot Pintado_por)
< (create-accessor read-write))
< (single-slot Estilo_cuadro
< (type INSTANCE)
< ;+ (allowed-classes Estilo)
< ;+ (cardinality 0 1)
< ;+ (inverse-slot Cuadros_estilo)
< (create-accessor read-write))
< (multislot Cuadros_tematica
< (type INSTANCE)
< ;+ (allowed-classes Cuadro)
< ;+ (inverse-slot Tematica_cuadro)
< (create-accessor read-write))
< (multislot Pref_estilo
< (type INSTANCE)
< ;+ (allowed-classes Estilo)
< ;+ (inverse-slot Estilo_pref)
< (create-accessor read-write))
< (multislot Estilo_pref
< (type INSTANCE)
< ;+ (allowed-classes Preferencia)
< ;+ (inverse-slot Pref_estilo)
< (create-accessor read-write))
< (single-slot w
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Pintor_pref
< (type INSTANCE)
< ;+ (allowed-classes Preferencia)
< ;+ (inverse-slot Pref_pintor)
< (create-accessor read-write))
< (single-slot T%C3%ADtol
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Complejidad
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Pref_visita
< (type INSTANCE)
< ;+ (allowed-classes Visita)
< ;+ (inverse-slot Visita_pref)
< (create-accessor read-write))
< (single-slot Estil
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Relevancia
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Pref_pintor
< (type INSTANCE)
< ;+ (allowed-classes Pintor)
< ;+ (inverse-slot Pintor_pref)
< (create-accessor read-write))
< (multislot Pintores_estilo
< (type INSTANCE)
< ;+ (allowed-classes Pintor)
< ;+ (inverse-slot Estilos_pintor)
< (create-accessor read-write))
< (single-slot Visita_pref
< (type INSTANCE)
< ;+ (allowed-classes Preferencia)
< ;+ (cardinality 0 1)
< ;+ (inverse-slot Pref_visita)
< (create-accessor read-write))
< (multislot Cuadros_epoca
< (type INSTANCE)
< ;+ (allowed-classes Cuadro)
< ;+ (inverse-slot Epoca_cuadro)
< (create-accessor read-write))
< (single-slot Tem%C3%A0tica
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Dim
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Autor
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot %C3%88poca
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Anyo
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot HorasDia
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Tematica_cuadro
< (type INSTANCE)
< ;+ (allowed-classes Tematica)
< ;+ (cardinality 0 1)
< ;+ (inverse-slot Cuadros_tematica)
< (create-accessor read-write))
< (multislot Cuadros_estilo
< (type INSTANCE)
< ;+ (allowed-classes Cuadro)
< ;+ (inverse-slot Estilo_cuadro)
< (create-accessor read-write))
< (single-slot Complexitat
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Dias
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Estilos_pintor
< (type INSTANCE)
< ;+ (allowed-classes Estilo)
< ;+ (inverse-slot Pintores_estilo)
< (create-accessor read-write))
< (single-slot Nombre_estilo
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Nivel
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Nacionalidad
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Pintores_epoca
< (type INSTANCE)
< ;+ (allowed-classes Pintor)
< ;+ (inverse-slot Epocas_pintor)
< (create-accessor read-write))
< (single-slot Nombre_epoca
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Any
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Pref_tematica
< (type INSTANCE)
< ;+ (allowed-classes Tematica)
< ;+ (inverse-slot Tematica_pref)
< (create-accessor read-write))
< (single-slot Sala
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write)))
<
< (defclass Cuadro
< (is-a USER)
< (role concrete)
< (single-slot Dim
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Epoca_cuadro
< (type INSTANCE)
< ;+ (allowed-classes Epoca)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Complejidad
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Pintado_por
< (type INSTANCE)
< ;+ (allowed-classes Pintor)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Anyo
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Relevancia
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Titulo
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Sala
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Tematica_cuadro
< (type INSTANCE)
< ;+ (allowed-classes Tematica)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Estilo_cuadro
< (type INSTANCE)
< ;+ (allowed-classes Estilo)
< ;+ (cardinality 0 1)
< (create-accessor read-write)))
<
< (defclass Pintor
< (is-a USER)
< (role concrete)
< (single-slot Nombre
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Estilos_pintor
< (type INSTANCE)
< ;+ (allowed-classes Estilo)
< (create-accessor read-write))
< (multislot Epocas_pintor
< (type INSTANCE)
< ;+ (allowed-classes Epoca)
< (create-accessor read-write))
< (multislot Ha_pintado
< (type INSTANCE)
< ;+ (allowed-classes Cuadro)
< (create-accessor read-write))
< (single-slot Nacionalidad
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Pintor_pref
< (type INSTANCE)
< ;+ (allowed-classes Preferencia)
< (create-accessor read-write)))
<
< (defclass Epoca
< (is-a USER)
< (role concrete)
< (multislot Pintores_epoca
< (type INSTANCE)
< ;+ (allowed-classes Pintor)
< (create-accessor read-write))
< (multislot Epoca_pref
< (type INSTANCE)
< ;+ (allowed-classes Preferencia)
< (create-accessor read-write))
< (single-slot Nombre_epoca
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Cuadros_epoca
< (type INSTANCE)
< ;+ (allowed-classes Cuadro)
< (create-accessor read-write)))
<
< (defclass Estilo
< (is-a USER)
< (role concrete)
< (multislot Cuadros_estilo
< (type INSTANCE)
< ;+ (allowed-classes Cuadro)
< (create-accessor read-write))
< (multislot Estilo_pref
< (type INSTANCE)
< ;+ (allowed-classes Preferencia)
< (create-accessor read-write))
< (single-slot Nombre_estilo
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Pintores_estilo
< (type INSTANCE)
< ;+ (allowed-classes Pintor)
< (create-accessor read-write)))
<
< (defclass Tematica
< (is-a USER)
< (role concrete)
< (single-slot Nombre_tematica
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (multislot Cuadros_tematica
< (type INSTANCE)
< ;+ (allowed-classes Cuadro)
< (create-accessor read-write))
< (multislot Tematica_pref
< (type INSTANCE)
< ;+ (allowed-classes Preferencia)
< (create-accessor read-write)))
<
< (defclass Visita
< (is-a USER)
< (role concrete)
< (single-slot Dias
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Conocimiento_visita
< (type INSTANCE)
< ;+ (allowed-classes Conocimiento)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Tamanyo_visita
< (type INSTANCE)
< ;+ (allowed-classes Tamanyo)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot Visita_pref
< (type INSTANCE)
< ;+ (allowed-classes Preferencia)
< ;+ (cardinality 0 1)
< (create-accessor read-write))
< (single-slot HorasDia
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write)))
<
< (defclass Tamanyo
< (is-a USER)
< (role concrete)
< (single-slot Descripcion
< (type STRING)
< ;+ (cardinality 0 1)
< (create-accessor read-write)))
<
< (defclass Conocimiento
< (is-a USER)
< (role concrete)
< (single-slot Nivel
< (type INTEGER)
< ;+ (cardinality 0 1)
< (create-accessor read-write)))
<
< (defclass Preferencia
< (is-a USER)
< (role concrete)
< (multislot Pref_pintor
< (type INSTANCE)
< ;+ (allowed-classes Pintor)
< (create-accessor read-write))
< (multislot Pref_estilo
< (type INSTANCE)
< ;+ (allowed-classes Estilo)
< (create-accessor read-write))
< (multislot Pref_visita
< (type INSTANCE)
< ;+ (allowed-classes Visita)
< (create-accessor read-write))
< (multislot Pref_tematica
< (type INSTANCE)
< ;+ (allowed-classes Tematica)
< (create-accessor read-write))
< (multislot Pref_epoca
< (type INSTANCE)
< ;+ (allowed-classes Epoca)
< (create-accessor read-write)))
<
<
< ;;Instancias --------------------------------------------------------------------
<
< (definstances instancias
< ; Tue Nov 29 17:54:23 CET 2016
< ;
< ;+ (version "3.5")
< ;+ (build "Build 663")
<
< ([Cuadres_Class1] of Epoca
<
< (Cuadros_epoca
< [Cuadres_Class18]
< [Cuadres_Class82]
< [Cuadres_Class85]
< [Cuadres_Class86]
< [Cuadres_Class96]
< [Cuadres_Class114]
< [Cuadres_Class115]
< [Cuadres_Class116])
< (Nombre_epoca "Barroco")
< (Pintores_epoca
< [Cuadres_Class16]
< [Cuadres_Class50]
< [Cuadres_Class65]))
<
< ([Cuadres_Class10] of Estilo
<
< (Cuadros_estilo [Cuadres_Class109])
< (Nombre_estilo "Cubismo")