from neo4j.v1 import GraphDatabase, basic_auth
class Neo4jWriter():
def __init__(self):
config = configparser.ConfigParser()
config.read('config.ini')
class Person():
def __init__(self):
self.node_type = 'Person'
self.full_name = None
class Patent():
def __init__(self):
self.node_type = 'Patent'
MERGE (a: Person {"node_type": "Person", "full_name":"name"})
MERGE (a: Company {"node_type": "Company", "full_name":"name"})
MERGE (a: Patent {"node_type": "Patent", "title":"example", "grant_number":"9876541",
"publication_number":"20150222884", "application_number":"14611162"})
from IPStreet import client, query
# Instantiate IP Street Client
client = client.Client('IP_STREET_API_KEY',2)
# Instantiate a Query
query = query.PatentData()
# Add Filter Parameters to the Query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def split(filehandler, delimiter=',', row_limit=10000, | |
output_name_template='output_%s.csv', output_path='.', keep_headers=True): | |
""" | |
Splits a CSV file into multiple pieces. | |
A quick bastardization of the Python CSV library. | |
Arguments: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"totalPage": 1 | |
,"maxPerPage": 35 | |
,"pageStart" : 1 | |
,"Assets":[{ | |
"owner":"Hersch Reich; Megaspirea NV", | |
"ultimate_parent":"Megaspirea NV", | |
"inventor":"Mertens, Luc", | |
"patent_class":"US/53/460; IPC/B65B/0011/48", | |
"patent_office":"US", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for entity_name in entities_name_only: | |
response = search_by_owner(entity_name) | |
print(response.text) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import requests | |
def search_by_owner(entity_name): | |
endpoint = 'https://api.ipstreet.com/v1/data/patent' | |
headers = {'x-api-key': "Your_IPStreet_API_Key"} | |
payload = json.dumps({'q': {"owner":entity_name}}) | |
r = requests.post(endpoint, headers=headers, data=payload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
#read csv to workable list | |
with open('nodes.csv', 'r', encoding="utf-8") as raw: | |
reader = csv.reader(raw, delimiter=";") | |
entities_raw = list(reader) | |
#create empty list to be filled with names | |
entities_name_only = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
def hello_world(): | |
""" Hello World! example Concept Search API call | |
Prints a standard response json object when called """ | |
endpoint = 'https://api.ipstreet.com/v1/sandbox/claim_only' | |
headers = {'Authorization': '5AsaMTe6HUypUlAqv3Rw3E6Pvjo4dYL64Rr2z2va'} | |
payload = json.dumps({'raw_text': 'The quick brown fox jumps over the lazy dog'}) |