<% Session.Codepage=65001 '----------------------------------------------------------------------------------------------------------------------- ' PTaxonDetail.asp - August 2003 - Javier de la Torre ' Further development for Euro+Med by Anton G⢨ ' ' This file show information about one or more potential taxons. It can recieve different parameters and with them ' it constructs the SQL statements that are need to select all the PTaxon that match this criteria. ' When the PTaxon are selected then each one is represented inside a gray table. For each PTaxon there are many other ' connections to the database that had to be made to get all the needed information. ' ' Parameters: ' NameCache: String --> Cache field of the name table ' NameId: Integer --> Id of the Name of the potential taxons ' PTRefFk: integer --> Id of the reference of the potential taxons ' '----------------------------------------------------------------------------------------------------------------------- %> <% 'Specify if the project is IOPI, HACK!!!!--------------------------------------------- 'project="iopi" '---------------------------------------------------------------------------------------- Dim herarchy() Dim facts() ' Construct the SQL statement depending on the paramenter passed. ' That selects all the potential taxon. 'If the project is IOPI we have to select also the edition level of the potential taxon, and that makes the SQL statement different if project="iopi" then SQL="SELECT Name.NameCache, Name.FullNameCache, PTaxon.PTRefFk, Name.NameId, Reference.RefCache, EditionLevel FROM Name INNER JOIN PTaxon ON Name.NameId = PTaxon.PTNameFk INNER JOIN Reference ON PTaxon.PTRefFk = Reference.RefId LEFT OUTER JOIN ReferenceEditionLevel ON Reference.RefId = ReferenceEditionLevel.RefId" else SQL="SELECT Name.NameCache, Name.FullNameCache, PTaxon.PTRefFk, Name.NameId, Reference.RefCache FROM Name INNER JOIN PTaxon ON Name.NameId = PTaxon.PTNameFk INNER JOIN Reference ON PTaxon.PTRefFk = Reference.RefId" end if 'All potential taxon using a specific NameId if Request("NameId")<>"" then SQL=SQL&" WHERE Name.NameId = "& Request("NameId") if Request("PTRefFk")<>"" then SQL=SQL&" AND PTRefFk="& Request("PTRefFk") else Response.write("The actual WebPublisher doesn't support to display names not use in a potential taxon, sorry.") Response.end end if else SQL=SQL&" WHERE Name.NameId > 0" if Request("NameCache")<>"" then SQL=SQL&" AND Name.NameCache = '"& Replace(Request("NameCache"),"'","''") &"'" else SQL=SQL&" AND Name.Genus IS NULL" end if if Request("PTRefFk")<>"" then SQL=SQL&" AND PTRefFk="& Request("PTRefFk") end if end if 'We order them finally by the Edition Level, the references allready edited should be show first. if project="iopi" then SQL=SQL&" ORDER BY dbo.ReferenceEditionLevel.EditionLevel DESC, Reference.OrderApparence DESC" end if Set Recordset1 = Server.CreateObject("ADODB.Recordset") Recordset1.ActiveConnection = MM_jun_STRING Recordset1.Source = SQL Recordset1.CursorType = 3 Recordset1.CursorLocation = 2 Recordset1.LockType = 1 Recordset1.Open() if Request("NameCache")<>"" then NameTotal=Request("NameCache") else If Recordset1.Recordcount>0 then NameTotal=Recordset1("NameCache") end if end if %>
Details for: <%=NameTotal%>
<% ' Show the google images link only if is not a printer-frendly request if Request("Print")<>1 then %>
Link to species in Tropicos | Google Images

<%end if%> <% 'take the names of the different sources to create the navigation menu in the top Dim Sources ReDim Sources(0) s=0 While not Recordset1.eof sources(s)=Recordset1("RefCache") Redim Preserve sources(s+1) s=s+1 Recordset1.Movenext wend Recordset1.MoveFirst Dim NameA(7) If Recordset1.Recordcount > 0 then cont_sources=0 While NOT Recordset1.EOF 'counter for each movement cont_sources=cont_sources+1 'I first obtain the information that belongs to this potential taxon: 'IOPI!SQL="SELECT PTaxon.PTNameFk, PTaxon.PTRefFk, Status.Status, PTaxon.StatusFk, Reference.NomTitleAbbrev, Reference.RefCache, PTaxon.Notes, Type.TypeCache, Type.TypeId, Rank.Rank FROM Rank RIGHT JOIN ((Reference RIGHT JOIN (Name RIGHT JOIN (PTaxon LEFT JOIN Status ON PTaxon.StatusFk = Status.StatusId) ON Name.NameId = PTaxon.PTNameFk) ON Reference.RefId = PTaxon.PTRefFk) LEFT JOIN Type ON Name.TypeId = Type.TypeId) ON Rank.RankId = Name.RankFk WHERE (((PTaxon.PTNameFk)="&Recordset1("NameId")&") AND ((PTaxon.PTRefFk)="&Recordset1("PTRefFk")&"))" SQL="SELECT PTaxon.PTNameFk, PTaxon.DoubtfulFlag, PTaxon.PTRefFk, Status.Status, PTaxon.StatusFk, Reference.NomTitleAbbrev, Reference.RefCache, PTaxon.Notes, Rank.Rank, Rank.RankId FROM Rank RIGHT JOIN ((Reference RIGHT JOIN (Name RIGHT JOIN (PTaxon LEFT JOIN Status ON PTaxon.StatusFk = Status.StatusId) ON Name.NameId = PTaxon.PTNameFk) ON Reference.RefId = PTaxon.PTRefFk) ) ON Rank.RankId = Name.RankFk WHERE (((PTaxon.PTNameFk)="&Recordset1("NameId")&") AND ((PTaxon.PTRefFk)="&Recordset1("PTRefFk")&"))" Set Rptaxon = Server.CreateObject("ADODB.Recordset") Rptaxon.ActiveConnection = MM_jun_STRING Rptaxon.Source = SQL Rptaxon.CursorType = 3 Rptaxon.CursorLocation = 2 Rptaxon.LockType = 1 Rptaxon.Open() ' get the highertaxon relation (if any) to find out whether tis taxon has been linked provisionally ' Certainly bad programming style because the same information could be obtained with the previous ' query. SQl = "SELECT * FROM RelPTaxon WHERE (RelQualifierFk = 1) AND (PTNameFk1 = "&Recordset1("NameId")&") AND (PTRefFk1 = "&Recordset1("PTRefFk")&")" Set RHigherTaxon = Server.CreateObject("ADODB.Recordset") RHigherTaxon.ActiveConnection = MM_jun_STRING RHigherTaxon.Source = SQL RHigherTaxon.CursorType = 3 RHigherTaxon.CursorLocation = 2 RHigherTaxon.LockType = 1 RHigherTaxon.Open() 'First select all the information posible from this name SQL="SELECT Name.NameCache, Name.FullNameCache, Name.NameId, Name.Genus, Name.SpeciesEpi, Name.InfraSpeciesEpi, Name.GenusSubdivisionEpi, Reference.NomTitleAbbrev, Reference.Volume, RefDetail.Details, Reference.InRefFk, Reference.RefYear, RefDetail.FullNomRefCache, Name.AuthorTeamFk, Name.ExAuthorTeamFk, Name.BasAuthorTeamFk, Name.ExBasAuthorTeamFk, Rank.RankAbbrev, NomStatus.NomStatus, Name.Notes, Name.UnnamedNamePhrase, Name.RankFk FROM NomStatus RIGHT JOIN ((((Name LEFT JOIN Reference ON Name.NomRefFk = Reference.RefId) LEFT JOIN RefDetail ON Name.NomRefDetailFk = RefDetail.RefDetailId) INNER JOIN Rank ON Name.RankFk = Rank.RankId) LEFT JOIN NomStatusRel ON Name.NameId = NomStatusRel.NameFk) ON NomStatus.NomStatusId = NomStatusRel.NomStatusFk WHERE (((Name.NameId)="&Rptaxon("PTNameFk")&"))" Set Rname = Server.CreateObject("ADODB.Recordset") Rname.ActiveConnection = MM_jun_STRING Rname.Source = SQL Rname.CursorType = 3 Rname.CursorLocation = 2 Rname.LockType = 1 Rname.Open() '0--> Name Part (Juncus Roemeriani) '1--> Authors string (L.) '2--> Complete Reference starting with ", " (, Byull. Moskovsk. Obshch. Isp. Prir., Otd. Biol., 95: 117 (1990)) '3--> status part (,nom. illeg.) '4--> non part (,non Buchenau(1545)) '5--> total, all in the same 0+1+2+3+4 '6--> 0+1 '7--> Name notes if Rname("notes")="ll" then 'if there's something in the notes field i will use this as the complete name. This solution is valid for the IOPI project NameA(0)=Rname("FullNameCache") NameA(1)="Not parsed, see the notes" NameA(2)="Not parsed, see the notes" NameA(3)="Not parsed, see the notes" NameA(4)="Not parsed, see the name" NameA(5)=Rname("FullNameCache") NameA(6)=Rname("FullNameCache") NameA(7)=Rname("Notes") else 'I have to add the status of the name (nomenclature status). It's possible to have more than one status, but maximum here is 2 If Rname("NomStatus")<>"" then status_part= Rname("NomStatus") if Rname.Recordcount > 1 then 'There's more than one status Rname.movenext status_part=status_part & ", " & Rname("NomStatus") End if End if NameA(0)=Rname("NameCache") NameA(1)=Replace(Rname("FullNameCache"),Rname("NameCache"),"") NameA(2)=Rname("FullNomRefCache") NameA(3)=status_part NameA(4)=non_part NameA(5)=Rname("FullNameCache") &", "&Rname("FullNomRefCache") NameA(6)=Rname("FullNameCache") NameA(7)=Rname("Notes") end if Rname.close set Rname=Nothing %> <% ' Show the reference where is restricted the search. if Request("PTRefFk")<>"" then%> <%else%> <% 'only show the navigation menu of different sources one time: if cont_sources = 1 then %> <%=ubound(sources)%> different source(s) use this name:

<% for i=0 to (ubound(sources)-1) %> - <%=sources(i)%>
<%next%> <%end if%>
<%end if%> <% 'If we are in the IOPI project we change the colour of the table if the edition level for this Reference is set to 1 if Project="iopi" then if Recordset1("EditionLevel")=1 then table_color="#FFFFF2" else table_color="#F8F8F8" end if else table_color="#F8F8F8" end if %>
<% if len(NameA(2)) > 0 then %> <%end if %> <% if len(NameA(3)) > 0 then %> <%end if %> <% ' Search if the name has HOMONYMS and print them '------------------------------------------------------------------------------------------ SQL="SELECT NameFk1 FROM RelName WHERE NameFk2=" & Rptaxon("PTNameFk") &" AND RelNameQualifierFk=2" set Rhom = Server.CreateObject("ADODB.Recordset") Rhom.ActiveConnection = MM_jun_STRING Rhom.Source = SQL Rhom.CursorType = 3 Rhom.CursorLocation = 2 Rhom.LockType = 1 Rhom.Open() if Rhom.Recordcount > 0 then 'If it has homonyms show them, take the details. SQL="SELECT Name.NameId, Name.NameCache, Name.FullNameCache, Reference.RefYear FROM Name LEFT JOIN Reference ON Name.NomRefFk = Reference.RefId WHERE (Name.NameId = "& Rhom("NameFk1") &")" set Rhom_details = Server.CreateObject("ADODB.Recordset") Rhom_details.ActiveConnection = MM_jun_STRING Rhom_details.Source = SQL Rhom_details.CursorType = 3 Rhom_details.CursorLocation = 2 Rhom_details.LockType = 1 Rhom_details.Open() While Not Rhom_details.EOF non_part= Rhom_details("FullNameCache") if Rhom_details("RefYear")<>"" then non_part=non_part & " (" & Rhom_details("RefYear") & ")" end if %> <% Rhom_details.MoveNext wend Rhom_details.close() set Rhom_details = Nothing End if Rhom.close set Rhom = Nothing '--------------------------------------------------------------------------------------------- %> <% ' status of the taxon ---------------------------------------------------------------------------%> <% 'Search for replaced synonym an display it (if existing) '------------------------------------------------------------------------------------------------------ SQL="SELECT distinct dbo.Name.NameId, Name_1.NameId AS NameIdBas, Name_1.FullNameCache FROM dbo.Name Name_1 INNER JOIN Name INNER JOIN RelName ON Name.NameId = RelName.NameFk1 ON Name_1.NameId = RelName.NameFk2 WHERE (((Name.NameId)="&Rptaxon("PTNameFk")&") AND ((RelName.RelNameQualifierFk)=3))" Set RReplSyn = Server.CreateObject("ADODB.Recordset") RReplSyn.ActiveConnection = MM_jun_STRING RReplSyn.Source = SQL RReplSyn.CursorType = 3 RReplSyn.CursorLocation = 2 RReplSyn.LockType = 1 RReplSyn.Open() if RReplSyn.RecordCount > 0 then contador = 0 while not RReplSyn.EOF contador = contador + 1 %> <% RReplSyn.MoveNext Wend end if RReplSyn.close set RReplSyn=Nothing 'Look to see if it's a basyonym of something and print it. BASYONYM OF '------------------------------------------------------------------------------------------------------ SQL="SELECT distinct dbo.Name.NameId, Name_1.NameId AS NameIdBas, Name_1.FullNameCache FROM dbo.Name Name_1 INNER JOIN Name INNER JOIN RelName ON Name.NameId = RelName.NameFk1 ON Name_1.NameId = RelName.NameFk2 WHERE (((Name.NameId)="&Rptaxon("PTNameFk")&") AND ((RelName.RelNameQualifierFk)=1))" Set Rbas = Server.CreateObject("ADODB.Recordset") Rbas.ActiveConnection = MM_jun_STRING Rbas.Source = SQL Rbas.CursorType = 3 Rbas.CursorLocation = 2 Rbas.LockType = 1 Rbas.Open() if Rbas.RecordCount > 0 then contador = 0 while not Rbas.EOF contador = contador + 1 %> <% RBas.MoveNext Wend end if Rbas.close set Rbas=Nothing '------------------------------------------------------------------------------------------------------- %> <%' See where this taxon it's included. HERARCHY '------------------------------------------------------------------------------------------------------- 'only check herarchy if the PTaxon is accepted, if not is not supossed to be linked to anything (integrity rule) if Rptaxon("StatusFk")=1 then 'First we will store in an array all the herarchy in inverse order, then they will be shown. This array will ' be three dimensional, the first dimension will store the nameid, the second the refid and the tirth ' the namecache field. The very first is an index. nameid=Rptaxon("PTNameFk") refid=Rptaxon("PTRefFk") ReDim herarchy(3,0) control=1 cont=0 While control=1 SQL="SELECT PTaxon_1.PTNameFk, PTaxon_1.PTRefFk, Name.NameCache, Name.FullNameCache, Reference.RefCache, Name.Notes AS NameNotes, Rank.Rank"&_ " FROM (PTaxon AS PTaxon_1 INNER JOIN Name ON PTaxon_1.PTNameFk = Name.NameId) INNER JOIN (PTaxon INNER JOIN RelPTaxon ON (PTaxon.PTNameFk = RelPTaxon.PTNameFk1) AND (PTaxon.PTRefFk = RelPTaxon.PTRefFk1)) ON (PTaxon_1.PTNameFk = RelPTaxon.PTNameFk2) AND (PTaxon_1.PTRefFk = RelPTaxon.PTRefFk2) INNER JOIN Reference ON PTaxon_1.PTRefFk = Reference.RefId INNER JOIN Rank ON Name.RankFk = Rank.RankId"&_ " WHERE (((PTaxon.PTNameFk)="&nameid&") AND ((PTaxon.PTRefFk)="&refid&") AND ((RelPTaxon.RelQualifierFk)=1)) ORDER BY Name.NameCache" Set Rherar = Server.CreateObject("ADODB.Recordset") Rherar.ActiveConnection = MM_jun_STRING Rherar.Source = SQL Rherar.CursorType = 3 Rherar.CursorLocation = 2 Rherar.LockType = 1 Rherar.Open() if Rherar.Recordcount > 0 then nameid=Rherar("PTNameFk") refid=Rherar("PTRefFk") Redim Preserve herarchy(3,cont) herarchy(0,cont)=nameid herarchy(1,cont)=refid 'Show the reference as "sec." when the reference is different from the one using the potential taxon if Rherar("PTRefFk")<> refid then herarchy(2,cont)=""&Rherar("FullNameCache") & " sec. " & Rherar("RefCache") else herarchy(2,cont)=""&Rherar("FullNameCache") & "" end if herarchy(3,cont)=Rherar("Rank") cont=cont+1 else nameid="" refid="" control=0 end if Rherar.close set Rherar=Nothing Wend If herarchy(0,0)<>"" then %> <% end if Redim herarchy(0) herarchy(0)="" end if '---------------------------------------------------------------------------------------------------------- %> <% ' If the taxon is a synonymum find the accepted name. ACCEPTED NAME '--------------------------------------------------------------------------------------------------- if Rptaxon("StatusFk")=2 then SQL="SELECT PTaxon_1.PTNameFk, PTaxon_1.PTRefFk, Name.NameCache, Name.FullNameCache, Name.Notes AS NameNotes"&_ " FROM (PTaxon AS PTaxon_1 INNER JOIN Name ON PTaxon_1.PTNameFk = Name.NameId) INNER JOIN (PTaxon INNER JOIN RelPTaxon ON (PTaxon.PTNameFk = RelPTaxon.PTNameFk1) AND (PTaxon.PTRefFk = RelPTaxon.PTRefFk1)) ON (PTaxon_1.PTNameFk = RelPTaxon.PTNameFk2) AND (PTaxon_1.PTRefFk = RelPTaxon.PTRefFk2)"&_ " WHERE (((PTaxon.PTNameFk)="&Rptaxon("PTNameFk")&") AND ((PTaxon.PTRefFk)="&Rptaxon("PTRefFk")&") AND ((RelPTaxon.RelQualifierFk) in (2, 4, 5, 6, 7))) ORDER BY Name.NameCache" Set Racc = Server.CreateObject("ADODB.Recordset") Racc.ActiveConnection = MM_jun_STRING Racc.Source = SQL Racc.CursorType = 3 Racc.CursorLocation = 2 Racc.LockType = 1 Racc.Open() if Racc.Recordcount>0 then contador=0 While NOT Racc.EOF contador=contador+1 %> <% Racc.Movenext Wend Racc.Close set Racc=Nothing end if end if '--------------------------------------------------------------------------------------------------------------- %> <% 'Look for replaced synonyms '----------------------------------------------------------------------------------------------------------------- SQL="SELECT DISTINCT dbo.Name.NameId, Name_1.NameId AS NameIdBas, Name_1.FullNameCache FROM Name Name_1 INNER JOIN Name INNER JOIN RelName ON Name.NameId = RelName.NameFk2 ON Name_1.NameId = RelName.NameFk1 WHERE (((Name.NameId)="&Rptaxon("PTNameFk")&") AND ((RelName.RelNameQualifierFk)=3))" Set RReplSyn = Server.CreateObject("ADODB.Recordset") RReplSyn.ActiveConnection = MM_jun_STRING RReplSyn.Source = SQL RReplSyn.CursorType = 3 RReplSyn.CursorLocation = 2 RReplSyn.LockType = 1 RReplSyn.Open() if RReplSyn.RecordCount > 0 then %> <% end if RReplSyn.close set RReplSyn=Nothing '---------------------------------------------------------------------------------------------------------------- 'Look to see if it has a basyonym of something. BASYONYM '----------------------------------------------------------------------------------------------------------------- SQL="SELECT DISTINCT dbo.Name.NameId, Name_1.NameId AS NameIdBas, Name_1.FullNameCache FROM Name Name_1 INNER JOIN Name INNER JOIN RelName ON Name.NameId = RelName.NameFk2 ON Name_1.NameId = RelName.NameFk1 WHERE (((Name.NameId)="&Rptaxon("PTNameFk")&") AND ((RelName.RelNameQualifierFk)=1))" Set Rbas = Server.CreateObject("ADODB.Recordset") Rbas.ActiveConnection = MM_jun_STRING Rbas.Source = SQL Rbas.CursorType = 3 Rbas.CursorLocation = 2 Rbas.LockType = 1 Rbas.Open() if Rbas.RecordCount > 0 then %> <% end if Rbas.close set Rbas=Nothing '---------------------------------------------------------------------------------------------------------------- %> <% 'Look for synonyms only if the potential taxon is accepted. SYNONYMS '---------------------------------------------------------------------------------------------------------------- if Rptaxon("StatusFk")=1 then SQL="SELECT PTaxon_1.PTNameFk, PTaxon_1.PTRefFk AS PTRefFk_s, Name.NameCache, Name.FullNameCache, Name.Notes AS NameNotes, PTaxon.PTRefFk AS PTRefFk, RelPTQualifier.RelPTQualifier"&_ " FROM (PTaxon AS PTaxon_1 INNER JOIN (PTaxon INNER JOIN RelPTaxon ON (PTaxon.PTNameFk = RelPTaxon.PTNameFk2) AND (PTaxon.PTRefFk = RelPTaxon.PTRefFk2)) ON (PTaxon_1.PTNameFk = RelPTaxon.PTNameFk1) AND (PTaxon_1.PTRefFk = RelPTaxon.PTRefFk1)) INNER JOIN Name ON PTaxon_1.PTNameFk = Name.NameId INNER JOIN RelPTQualifier ON RelPTaxon.RelQualifierFk = RelPTQualifier.RelPTQualifierId "&_ " WHERE (((PTaxon.PTNameFk)="&Rptaxon("PTNameFk")&") AND ((PTaxon.PTRefFk)="&Rptaxon("PTRefFk")&") AND ((RelPTaxon.RelQualifierFk) in (2,4,5,6,7))) ORDER BY RelPTQualifier.RelPTQualifier DESC,Name.RankFk, Name.NameCache" Set Rsyn = Server.CreateObject("ADODB.Recordset") Rsyn.ActiveConnection = MM_jun_STRING Rsyn.Source = SQL Rsyn.CursorType = 3 Rsyn.CursorLocation = 2 Rsyn.LockType = 1 Rsyn.Open() if Rsyn.Recordcount>0 then contador=0 syn_rel="" While NOT Rsyn.EOF contador=contador+1 %> <% syn_rel=Rsyn("RelPTQualifier") Rsyn.Movenext Wend Rsyn.Close set Rsyn=Nothing end if end if '------------------------------------------------------------------------------------------------------------------- %> <% 'Look for concept synonyms only if the potential taxon is accepted CONCEPT SYNONYMS if Rptaxon("StatusFk")=1 then SQL="SELECT RelQualifierFk, NameId, Reference.RefId, NameCache, FullNameCache, Name.Notes AS NameNotes, RelPTQualifier AS RelQualifier, RelPTaxon.Notes AS RelNotes, Reference.RefCache, RelRefFk, is_congruent, is_included_in, includes, overlaps, excludes, doubtful, Reference_1.RefCache AS RelRefCache, RankFk "&_ "FROM RelPTQualifier INNER JOIN "&_ " RelPTaxon ON RelPTQualifier.RelPTQualifierId = RelPTaxon.RelQualifierFk INNER JOIN "&_ " Name ON RelPTaxon.PTNameFk2 = Name.NameId INNER JOIN "&_ " Reference ON RelPTaxon.PTRefFk2 = Reference.RefId INNER JOIN "&_ " Reference Reference_1 ON RelPTaxon.RelRefFk = Reference_1.RefId "&_ "WHERE (RelPTaxon.RelQualifierFk > 9) AND (RelPTaxon.PTRefFk1 = "&Rptaxon("PTRefFk")&") AND (RelPTaxon.PTNameFk1 = "&Rptaxon("PTNameFk")&") "&_ "union "&_ "SELECT RelQualifierFk, NameId, Reference.RefId, NameCache, FullNameCache, Name.Notes AS NameNotes, RelPTQualifier AS RelQualifier, RelPTaxon.Notes AS RelNotes, Reference.RefCache, RelRefFk, is_congruent, is_included_in, includes, overlaps, excludes, doubtful, Reference_1.RefCache AS RelRefCache, RankFk "&_ "FROM RelPTQualifier INNER JOIN "&_ " RelPTaxon ON RelPTQualifier.RelPTQualifierId = dbo.f_core_Reverse(RelPTaxon.RelQualifierFk) INNER JOIN "&_ " Name ON RelPTaxon.PTNameFk1 = Name.NameId INNER JOIN "&_ " Reference ON RelPTaxon.PTRefFk1 = Reference.RefId INNER JOIN "&_ " Reference Reference_1 ON RelPTaxon.RelRefFk = Reference_1.RefId "&_ "WHERE (RelPTaxon.RelQualifierFk > 9) AND (RelPTaxon.PTRefFk2 = "&Rptaxon("PTRefFk")&") AND (RelPTaxon.PTNameFk2 = "&Rptaxon("PTNameFk")&") "&_ "order by RelQualifierFk, RelRefFk, RankFk, namecache" Set Rcsyn = Server.CreateObject("ADODB.Recordset") Rcsyn.ActiveConnection = MM_jun_STRING Rcsyn.Source = SQL Rcsyn.CursorType = 3 Rcsyn.CursorLocation = 2 Rcsyn.LockType = 1 Rcsyn.Open() if Rcsyn.Recordcount>0 then %> <% contador=0 ult_ref="" While NOT Rcsyn.EOF contador=contador+1 %> <%if Rcsyn("RelRefCache")<>ult_ref then%> <%end if%> <% Rcsyn.Movenext if NOT Rcsyn.EOF then ult_ref=Rcsyn("RelRefCache") end if Wend Rcsyn.Close set Rcsyn=Nothing end if end if '------------------------------------------------------------------------------------------------------------------ %> <% 'Look for missaplied names only if the potential taxon is accepted MISSAPLIED NAMES if Rptaxon("StatusFk")=1 then SQL="SELECT PTaxon_1.PTNameFk, PTaxon_1.PTRefFk AS PTRefFk_s, Name.NameCache, Name.FullNameCache, Name.Notes AS NameNotes, PTaxon.PTRefFk AS PTRefFk, RelPTQualifier.RelPTQualifier as RelQualifier, RelPTaxon.Notes as RelNotes, Reference.RefCache"&_ " FROM (PTaxon AS PTaxon_1 INNER JOIN (PTaxon INNER JOIN RelPTaxon ON (PTaxon.PTNameFk = RelPTaxon.PTNameFk2) AND (PTaxon.PTRefFk = RelPTaxon.PTRefFk2)) ON (PTaxon_1.PTNameFk = RelPTaxon.PTNameFk1) AND (PTaxon_1.PTRefFk = RelPTaxon.PTRefFk1)) INNER JOIN Name ON PTaxon_1.PTNameFk = Name.NameId INNER JOIN RelPTQualifier ON RelPTaxon.RelQualifierFk = RelPTQualifier.RelPTQualifierId INNER JOIN Reference ON PTaxon_1.PTRefFk = Reference.RefId"&_ " WHERE (((PTaxon.PTNameFk)="&Rptaxon("PTNameFk")&") AND ((PTaxon.PTRefFk)="&Rptaxon("PTRefFk")&") AND ((RelPTaxon.RelQualifierFk)=3)) ORDER BY Name.NameCache" Set Rmiss = Server.CreateObject("ADODB.Recordset") Rmiss.ActiveConnection = MM_jun_STRING Rmiss.Source = SQL Rmiss.CursorType = 3 Rmiss.CursorLocation = 2 Rmiss.LockType = 1 Rmiss.Open() if Rmiss.Recordcount>0 then contador=0 While NOT Rmiss.EOF contador=contador+1 %> <% Rmiss.Movenext Wend Rmiss.Close set Rmiss=Nothing end if end if '------------------------------------------------------------------------------------------------------------------ %> <% 'Look for included taxa only if the potential taxon is accepted. '------------------------------------------------------------------------------------------------------------------- if Rptaxon("StatusFk")=1 then SQL="SELECT PTaxon_1.PTNameFk, PTaxon_1.PTRefFk, Name.FullNameCache, Reference.RefCache, Reference.RefId AS RefId, Provisional "&_ "FROM Reference INNER JOIN ((PTaxon AS PTaxon_1 INNER JOIN (PTaxon INNER JOIN RelPTaxon ON (PTaxon.PTNameFk = RelPTaxon.PTNameFk2) AND (PTaxon.PTRefFk = RelPTaxon.PTRefFk2)) ON (PTaxon_1.PTNameFk = RelPTaxon.PTNameFk1) AND (PTaxon_1.PTRefFk = RelPTaxon.PTRefFk1)) INNER JOIN Name ON PTaxon_1.PTNameFk = Name.NameId) ON Reference.RefId = PTaxon_1.PTRefFk "&_ "WHERE (((PTaxon.PTNameFk)="&Rptaxon("PTNameFk")&") AND ((PTaxon.PTRefFk)="&Rptaxon("PTRefFk")&") AND ((RelPTaxon.RelQualifierFk)=1)) "&_ "ORDER BY Name.RankFk DESC, Name.FullNameCache" Set Rinclu = Server.CreateObject("ADODB.Recordset") Rinclu.ActiveConnection = MM_jun_STRING Rinclu.Source = SQL Rinclu.CursorType = 3 Rinclu.CursorLocation = 2 Rinclu.LockType = 1 Rinclu.Open() if Rinclu.Recordcount>0 then contador=0 %><% While NOT Rinclu.EOF contador=contador+1 %> <% Rinclu.Movenext Wend Rinclu.Close set Rinclu=Nothing end if end if '-------------------------------------------------------------------------------------------------------------------------- %> <% 'There are two type of notes here, the one from the potential taxon and the one from the name. Show them if there´s something inside '--------------------------------------------------------------------- if NameA(7)<>"" then %> <% end if %> <% if Rptaxon("Notes")<>"" then %> <%end if%> <% ' Euro+Med occurrence section (should be moved to project specific file ...) 'if Rptaxon("StatusFk")=1 then ' sql = "select OccurrenceString = dbo.f_em_outputCreateFinalOccurrenceStr(" & RPTaxon("PTNameFk") & "," &RPTaxon("PTRefFk") & ")" ' Set ROccurrence = Server.CreateObject("ADODB.Recordset") ' ROccurrence.ActiveConnection = MM_jun_STRING ' ROccurrence.Source = SQL ' ROccurrence.CursorType = 3 ' ROccurrence.CursorLocation = 2 ' ROccurrence.LockType = 1 ' ROccurrence.Open() ' If ROccurrence("OccurrenceString") <> "" then %> <% '=ROccurrence("OccurrenceString") %> <% ' end if 'end if %> <% 'Select all the facts and present them FACTS '------------------------------------------------------------------------------------------------------------------------ 'We need to see if the column "Visible" is in the FactCategory Table to use it or not. 'if it is no present then all factcategories will be shown. SQL="SELECT sysobjects.name AS Exp1 FROM sysobjects INNER JOIN syscolumns ON sysobjects.id = syscolumns.id WHERE (sysobjects.name LIKE 'FactCategory') AND (syscolumns.name LIKE N'Visible')" Set RVisibleCol = Server.CreateObject("ADODB.Recordset") RVisibleCol.ActiveConnection = MM_jun_STRING RVisibleCol.Source = SQL RVisibleCol.CursorType = 3 RVisibleCol.CursorLocation = 2 RVisibleCol.LockType = 1 RVisibleCol.Open() if RVisibleCol.RecordCount > 0 then VisibleColExist= True else VisibleColExist= False end if RVisibleCol.close set RVisibleCol=Nothing 'I create a different SQL depending if the Visible column exist or not in the database if VisibleColExist= True then SQL="SELECT DISTINCT PTaxon.PTNameFk, PTaxon.PTRefFk, FactCategory.FactCategory, FactCategory.FactCategoryId , FactCategory.Visible, Fact = dbo.f_em_outputWrapFact(Fact.Fact), FactCategory.MaxFactNumber FROM (PTaxon INNER JOIN Fact ON (PTaxon.PTRefFk = Fact.PTRefFk) AND (PTaxon.PTNameFk = Fact.PTNameFk)) INNER JOIN FactCategory ON Fact.FactCategoryFk = FactCategory.FactCategoryId WHERE (Fact.PublishFlag = 1) AND (((PTaxon.PTNameFk)="& Rptaxon("PTNameFk")&") AND ((PTaxon.PTRefFk)="& Rptaxon("PTRefFk")&")) ORDER BY FactCategory.FactCategory" Else SQL="SELECT DISTINCT PTaxon.PTNameFk, PTaxon.PTRefFk, FactCategory.FactCategory, FactCategory.FactCategoryId , Fact = dbo.f_em_outputWrapFact(Fact.Fact), FactCategory.MaxFactNumber FROM (PTaxon INNER JOIN Fact ON (PTaxon.PTRefFk = Fact.PTRefFk) AND (PTaxon.PTNameFk = Fact.PTNameFk)) INNER JOIN FactCategory ON Fact.FactCategoryFk = FactCategory.FactCategoryId WHERE (Fact.PublishFlag = 1) AND (((PTaxon.PTNameFk)="& Rptaxon("PTNameFk")&") AND ((PTaxon.PTRefFk)="& Rptaxon("PTRefFk")&")) ORDER BY FactCategory.FactCategory" End if Set Rfacts = Server.CreateObject("ADODB.Recordset") Rfacts.ActiveConnection = MM_jun_STRING Rfacts.Source = SQL Rfacts.CursorType = 3 Rfacts.CursorLocation = 2 Rfacts.LockType = 1 Rfacts.Open() if Rfacts.RecordCount > 0 then Rfacts.Requery '-------------------------------------------------------- 'To concatenate the facts by category first all of them are included in an array Redim facts(1,0) control=0 'I will use a different code depending if the Visible column exist or not, using the VisibleColExist= True While not Rfacts.eof if VisibleColExist= True then if control> 0 then 'Only add the fact to the array if it can be output (MaxFactNumber<>0) if Rfacts("Visible")=True then if facts(0,control-1)=Rfacts("FactCategory") then facts(1,control-1)=facts(1,control-1) & ", " & Rfacts("Fact") else Redim preserve facts(1,control) facts(0,control)=Rfacts("FactCategory") facts(1,control)=Rfacts("Fact") control=control+1 end if end if else if Rfacts("Visible")=True then facts(0,0)=Rfacts("FactCategory") facts(1,0)=Rfacts("Fact") control=1 else control=0 end if end if Else if control> 0 then if facts(0,control-1)=Rfacts("FactCategory") then facts(1,control-1)=facts(1,control-1) & ", " & Rfacts("Fact") else Redim preserve facts(1,control) facts(0,control)=Rfacts("FactCategory") facts(1,control)=Rfacts("Fact") control=control+1 end if else facts(0,0)=Rfacts("FactCategory") facts(1,0)=Rfacts("Fact") control=1 end if End if Rfacts.MoveNext Wend Rfacts.close set Rfacts=Nothing for i=0 to ubound(facts,2) %> <% next end if '----------------------------------------------------------------------------------------------------------------------- %>
Source: <%=Rptaxon("Refcache")%>

Name: <%=NameA(6)%> <% If RHigherTaxon.Recordcount > 0 Then %> <% If (RHigherTaxon("Provisional") = True) Then%> [provisional placement] <% End If%> <% End If%>
Nomencl. ref.: <%=NameA(2)%>
Nomencl. status(es) <%=NameA(3)%>
Homonym(s): <%=non_part%>
Rank: <%=Rptaxon("Rank")%>
Status: <%if Rptaxon("StatusFk")=1 then%> <%else%> <%end if%> <% ' If the DoubtfulFlag is set to d then show a PRELIMARY text in fron of the status if Rptaxon("DoubtfulFlag")="d" then%>PRELIMINARY<% end if %> <%=ucase(Rptaxon("Status"))%>
<% if contador = 1 then%>Is replaced synonym for:<% end if %> <%=RReplSyn("FullNameCache")%>
<% if contador = 1 then%>Is basionym for:<% end if %> <%=Rbas("FullNameCache")%>
Taxonomy (this taxon is included in): <% col=0 for i=ubound(herarchy,2) to 0 step -1 %> <%=herarchy(3,i)%> - <%=herarchy(2,i)%>
<%for c=0 to col%>    <%next%> <% col=col+1 next %>
<%if contador=1 then%>Synonym of:<%end if%> &PTRefFk=<%=Racc("PTRefFk")%>"><%=Racc("FullNameCache")%>
Replaced synonym: <%=RReplSyn("FullNameCache")%>
Basionym: <%=Rbas("FullNameCache")%>
<%if contador=1 or syn_rel<>Rsyn("RelPTQualifier") then%> <%=ucase(left(Trim(Replace(Replace(Rsyn("RelPTQualifier"),"is",""),"of","")),1))&right(Trim(Replace(Replace(Rsyn("RelPTQualifier"),"is",""),"of","")),len(Trim(Replace(Replace(Rsyn("RelPTQualifier"),"is",""),"of","")))-1)&"(s):"%> <%end if%> &PTRefFk=<%=Rsyn("PTRefFk_s")%>"><%=Rsyn("FullNameCache")%>
Concept Synonym(s):  
  According to: <%=Rcsyn("RelRefCache")%>
  <% 'Construct a string concatenating the images that are needed to represent the concept relation concept_images="" if Rcsyn("is_congruent")<>0 then concept_images="" if Rcsyn("is_included_in")<>0 then if concept_images<>"" then concept_images=concept_images&"," else concept_images="" end if end if if Rcsyn("includes")<>0 then if concept_images<>"" then concept_images=concept_images&"," else concept_images="" end if end if if Rcsyn("overlaps")<>0 then if concept_images<>"" then concept_images=concept_images&"," else concept_images="" end if end if if Rcsyn("excludes")<>0 then if concept_images<>"" then concept_images=concept_images&"," else concept_images="" end if end if concept_images="{"&concept_images&"}" if Rcsyn("doubtful")<>0 then concept_images="?"&concept_images %> <%=concept_images%> &PTRefFk=<%=Rcsyn("RefId")%>"><%=Rcsyn("FullNameCache")%> sec. <%=Rcsyn("RefCache")%> <%=Rcsyn("RelNotes")%>
<%if contador=1 then%> Misapplied name(s): <%end if%> &PTRefFk=<%=Rmiss("PTRefFk_s")%>"><%=Rmiss("FullNameCache")%> sec. <%=Rmiss("RefCache")%> [<%=Rmiss("RelQualifier")%>] <%=Rmiss("RelNotes")%>
<%if contador=1 then%> Included taxa: <%end if%> &PTRefFk=<%=Rinclu("PTRefFk")%>"><%=Rinclu("FullNameCache")%> <% if (Rinclu("Provisional") = True) Then %> [provisional placement] <% end if%>
Taxon Notes: <%=Rptaxon("Notes")%>
 
<%=facts(0,i)%>: <%=facts(1,i)%>
<% Rptaxon.close set Rptaxon = Nothing Recordset1.MoveNext Wend %> <% ' Message indicating that there was no potential taxon using this name ---------------- '---------------------------------------------------------------------------------------------------------------------- else %>
There are no potential taxons using this name!
<% '----------------------------------------------------------------------------------------------------------------------- end if Recordset1.close set Recordset1 = Nothing RHigherTaxon.close set RHigherTaxon = Nothing %>