예제 #1
0
        public bool TryAddToolPublicationAssociation(Tool tool, ToolPublicationAssociation association)
        {
            if (tool == null ||
                association == null ||
                association.Publication == null ||
                ToolPublicationAssociationExists(tool, association))
            {
                return(false);
            }

            if (association.Publication.DOI != null)
            {
                ToolPubAssoByDOI.TryAdd(
                    GetAssociationHashKey(tool.Name, association.Publication.DOI),
                    association);
            }

            if (association.Publication.Title != null)
            {
                ToolPubAssoByTitle.TryAdd(
                    GetAssociationHashKey(tool.Name, association.Publication.Title),
                    association);
            }

            if (association.Publication.PubMedID != null)
            {
                ToolPubAssoByPMID.TryAdd(
                    GetAssociationHashKey(tool.Name, association.Publication.PubMedID),
                    association);
            }

            return(true);
        }
예제 #2
0
        public bool ToolPublicationAssociationExists(Tool tool, ToolPublicationAssociation association)
        {
            if (tool == null ||
                tool.Name == null ||
                association == null ||
                association.Publication == null)
            {
                return(false);
            }

            if (association.Publication.DOI != null &&
                ToolPubAssoByDOI.ContainsKey(GetAssociationHashKey(tool.Name, association.Publication.DOI)))
            {
                return(true);
            }

            if (association.Publication.PubMedID != null &&
                ToolPubAssoByPMID.ContainsKey(GetAssociationHashKey(tool.Name, association.Publication.PubMedID)))
            {
                return(true);
            }

            if (association.Publication.Title != null &&
                ToolPubAssoByTitle.ContainsKey(GetAssociationHashKey(tool.Name, association.Publication.Title)))
            {
                return(true);
            }

            return(false);
        }