% this is /tritogeneia/a/the_agora/code/trade/semiotes/bundle_semantics.pl % Release Notice % This file, and all files referenced herein that are not contributed by % someone else, are unequivocably placed in the public domain. Be mindful % that we use code, libraries, and information contributed by others, and % that they may not have released their work into the public domain. Our % goal is to release our own work, not inadvertantly place someone else's % in the public domain. % If you use, modify, redistribute, or publish anything in this file or based % on this work, we ask that you follow good scholarly practice and: % 1. cite the software system and file, or database and accession number, % as relevant, in all files or data you redistribute; % 2. reference the most current URL and archival publication for this work, % which will always be found at % http://www.biocheminfo.org/repository/current_references.html, % in your package, database, redistribution, or publication; % 3. record all your modifications to this file in a new file that % preserves this message and authorship information, contains your % authorship information and code or data, and is named with a name % different from this file's name. % The suitability of this work for any purpose is neither expressed nor implied. Use % it at your own risk! % Why we release knowledge this way is explained at % http://www.biocheminfo.org/release_notes.html % Toni Kazic, February 28, 2002 % Warning! the bundles are still very roughly defined, since it's % very likely each source will have its own ideas as to what a % particular bundle ought to be. These bundles rely on both the % functor name and its arity to enforce uniqueness, rather than just % the bundle's name. Thus these should be taken as examples more % than gospel! % % Kazic 21.8.00. % Some of these definitions PRESUME that a bundle is local to a database only -- % because bundle arguments are not wrapped with their corresponding semiote! % These are bundles, it's true: but these bundles % aren't intended for public distribution. In fact, what they really % are is mappings between an unspecified external notion and the notion % as implemented in Agora. So a db-specific bundle wouldn't be portable. % Except for the cases which have no semantic definition in the body, % the remainder of the definition should be ok. % So it's an interesting philosophical point: are we, in Glossa, defining % specific bundles? I claim not; we are just defining semiotes and rules % for combining bundles. Transmitted bundles need to have all semiotes marked, % just so the transmitted bundle can be deconstructed further on. But these % local bundles don't need such marking. Having said that, it's clearly % better for local bundles to conform to the marking rules for transmitted % bundles. Well, we'll do it for Agora in the renewal! But for new databases, % we'll continue to write ``transmittable Glossa'' for all bundles and % input/output to the local database. And that's consistent with the evolution % of Glossa as we've proceeded. % % Kazic, 17.1.02. %declarations% :- module(bundle_semantics, [ is_unique_set/2 ]). :- multifile data_source/1. :- ensure_loaded(library(basics)), ensure_loaded(library(decons)), ensure_loaded(library(foreach)). %end% % here to data_source/1 should have better definitions so that % the semantics of the arguments are defined. % % Kazic, 17.1.02. % data_source_abbrv(_Abbreviation,_FullerName). % definitions are in /tritogeneia/a/the_agora/data/global_data/data_source_abbrv.pl % to be filled in from bibtex tables address_abbrv(_AddressAbbrv,_FullTextStringAddress). publisher_abbrv(_PublisherAbbrv,_FullTextStringPublisher). journal_abbrv(_JournalAbbrv,_FullTextStringJournal). % to be filled in as needed nominal_pathway_abbrv(_PathProcessAbbrv,_FullTextStringPathProcess). % now the semantics start being incorporated in the definition, but not % in the bundle itself . . . notice that the heads of these clauses are % instantiated in ../global_data/data_source.pl data_source/1. data_source(Source) :- ( data_source_abbrv(Source,_) ; data_source_abbrv(_,Source) ). address(Address) :- ( address_abbrv(Address,_) ; address_abbrv(_,Address) ). publisher(Publisher) :- ( publisher_abbrv(Publisher,_) ; publisher_abbrv(_,Publisher) ). journal(Journal) :- ( journal_abbrv(Journal,_) ; journal_abbrv(_,Journal) ). % path_process_name(NameForANominalPathwayOrPhysiologicalProcess) :- % ( nominal_pathway_abbrv(NameForANominalPathwayOrPhysiologicalProcess,_) % ; % nominal_pathway_abbrv(_,NameForANominalPathwayOrPhysiologicalProcess) % ; % synonym(_,NameForANominalPathwayOrPhysiologicalProcess) % ). all_data_sources(List) :- setof(Abbrv,F^data_source_abbrv(Abbrv,F),List). agora_action_type(Action) :- db_cptn_action(Action), current_db_cptn(agora). agora_action_number(IntegerSerialNumberOverAllActions) :- db_cptn_action_number(agora,IntegerSerialNumberOverAllActions). db_cptn_action_number(DBOrServerAbbrv,SerialNumberOverAllActionsForThatDBOrServer):- data_source(DBOrServerAbbrv), action_number(SerialNumberOverAllActionsForThatDBOrServer). % agora_action(AgoraActionNumber,Timestamp,Person,ActionString). % and now, interestingly, we start wrapping terms in the head as well; % this is what we really want to do in proper Glossa. %%%%%% Jiahui finish and define corresponding bundle_syntax and bundle_{sem,syn}_tex.pl files % 11.2.02. % entity_allowed_action(person(-Person),-Role,-Action). % syntax error!!!! why???????????? entity_allowed_action(person(Person),Role,Action) :- entity_type(person(Person,Role)), entity_role(Role), data_action(Action), ( ( Role == overseer ; Role == curator ) -> memberchk(Action,[curate,deposit,revise,review,query,communicate]) ; ( Role == reviewer -> memberchk(Action,[review,deposit,revise,query,communicate]) ; ( Role == depositor -> memberchk(Action,[deposit,revise,query,communicate]) ; ( ( Role == contact ; Role == typist ) -> memberchk(Action,[curate,communicate,revise,query,deposit]) ; ( Role == inquirer -> memberchk(Action,[communicate,query]) ; false ) ) ) ) ). interlocutor_role(person(_Person),Role) :- entity_role(Role), Role \== curator, Role \== overseer, Role \== typist, Role \== contact. curator_role(person(_Person),Role) :- entity_role(Role), ( Role == overseer ; Role == curator ). % specifies each bundle must include one of two obligatory bundles % I originally thought every datum should be tagged with the name of the % authority who believes it. I'm now leaning towards letting this be % information which should be separately looked up. % dcb is shorter than datum_constant_bundle! dcb(data_source(_X),accession(_Y)). % ccb is shorter than cptn_constant_bundle! ccb(cptn_source(_X),accession(_Y)). person(Person) :- ( Person = [given_names(GivenNames),surname(Surname)] ; Person = [given_names(GivenNames),surname(Surname),generatnl_part(_GenrtnlPart)] ). entity(Entity) :- ( Entity = person(_Person) ; Entity = entity_name(_EntityName) ). human_location((person(_Person), department(_OrganizationalComponentOfInstitution), institution(_NonProfitOrForProfitName), mailing_add(_PostalStreetAddress), email_add(_InternetEmailAddress), vox_telephone(_TelephoneNumberIncludingCountryAndCityCodes), fax_telephone(_TelephoneNumberIncludingCountryAndCityCodes))). entity_location(entity_name(_NameOfForProfitOrNonProfitEntity), department(_OrganizationalComponentOfInstitution), institution(_NonProfitOrForProfitName), mailing_add(_PostalStreetAddress), email_add(_InternetEmailAddress), vox_telephone(_TelephoneNumberIncludingCountryAndCityCodes), fax_telephone(_TelephoneNumberIncludingCountryAndCityCodes)). email_entity(EntityName,email_add(_InternetEmailAddress)) :- ( EntityName == person(_Person) ; EntityName == entity_name(_NameOfForProfitOrNonProfitEntity) ). % this is a bundle, not because of disjunction, but because one of the alternatives % is itself a bundle. institution(NonProfitOrForProfitName):- ( atomic(NonProfitOrForProfitName) ; NonProfitOrForProfitName == person(_) ). mailing_add(List) :- ( memberchk(room(_Room),List) -> memberchk(building(BuildingNameOrNumber),List) ), ( memberchk(building(BuildingNameOrNumber),List) ; memberchk(district(_DistrictNameOrDesignation),List) ; memberchk(institution(Institution),List) ; memberchk(national_mail_code(_NatlMailCode),List) ; true ), memberchk(street_name(_StreetOrRoadNameOrNumber),List), memberchk(street_number(_AlphaNumericStreetAddress),List), ( memberchk(institutional_mail_code(_InstMailCode),List) -> memberchk(institution(Institution),List) ), memberchk(city(_VillageOrTownOrCity),List), memberchk(nation(_Nation),List), % do the Irish normally include the county in mailing addresses? yes, obligatory ( ( Nation == 'USA' ; Nation == 'Canada' ) -> memberchk(state(_StateOrProvince),List) ). vox_telephone(telephone_country_code(_TelephoneCountryCode), telephone_city_code(_TelephoneCityOrAreaCode), telephone_local_number(_TelephoneNumberAsDialedFromOutsideTheCity)). fax_telephone(telephone_country_code(_TelephoneCountryCode), telephone_city_code(_TelephoneCityOrAreaCode), telephone_local_number(_TelephoneNumberAsDialedFromOutsideTheCity)). comm_subject(ListOfTopics) :- forall(member(X,ListOfTopics),X == comm_topic(_)). comm_date(local_time(_TimeRelativeToUTCOnOriginatingMachine)). comm_inclusion(url(_URLOfIncludedFile),mime_type(_IncludedFileMimeType)). method_id(_SerialNumOfMethod,_StringOrAgoraCitationKeyDescribingMethod). data_authority(entity(_Entity)). cptn_authoriy(entity(_Entity)). file_info(file_type(Type),file(FileName)) :- file_type(Type), file(FileName). %%%%%% % lousy compound_isosmiles(AgoraPrimaryTermForAMoleculeOrMolecularComplex,IsomericSmilesString) :- compound_name(AgoraPrimaryTermForAMoleculeOrMolecularComplex), isosmiles(IsomericSmilesString). db_synonym(PrimaryTermInDB,SecondaryTermInDB,ContributingDBAbbrv) :- synonym(AgoraPrimaryTerm,PrimaryTermInDB), synonym(AgoraPrimaryTerm,SecondaryTermInDB), data_source(ContributingDBAbbrv). % for synonyms synonym_list(AgoraPrimaryTerm,ListSyns) :- functor(AgoraPrimaryTerm,F,_), arg(1,AgoraPrimaryTerm,Term), ( F == cpd_name -> synonym(Term,_) ; F == ec_num, synonym(AgoraPrimaryTerm,_) ), forall(member(X,ListSyns), ( ( synonym(AgoraPrimaryTerm,X) ; synonym(_,X) ; true ))). compound_name(AgoraPrimaryTermForAMoleculeOrMolecularComplex) :- synonym(AgoraPrimaryTermForAMoleculeOrMolecularComplex,_), cpd_name(AgoraPrimaryTermForAMoleculeOrMolecularComplex). % cpd_name(CompoundName) :- % ( compound_name(CompoundName) % ; % synonym(PrimaryTerm,CompoundName), % compound_name(PrimaryTerm) % ; % db_synonym(CompoundName,_,_) % ; % db_synonym(_,CompoundName,_,_) % ; % true % ). % It is the only synonym for a \sp{rxn\_name} worth distinguishing among % the others; thus it will occur in synonym and indexing bundles. rxn_sys_name(OfficialNCSystematicNameForAReaction) :- synonym(_PrimaryRxnName,rxn_sys_name(OfficialNCSystematicNameForAReaction)), rxn_name(OfficialNCSystematicNameForAReaction). % reactions! % notice that unknown intermediates simply have the values of these arguments set to % `unk'. If there is more than one unknown intermediate in a set of reactions, there must be % one such reactant fact for each unknown, for each reaction in the set. Other degrees of % vagueness will have to be dealt with on a case by case basis, looking carefully at the % evidence for each area of uncertainity. ec_num(Class,SubClass,SubSubClass,SerialNum) :- ec_class(Class), ec_subclass(SubClass), ec_subsubclass(SubSubClass), ec_serial_num(SerialNum). % think about what these bundles are saying. They presuppose % different knowledge and different situations. sinistra(CompoundName,RxnNum,Role,Stoich,MolState,Compartment) :- cpd_name(CompoundName), reaction(RxnNum,_,_), rxn_role(Role), Role == noncatalyst, stoich(Stoich), mol_state(MolState), compartment(Compartment). dextra(CompoundName,RxnNum,Role,Stoich,MolState,Compartment) :- cpd_name(CompoundName), reaction(RxnNum,_,_), rxn_role(Role), Role == noncatalyst, stoich(Stoich), mol_state(MolState), compartment(Compartment). reactant(CompoundName,Role,Stoich,MolState,Compartment) :- cpd_name(CompoundName), rxn_role(Role), Role == noncatalyst, stoich(Stoich), mol_state(MolState), compartment(Compartment). catalyst(CatalystName,Role,MolState,Compartment) :- cpd_name(CatalystName), rxn_role(Role), Role == catalyst, mol_state(MolState), compartment(Compartment). % in the following, foreach is incorrect. It fails because once it binds % X to the first term, it uses that binding when attempting to unify the % second term to X. Forall binds each term anew prior to testing. = is what % is required, not ==. == tests for literal identity. sinistras(ListOfSinistraLateralReactants) :- forall(member(X,ListOfSinistraLateralReactants), ( X = reactant(CompoundName,Stoich,MolState,Compartment), cpd_name(CompoundName), integer(Stoich), mol_states(MolStates), memberchk(MolState,MolStates), compartments(Compartments), memberchk(Compartment,Compartments))). dextras(ListOfDextraLateralReactants) :- forall(member(X,ListOfDextraLateralReactants), ( X = reactant(CompoundName,Stoich,MolState,Compartment), cpd_name(CompoundName), integer(Stoich), mol_states(MolStates), memberchk(MolState,MolStates), compartments(Compartments), memberchk(Compartment,Compartments))). catalysts(ListOfCatalysts) :- forall(member(X,ListOfCatalysts), ( X = catalyst(CompoundName,MolState,Compartment), cpd_name(CompoundName), mol_states(MolStates), memberchk(MolState,MolStates), compartments(Compartments), memberchk(Compartment,Compartments))). coreactants(list_num(_),ListOfCoreactingSpecies) :- forall(member(X,ListOfCoreactingSpecies), ( ( X = sinistra(CompoundName,RId,_,_,_) ; X = dextra(CompoundName,RId,_,_,_) ), reaction(RId,_,_) )), setof(Sin,SS^ST^SC^sinistra(Sin,RId,SS,ST,SC),Sins), setof(Dex,DS^DT^DC^dextra(Dex,RId,DS,DT,DC),Dexs), list_to_set(ListOfCoreactingSpecies,Set), ( subset(Set,Sins) ; subset(Set,Dexs) ). rxn_eqn([]). rxn_eqn([H|T]) :- compound(H), functor(F,H,1), arg(1,F,ListParticipants), ( ( F == sinistras ; F == dextras ) -> forall(member(reactant(CompoundName,Stoich,MolState,Compartment),ListParticipants), reactant(CompoundName,Stoich,MolState,Compartment) ) ; ( F == catalysts -> forall(member(catalyst(CompoundName,MolState,Compartment),ListParticipants), catalyst(CompoundName,MolState,Compartment) ) ; true ) ), is_unique_set(ListParticipants,T), rxn_eqn(T). coreactants_sets(alista(A),alistb(B)) :- forall(member(X,A),X = cpd_name(_)), forall(member(Y,B),Y = cpd_name(_)). cpd_set(ListOfCpds) :- forall(member(X,ListOfCpds),(functor(X,cpd_name,1),atom(X))). % bundle? component_rxns(SerialNum,ListComponentRxnsSerialNums) :- datum_id(SerialNum,rxn_name(_RxnName)), forall(member(Num,ListComponentRxnsSerialNums), datum_id(Num,rxn_name(_PrimaryNameComponentRxn))). nominal_pathway(SerialNum,ListComponentRxns) :- datum_id(SerialNum,nominal_pathway_abbrv(_PathwayFullName,_)), component_rxns(SerialNum,ListComponentRxns). nominal_pathway_name(PathwayFullName,ListComponentRxns) :- datum_id(SerialNum,nominal_pathway_abbrv(PathwayFullName,_)), component_rxns(SerialNum,ListComponentRxns). mol_states(ListMolStates) :- setof(MolState,mol_state(MolState),List), forall(member(X,ListMolStates),( memberchk(X,List) ; atom(X) )). compartments([extra-cellular_space, prok_cell_wall, periplasm, outer_membrane, inner_membrane, cytoplasm, prok_ribosome, nucleoid, prok_chromosome, extra-chromosomal_plasmid, prok_unk, prok_other, viral_coat, viral_tail, viral_head, viral_unk, viral_other, euk_cell_wall, membrane, cytoplasm, rough_endoplasmic_reticulum, smooth_endoplasmic_reticulum, euk_ribosome, mitochondrion, chloroplast, golgi, lysozome, proteosome, peroxysome, early_endosome, late_endosome, curl, endosome, microsome, coated_vesicles, vesicle, kinetoplast, nucleus, spindle_apparatus, chromatin, nucleolus, euk_chromosome, euk_unk, euk_other]). % form and query should be changed so these are bundled % bundled into path_termini to permit ready comparison % for identity of the two termini % definition of notion of path terminus per se bit circular! % Kazic 18.8.00. path_terminusa(Cpd,MolState) :- path_terminus(Cpd,MolState). path_terminusb(Cpd,MolState) :- path_terminus(Cpd,MolState). % use of module's code is a reminder to copy it here path_terminus(Cpd,MolState) :- Cpd, MolState, ( query:find_topo_connected_path(path_terminusa(Cpd,MolState), _, NumSteps, [], [], Paths) ; query:find_topo_connected_path(_, path_terminusb(Cpd,MolState), NumSteps, [], [], Paths) ), forall(member(X,Paths),single_edge(Cpd,MolState,X)). single_edge(Cpd,MolState,PathList) :- length(PathList,PathLen), ( delete((Cpd,MolState)-_,PathList,NuPathList) ; delete(_-(Cpd,MolState),PathList,NuPathList) ), length(NuPathList,NuPathLen), PathLen is NuPathLen + 1. % use of module's code is a reminder to copy it here % this is rather queasy-making since the underlying semantics are really % the same, we are just permitting a syntactic difference. ec_num_id(ECId) :- query_utilities:transform_ec_num(ECId,ECNum), ec_num(ECNum). ec_num_set(List) :- forall(member(X,List),(functor(X,ec_num_id,_),X)). % this is for transmitting data db_xref(accession(_EntryAccessionNameOrCodeFromContributingDatabase),rlted_db(_NameOfDataSource)). db_xref_status(accession(_EntryAccessionNameOrCodeFromContributingDatabase), accession_status(_StatusOfThisAccessionInThisDatabase), rlted_db(_NameOfDataSource)). % what datum has what xref? gotta fill in rest of the files upon green thing % cleanup. % % Kazic and Jiang, 16.4.04. datum_xref(Datum,db_xref(accession(Accession),rlted_db(DB))) :- ( semiote_semantics(Datum) ; bundle_semantics(Datum) ), bundle_semantics(db_xref(accession(Accession),rlted_db(DB))). organism(Genus,Species) :- genus(Genus), species(Species). markers(ListOfMarkers) :- forall(member(Marker,ListOfMarkers),marker(Marker)). encoding_loci_list(LociList) :- member(marker(_Marker),LociList). disease(_AClinicalDiseaseOrSyndrome,LocationList) :- memberchk(organism(_Genus,_Species),LocationList), ( ( memberchk(tissue(_Tissue),LocationList) ; memberchk(organ(_Organ),LocationList) ) -> true ; true ). disease_related(disease(_AClinicalDiseaseOrSyndrome,organism(_Genus,_Species)), RelatedEntity) :- ( RelatedEntity == ec_num(_,_,_,_) ; RelatedEntity == compound(_,_,_,_) ). organism_strain(organism(Genus,Species),Strain) :- organism(Genus,Species), strain(Strain). genotype(organism(Genus,Species),Genotype) :- organism(Genus,Species), memberchk(markers(_Markers),Genotype), ( memberchk(strain(_Strain),Genotype) ; memberchk(genetic_background(_Background)) ; true ). %%%%%%% bibliographic data alt_citkey_source(alt_cit_id(AltCitId),rlted_db(RltDb)) :- alt_citkey(_,AltCitKey), functor(AltCitKey,F,1), arg(1,F,AltCitId), ( ( F == medline_uid ; F == pubmed_id ; F == old_nlm_id ) -> RltDb = medline ; ( F == cas_citation_id -> RltDb = cas ; format('Warning! unknown bibliographic database in use.~n~n',[]) ) ). alt_citkey_source(rlted_db(_RltDb),alt_cit_id(_AltCitId)). medline_uid(MedlineUID) :- alt_citkey_source(alt_cit_id(MedlineUID),rlted_db(medline)). pubmed_uid(PubMedPMID) :- alt_citkey_source(alt_cit_id(PubMedPMID),rlted_db(pubmed)). cas_citation_id(CASCitationID) :- alt_citkey_source(alt_cit_id(CASCitationID),rlted_db(cas)). author(AuthorList) :- forall(member(X,AuthorList), ( X = person(Person), memberchk(given_names(_GivenNames),Person), memberchk(surname(_Surname),Person), ( memberchk(generatnl_part(_GenrtnlPart),Person) -> true ; true ))). editor(EditorList) :- forall(member(X,EditorList), ( X = person(Person), memberchk(given_names(_GivenNames),Person), memberchk(surname(_Surname),Person), ( memberchk(generatnl_part(_GenrtnlPart),Person) -> true ; true ))). citation(Key,Type,Citation) :- ( Key == citation_id(_) ; Key == temp_agora_citkey(_,_) ), memberchk(author(AuthorList),Citation), author(AuthorList), memberchk(start_page(_SP),Citation), memberchk(end_page(_EP),Citation), memberchk(year(_Year),Citation), ( Type == article -> memberchk(journal_title(_JournalTitle),Citation), memberchk(volume(_Volume),Citation), memberchk(article_title(_ArticleTitle),Citation), ( memberchk(abstract(_Abstract),Citation) -> true ; true ), ( memberchk(alt_citkey(rlted_db(_RltDb),alt_cit_id(_AltCitId)),Citation) -> true ; true ) ; ( ( Type == book ; Type == inbook ) -> memberchk(book_title(_BookTitle),Citation), memberchk(publisher(_Publisher),Citation), memberchk(address(_Address),Citation), ( memberchk(series_title(_SeriesTitle),Citation) -> true ; true ), ( memberchk(edition(_EditionOrdinalNumber),Citation) -> true ; true ), ( memberchk(isbn(_ISBNSerialNumber),Citation) -> true ; true ), ( memberchk(editor(EditorList),Citation) -> editor(EditorList) ; true ) ; format('This type of reference does not yet have defined semantics!~n~n~n',[]) ) ). % I have not wrapped the compound name to preserve first argument indexing. % this is identical to Klotho's config/2 predicate. config(_CompoundName,_KlothoConfigRule). % for an indirect reference in another database % can clearly have different functors for types of indirection indirect_ref(in_context(_LocalDB,_RemoteDBProvidingContextforFactInLocalDB)). % evidence for a datum in some context db_evidence(_DBAccProposedDatum,_DBAccDatumContext,_OriginDBAbbrv,_TypeEvidence). % ummm, what are those things we're sending back and forth? query(Query) :- call(Query). response(Response) :- nonvar(Response). % need notions of upper and lower bounds and ranges upper_bound(Operator,Bound) :- ( inclusive_op(Operator) ; exclusive_op(Operator) ), memberchk(Operator,[<,=<,@<,@=<]), bound(Bound). % assume inclusive_op upper_bd(Bound) :- ( Operator = '=<' ; Operator = '@=<'), upper_bound(Operator,Bound). lower_bound(Operator,Bound) :- ( inclusive_op(Operator) ; exclusive_op(Operator) ), memberchk(Operator,[>,>=,@>,@>=]), bound(Bound). % assume inclusive_op lower_bd(Bound) :- ( Operator = '>=' ; Operator = '@>='), lower_bound(Operator,Bound). range(lower_bound(OperatorLower,Lower),upper_bound(OperatorUpper,Upper)) :- lower_bound(OperatorLower,Lower), upper_bound(OperatorUpper,Upper). exclusions(List) :- ( forall(member(X,List),(Goal, \+ X)) ; Goal, \+ List ). inclusions(List) :- ( forall(member(X,List),(Goal, X)) ; Goal, List ). ec_group(ECNum) :- arg(4,ECNum,ec_serial_num(SN)), var(SN), ECNum. % comment(Target,Comment) :- % Target is semiote or bundle with datum % comment is text. % bundles defined either to provide some general information, or % to help with Javascript bundling of data agora :- true. super_bundle :- true. end_bundle :- true. % these are bundles, I suspect % deposit % review % query % revise % We need a bundle for molecular weight, and Nandini, Sumit, and I % agree this is a complex notion. % % Basu, Sadekar, Kazic % 17.5.04. mol_weight(cpd_name(CpdName),dalton(MolWeight)) :- cpd_name(CpdName), dalton(MolWeight). % dalton is a semiote %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % test!!! test_bundle(Bundle) :- ( is_list(Bundle) -> available_bundles(AvailBundles), ( delete(dcb(_,_),Bundle,RestBundle) -> identify_bundle(RestBundle,AvailBundles) ; identify_bundle(Bundle,AvailBundles) ) ; compound(Bundle), Goal = Bundle, call(Goal) ). identify_bundle(_,[]). identify_bundle(TestBundle,[AvailBundle|AvailBundles]) :- functor(Goal,AvailBundle,1), arg(1,Goal,TestBundle), call(Goal), identify_bundle(TestBundle,AvailBundles). % comparison must be symmetric; check set predicates is_unique_set(_,[]). is_unique_set(Set,[H|T]) :- ( is_list(H) -> setdiff(Set,H) ; compound(H), arg(1,H,Test), setdiff(Set,Test) ), is_unique_set(Set,T). available_bundles([reactant,catalyst,sinistras,dextras,catalysts,rxn_eqn]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% The following are obsolete bundles. %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% Pending on Toni's finalization/approval. %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% Composed on 12.08.2003 by Jiahui Jiang %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%