J'essaie de récupérer les brevets de plusieurs organisations à partir de PatentsView. Des exemples sont disponibles sur http://www.patentsview.org/api/query-language.html

Voici ma requête:

import csv
import requests
import json

# Use this format for GET requests
url = 'http://www.patentsview.org/api/patents/query?q={"_and":[{"inventor_last_name":"Jobs"},{"assignee_lastknown_country":"US"}]}&f=["patent_number"]'

# This format is for POST
url1 = 'http://www.patentsview.org/api/patents/query'

# String contains the value string (http://www.patentsview.org/api/query-language.html)
body = '{"q":{"_contains":{"assignee_organization":["Samsung","Apple"]}},"f":["assignee_organization"]}'

url2 = 'http://www.patentsview.org/api/patents/query?q={"_contains": {"assignee_organization":["Samsung","Apple"]}}&f=["assignee_organization","patent_number","patent_title"]'

r = requests.get(url2)
# r = requests.post(url1,body)

print r.text

Le résultat de la requête est:

{"patents":[{"patent_number":"4221975","patent_title":"Touch activated controller and method","assignees":[{"assignee_organization":"Touch Activated Switch Arrays, Inc."}]},{"patent_number":"4288786","patent_title":"Touch sensing keyboard construction","assignees":[{"assignee_organization":"Touch Activated Switch Arrays, Inc."}]},{"patent_number":"4321479","patent_title":"Touch activated controller and method","assignees":[{"assignee_organization":"Touch Activated Switch Arrays, Inc."}]},{"patent_number":"4455452","patent_title":"Touch activated controller for generating X-Y output information","assignees":[{"assignee_organization":"Touch Activated Switch Arrays, Inc."}]},{"patent_number":"4689657","patent_title":"IC interconnect system using metal as a mask","assignees":[{"assignee_organization":"Lasarray Holding AG"}]},{"patent_number":"4691434","patent_title":"Method of making electrically conductive regions in monolithic semiconductor devices as applied to a semiconductor device","assignees":[{"assignee_organization":"Lasarray Holding AG"}]},{"patent_number":"4695698","patent_title":"Method of, and apparatus for, generating a predetermined pattern using laser radiation","assignees":[{"assignee_organization":"Lasarray Holding AG"}]},{"patent_number":"4695986","patent_title":"Ultrasonic transducer component and process for making the same and assembly","assignees":[{"assignee_organization":"Ultrasonic Arrays, Inc."}]},{"patent_number":"4733222","patent_title":"Capacitance-variation-sensitive touch sensing array system","assignees":[{"assignee_organization":"Integrated Touch Arrays, Inc."}]},{"patent_number":"4769793","patent_title":"Dual reference surface transducer","assignees":[{"assignee_organization":"Ultrasonic Arrays, Inc."}]},{"patent_number":"4790438","patent_title":"Electrical component sequential testing apparatus","assignees":[{"assignee_organization":"Array Instruments, Inc."}]},{"patent_number":"4809014","patent_title":"Apparatus for and method of positioning and synchronizing a writing laser beam","assignees":[{"assignee_organization":"Lasarray Holding AG"}]},{"patent_number":"4823590","patent_title":"Automatic calibration method for thickness gauges","assignees":[{"assignee_organization":"Ultrasonic Arrays, Inc."}]},{"patent_number":"4871896","patent_title":"Process and device to enhance system performance accuracy in a laser writing process","assignees":[{"assignee_organization":"Lasarray Holding AG"}]},{"patent_number":"4882657","patent_title":"Pin grid array assembly","assignees":[{"assignee_organization":"ICI Array Technology, Inc."}]},{"patent_number":"4887246","patent_title":"Ultrasonic apparatus, system and method","assignees":[{"assignee_organization":"Ultrasonic Arrays, Inc."}]},{"patent_number":"4888086","patent_title":"Ultrasonic method","assignees":[{"assignee_organization":"Ultrasonic Arrays, Inc."}]},{"patent_number":"4955225","patent_title":"Automatic calibration method for thickness gauges","assignees":[{"assignee_organization":"Ultrasonic Arrays, Inc."}]},{"patent_number":"5001714","patent_title":"Unpredictable fault detection using adaptive inference testing techniques","assignees":[{"assignee_organization":"Array Analysis, Inc."}]},{"patent_number":"5020011","patent_title":"System for displaying adaptive inference testing device information","assignees":[{"assignee_organization":"Array Analysis, Inc."}]},{"patent_number":"5029079","patent_title":"Apparatus and method for flexible control of digital signal processing devices","assignees":[{"assignee_organization":"Array Microsystems, Inc."}]},{"patent_number":"5043987","patent_title":"Method for calculating adaptive inference test figure of merit","assignees":[{"assignee_organization":"Array Analysis, Inc."}]},{"patent_number":"5046034","patent_title":"Array structure for use in an adaptive inference testing device","assignees":[{"assignee_organization":"Array Analysis, Inc."}]},{"patent_number":"5050173","patent_title":"Looped, phased array laser oscillator","assignees":[{"assignee_organization":"Phased Array Lasers Pty Ltd."}]},{"patent_number":"5068814","patent_title":"Interactive adaptive inference system","assignees":[{"assignee_organization":"Array Analysis, Inc."}]}],"count":25,"total_patent_count":601}

Pour une raison quelconque, le serveur semble considérer 'Array' dans le nom assignee organization. L'exécution de la même demande avec un seul nom de société semble fonctionner correctement.

Quelle est la bonne façon de résoudre le problème?

3
kurious 17 janv. 2017 à 02:12

2 réponses

Meilleure réponse

PatentsView dev ici, merci d'avoir soulevé cette question! Nous avons trouvé l'erreur d'argument de liste avec l'opérateur _contains et maintenant votre appel d'API d'origine devrait donner la réponse correcte:

http://www.patentsview.org/api/patents/query?q={"_contains":{"assignee_organization":["Samsung","Apple "]}}

3
RE.search 24 janv. 2017 à 19:27

Ressemble à ceci est un bogue dans l'API PatentsView comme leur exemple avec les noms de famille des inventeurs travaux ...

Cependant, cela fonctionne si vous utilisez l'opérateur "_or" comme indiqué ci-dessous. Remarque J'ai dû intégrer un "_contains" pour Samsung car l'API vérifie l'égalité et le nom correct du destinataire est "Samsung Electronics Co., Ltd." ...

import requests
url = 'http://www.patentsview.org/api/patents/query?'

query='q={"_or":[{"assignee_organization":"Apple"},{"_contains":{"assignee_organization":"Samsung"}}]}'
query+='&f=["patent_number","patent_title","assignee_organization","inventor_last_name"]'

results = requests.get(url+query)
results=results.json()

for r in results['patents']:
    print(r)
2
Dr. Goulu 24 janv. 2017 à 09:04