select(keyword,K) & ~empty(K) ==> newkeyword(K) select(keyword,K) & newkeyword(X) ==> ~newkeyword(X) click(browseuse) & newkeyword(X) ==> ~newkeyword(X) empty(X) :- matches(X,"^\s*$") somekeyword :- keyword(K) somenewkeyword :- newkeyword(K) value(keyword,K) :- newkeyword(K) attribute(keyword,class,X) :- evaluate( if( somenewkeyword, "search semi-bold hascontent", true, "search semi-bold" ), X ) attribute(searchbusiness,href,X) :- evaluate( if( somenewkeyword, stringappend("/business/sanmateo/search?keyword=",choose(K,newkeyword(K))), true, "" ), X ) attribute(searchbusiness,onclick,X) :- evaluate( if( somenewkeyword, "return true;", true, "document.querySelector('.search').focus(); return false;" ), X ) attribute(browseuse,href,"/business/sanmateo/search") attribute(keyword,placeholder,"Enter your business type") load & evaluate(searchkeyword(),[X,Y]) & ~empty(X) & empty(Y) ==> keyword(X) & newkeyword(X) & searchbykeyword load & evaluate(searchkeyword(),[X,Y]) & ~empty(X) & ~empty(Y) ==> keyword(Y) & newkeyword(Y) & use(Y) load & evaluate(searchkeyword(),[X,Y]) & ~empty(Y) ==> use(Y) attribute(scroll,class,X) :- evaluate( if( somekeyword, "scroll", true, "scroll bycategory" ), X ) attribute(searchbar,class,Y) :- evaluate( if( searchbykeyword, "searchbar", true, "searchbar hidden" ), Y ) attribute(searchbar(X),class,Y) :- evaluate( if( searchbar(X), "full-height", true, "hidden" ), Y ) searchbar(X) :- evaluate( if( somekeyword, keyword, true, browse ), X ) attribute(searchfooter,class,X) :- evaluate( if( searchbykeyword, "hidden", someuse, "hidden", true, "continue text-right" ), X ) attribute(continue,disabled,X) :- evaluate( if( somecandidate, "no", true, "yes" ), X ) attribute(continue,href,X) :- evaluate( if( somecandidate, stringappend("/business/sanmateo/search?keyword=",choose(A,candidate(A)),"&use=",choose(B,candidate(B))), true, "#" ), X ) innerhtml(searchHeader,X) :- evaluate( if( searchbykeyword, if( somematch, "Select the best match for your proposed business.", true, "We are unable to locate business types that match your search." ), someuse, stringappend("Your proposed business:","<br>",choose(U,use(U))), true, "" ), X ) style(legend,display,X) :- evaluate( if( someuse, "", somecandidate, "", true, "none" ), X ) select(use,X) ==> use(X) select(use,X) & use(Y) ==> ~use(Y) select(use,X) ==> newkeyword(X) select(use,X) & newkeyword(Y) ==> ~newkeyword(Y) value(use,X) :- use(X) select(candidate,X) ==> candidate(X) select(candidate,X) & candidate(Y) ==> ~candidate(Y) select(candidate,X) ==> newkeyword(X) select(candidate,X) & newkeyword(Y) ==> ~newkeyword(Y) value(candidate,X) :- candidate(X) somecandidate :- candidate(X) attribute(usematch,class,X) :- evaluate( if( searchbykeyword, "", true, "hidden" ), X ) section(browse) :- ~somekeyword section(use) :- somekeyword section(location) :- someuse section(status) :- someuse & somelocation attribute(section(X),class,Y) :- evaluate( if( section(X), "", true, "hidden" ), Y ) attribute(location,placeholder,"Search by address") attribute(location,class,X) :- evaluate( if( somelocation, "search semi-bold hascontent", true, "search semi-bold" ), X ) attribute(clearlocation,class,X) :- evaluate( if( somelocationtext, "clear-btn clickable", true, "clear-btn clickable hidden" ), X ) clearlocation :- click(clearlocation) clearlocation & location(X) ==> ~location(X) select(location,X) & ~empty(X) ==> location(X) select(location,X) & location(Y) ==> ~location(Y) value(location,X) :- somelocation & evaluate( if ( someaddress, capitalizeone(choose(A,address(A))), true, choose(A,apn(A)) ), X ) value(location,L) :- ~somelocation & location(L) someaddress :- address(X) & ~empty(X) %apn or address select(locationtype,X) ==> locationtype(X) select(locationtype,X) & locationtype(Y) ==> ~locationtype(Y) %`some_questionss_not_answered` will never be in the model for SM since there are no additional questions attribute(viewreport,disabled,X) :- evaluate( if( some_questionss_not_answered, "yes", true, "no" ), X ) attribute(viewreport,href,X) :- evaluate( if( somereportlink, choose(X,reportlink(X)), true, "#" ), X ) somereportlink :- reportlink(X) reportlink(X) :- apn(A) & address(B) & use(U) & evaluate( stringappend( "/business/sanmateo/report?apn=",A,"&address=",B,"&use=",U ), X ) attribute(status(header),class,X) :- statusmessage(A,B,C) & evaluate(stringappend("h4 status status-",A),X) innerhtml(status(header),B) :- statusmessage(A,B,C) innerhtml(status(message),C) :- statusmessage(A,B,C) innerhtml(marker,Y) :- statusmessage(X,Y,Z) attribute(marker,"class",C) :- statusmessage(X,Y,Z) & evaluate(stringappend("marker ",X), C) marker("allowed") :- ~unknown & minmaxstatus(3,3) statusmessage("allowed","Allowed","Your business should be allowed at this location.") :- ~unknown & minmaxstatus(3,3) statusmessage("notallowed","Not Allowed","It looks like your business isn't permitted at this location.") :- ~unknown & minmaxstatus(0,0) statusmessage("error","Special Use Permit Required","Your business would require a special use permit at this location.") :- ~unknown & minmaxstatus(2,2) additional_research_required :- ~additional_research_not_required additional_research_not_required :- ~unknown & minmaxstatus(X,X) statusmessage("error","Contact Planning","More research is needed to determine if your business is allowed here.") :- additional_research_required someuse :- use(X) somematch :- usematch(X) somelocation :- apn(X) somelocationtext :- location(X) allusedescr(CATEGORY,USE,DESCR) :- classifiedas(USE,CATEGORY) & evaluate( if( somedescription(USE), choose(Z,description(USE,Z)), true, "" ), DESCR ) usematchdescr(X,Y) :- usematch(X) & evaluate( if( somedescription(X), choose(Z,description(X,Z)), true, "" ), Y ) somedescription(X) :- description(X,Y) usematch(X) :- searchspace(X,Y) & keyword(K) & lowercase(K,LK) & evaluate(fuzzymatch(Y,LK),1) & ~doNotMatch(X) searchspace(X,X) :- classifiedas(X,C) searchspace(X,C) :- classifiedas(X,C) searchspace(X,T) :- description(X,D) & evaluate(html2text(D),T) searchspace(X,K) :- keywordOf(X,K) searchspace(X,D) :- keywordOf(X,K) & meaningOf(K,D) doNotMatch("Minor motor vehicle repair") :- keyword(K) & lowercase(K,LK) & evaluate(fuzzymatch("major",LK),1) doNotMatch("Major motor vehicle repair") :- keyword(K) & lowercase(K,LK) & evaluate(fuzzymatch("minor",LK),1) doNotMatch("Parking facility") :- keyword(K) & lowercase(K,LK) & evaluate(fuzzymatch("storage, dismantled, wrecked, parts, store",LK),1) doNotMatch("Alternative financial service") :- keyword(K) & lowercase(K,LK) & evaluate(fuzzymatch("bank, credit union, mortgage, savings, retail",LK),1) doNotMatch("Home occupation") :- keyword(K) & lowercase(K,LK) & evaluate(fuzzymatch("auto, repair, retail, sales",LK),1) doNotMatch("Laboratory") :- keyword(K) & lowercase(K,LK) & evaluate(fuzzymatch("manufacturing, manufacture, assembly, packaging",LK),1) doNotMatch("Auditorium, stadium, arena, armory, gymnasium, and other similar places for public events") :- keyword(K) & lowercase(K,LK) & evaluate(fuzzymatch("office",LK),1) doNotMatch("Philanthropic institution and/or eleemosynary use") :- keyword(K) & lowercase(K,LK) & evaluate(fuzzymatch("mental",LK),1) doNotMatch("Sanitarium") :- keyword(K) & lowercase(K,LK) & evaluate(fuzzymatch("animal, hospital",LK),1) doNotMatch("Railroad rights-of-way and improvements") :- keyword(K) & lowercase(K,LK) & evaluate(fuzzymatch("depot, loading, platform, station, shed, warehouse, shop, car, yard, water, tower",LK),1) %locationselected & location(X) ==> ~location(X) locationselected & address(X) ==> ~address(X) locationselected & apn(X) ==> ~apn(X) locationselected & zone(X) ==> ~zone(X) locationselected & othercondition(X) ==> ~othercondition(X) attribute(page,class,X) :- evaluate( if( cat_party, "cat-party", true, "" ), X ) cat_party :- value(keyword,"10 cats")