05.06.2013 Views

Tools e ambienti per lo sviluppo di ontologie per il ... - CHERSI/libri

Tools e ambienti per lo sviluppo di ontologie per il ... - CHERSI/libri

Tools e ambienti per lo sviluppo di ontologie per il ... - CHERSI/libri

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Inserire <strong>il</strong> tito<strong>lo</strong> della tesi <strong>di</strong> laurea come intestazione<br />

corso dell'elaborazione Pro<strong>lo</strong>g assegna <strong>lo</strong>ro dei va<strong>lo</strong>ri che ricava dai fatti (bound), <strong>per</strong><br />

stab<strong>il</strong>ire se sod<strong>di</strong>sfano la richiesta; finita l'elaborazione esse ri<strong>di</strong>ventano libere. In un<br />

pre<strong>di</strong>cato possono coesistere variab<strong>il</strong>i bound o <strong>di</strong> input e variab<strong>il</strong>i free o <strong>di</strong> output.<br />

L’elemento che più si avvicina al concetto <strong>di</strong> variab<strong>il</strong>e dei linguaggi <strong>di</strong> programmazione<br />

tra<strong>di</strong>zionali, è <strong>il</strong> fatto, ed i fatti si possono aggiungere alla collezione <strong>di</strong> fatti e regole<br />

tramite un apposito pre<strong>di</strong>cato (assert).<br />

Un pre<strong>di</strong>cato può produrre <strong>di</strong>verse soluzioni, in funzione del<strong>lo</strong> stato delle variab<strong>il</strong>i con cui<br />

è richiamato: ad esempio <strong>il</strong> pre<strong>di</strong>cato str_int(Intero,Stringa) potrà convertire un<br />

numero in una stringa, convertire una stringa numerica in numero o verificare che <strong>il</strong><br />

numero e la stringa numerica convertita in numero siano uguali, secondo la tabella<br />

seguente:<br />

Intero Stringa<br />

bound bound Confronto<br />

bound Free converte in stringa numerica<br />

free bound converte in numero<br />

free Free Errore<br />

In generale se tutte le variab<strong>il</strong>i sono bound, <strong>il</strong> pre<strong>di</strong>cato è vero o falso, altrimenti risponde<br />

con <strong>il</strong> va<strong>lo</strong>re o i va<strong>lo</strong>ri che <strong>lo</strong> rendono vero.<br />

PROLOG come linguaggio procedurale<br />

La caratteristica <strong>di</strong> Pro<strong>lo</strong>g <strong>di</strong> cercare regole o fatti che sod<strong>di</strong>sfino la domanda, è la base del<br />

suo ut<strong>il</strong>izzo procedurale, in particolare se la domanda è relativa ad una regola plurima,<br />

cioè stessa testa e corpi <strong>di</strong>versi, Pro<strong>lo</strong>g verificherà la prima regola (quin<strong>di</strong> l'or<strong>di</strong>ne delle<br />

regole è talvolta essenziale) se essa non è verificata, procederà con la regola successiva, ad<br />

esempio:<br />

119

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!