예제 #1
0
        /// <inheritdoc />
        protected override void MergeCore(Patent target, ExchangeDocument source)
        {
            // publication
            var publication = ExtractDocumentID(source.Bibliographic.PublicationReference?.DocumentID) ?? throw new ArgumentException("missing publication reference");

            target.PublicationDate   = ExtractReferenceDate(source.Bibliographic.PublicationReference?.DocumentID);
            target.PublicationNumber = new PatentNumber(publication.Country, publication.Number, publication.Kind);

            // application
            var application = ExtractDocumentID(source.Bibliographic.ApplicationReference?.DocumentID) ?? throw new ArgumentException("missing application reference");

            target.ApplicationDate   = ExtractReferenceDate(source.Bibliographic.ApplicationReference?.DocumentID);
            target.ApplicationNumber = new PatentNumber(application.Country, application.Number);

            // first priority
            var firstPriority = ExtractFirstPriority(source);

            if (firstPriority != null)
            {
                target.FirstPriorityDate   = OPSConverter.ToDateTime(firstPriority.Date);
                target.FirstPriorityNumber = new PatentNumber(firstPriority.Number.Substring(0, 2), firstPriority.Number.Substring(2));
            }

            // texts
            target.Abstract = ExtractAbstract(source);
            target.Title    = ExtractTitle(source);

            // classifications
            target.CPC = ExtractCPC(source)?.Split(';');
            target.IPC = ExtractIPC(source)?.Split(';');

            // parties
            target.Applicants = ExtractApplicants(source)?.Split(';');
            target.Inventors  = ExtractInventors(source)?.Split(';');
        }
예제 #2
0
 private DocumentID ExtractFirstPriority(ExchangeDocument source)
 {
     return(source.Bibliographic.PriorityClaims?
            .Select(e => e.DocumentID.FirstOrDefault(d => d.Type == "epodoc"))
            .Where(e => e != null && !string.IsNullOrWhiteSpace(e.Date))
            .OrderBy(e => OPSConverter.ToDateTime(e.Date))
            .FirstOrDefault());
 }
        public RequestManager(string keys)
        {
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            _client = new HttpClient {
                BaseAddress = new Uri(OPSConstants.Server)
            };
            _consumer = OPSConverter.ToBase64(keys);
        }
        private DateTime?ExtractReferenceDate(DocumentID[] sources)
        {
            if (sources == null || sources.Length == 0)
            {
                return(null);
            }

            var target = ExtractDocumentID(sources);
            var output = OPSConverter.ToDateTime(target?.Date);

            if (output.HasValue)
            {
                return(output);
            }

            target = ExtractDocumentID(sources, "epodoc");
            return(OPSConverter.ToDateTime(target?.Date));
        }