Example with weather, dates and trust
Mine navigeerimisribale
Mine otsikasti
clear(auto). set(prolog_style_variables). set(hyper_res). set(factor). clear(print_given). set(print_kept). assign(stats_level, 0). assign(max_seconds, 10). list(sos). % temperature in Tallinn is -5 at day one with trust 1: % here "id1" is an id of the encoded fact rdf("id1","subject","Tallinn"). rdf("id1","property","temperature"). rdf("id1","object","-1"). rdf("id1","date",1). % 1 is today rdf("id1","trust","1"). % 1 is full trust % combine the reified triplets to a fact encoding % also date and trust where % rdfdt(subject,property,object,date,trust) -rdf(X,"subject",Y) | -rdf(X,"property",Z) | -rdf(X,"object",V) | -rdf(X,"date",W) | -rdf(X,"trust",O) | rdfdt(Y,Z,V,W,O). % temperature the next day is the same as today, % but with twice smaller trust: also, do not derive % anything with trust less than 0.2 -rdfdt(X,"temperature",Y,U,T) | -$FLT("0.2",T) | rdfdt(X,"temperature",Y,$SUM(U,1),$FPROD(T,"0.5")). % rdfd is rdf with date but no trust: % rdfdq(subject,property,object,date) rdfd("Tallinn","temperature","-5",2). % tomorrow rdfd("Tallinn","weatherfeature","stormy",2). % tomorrow % if stormy, then also windy: -rdfd(X,"weatherfeature","stormy",U) | rdfd(X,"weatherfeature","windy",U). % various degrees of badness: % rdfdq is a rdf with date and qualifier: % rdfdq(subject,property,object,qualifier,date) -rdfd(X,"temperature",Y,U) | -$FLT(Y,"-0") | rdfdq(X,"weatherfeature","badness",1,U). -rdfd(X,"temperature",Y,U) | -$FLT(Y,"-20") | rdfdq(X,"weatherfeature","badness",2,U). -rdfd(X,"temperature",Y,U) | -$FLT(Y,"0") | -rdfd(X,"weatherfeature","windy",U) | rdfdq(X,"weatherfeature","badness",3,U). end_of_list.