Skip to content

Instantly share code, notes, and snippets.

View tomasonjo's full-sized avatar
🏠
Working from home

Tomaz Bratanic tomasonjo

🏠
Working from home
View GitHub Profile
question cypher
When was Top Gun released? MATCH (m:Movie{title:'Top Gun'}) RETURN m.released
@tomasonjo
tomasonjo / marvel.cql
Last active November 3, 2023 19:59
Marvel.cql
// https://sandbox.neo4j.com/?usecase=graph-data-science-blank-sandbox
// constraints
CREATE CONSTRAINT IF NOT EXISTS FOR (c:Character) REQUIRE c.id IS UNIQUE;
CREATE CONSTRAINT IF NOT EXISTS FOR (c:Comic) REQUIRE c.id IS UNIQUE;
// import
:auto LOAD CSV WITH HEADERS FROM
{
"query": "MERGE (catalog:Microservice {name: 'CatalogService', technology: 'Java'}) MERGE (order:Microservice {name: 'OrderService', technology: 'Python'}) MERGE (user:Microservice {name: 'UserService', technology: 'Go'}) MERGE (payment:Microservice {name: 'PaymentService', technology: 'Node.js'}) MERGE (inventory:Microservice {name: 'InventoryService', technology: 'Java'}) MERGE (shipping:Microservice {name: 'ShippingService', technology: 'Python'}) MERGE (review:Microservice {name: 'ReviewService', technology: 'Go'}) MERGE (recommendation:Microservice {name: 'RecommendationService', technology: 'Node.js'}) MERGE (auth:Microservice {name: 'AuthService', technology: 'Node.js'}) MERGE (db:Microservice {name: 'Database', technology: 'SQL'}) MERGE (cache:Microservice {name: 'Cache', technology: 'In-memory'}) MERGE (mq:Microservice {name: 'MessageQueue', technology: 'Pub-Sub'}) MERGE (api:Microservice {name: 'ExternalAPI', technology: 'REST'}) MERGE (bugFixCatalog:Task {name: 'BugFix', description: 'Address a
from transformers import AutoTokenizer
from zero_shot_re import RelTaggerModel, RelationExtractor
model = RelTaggerModel.from_pretrained("fractalego/fewrel-zero-shot")
tokenizer = AutoTokenizer.from_pretrained("bert-large-uncased-whole-word-masking-finetuned-squad")
relations = ['associated', 'interacts']
extractor = RelationExtractor(model, tokenizer, relations)
MERGE (sun:AstronomicalObject {name: "Sun"})
MERGE (mercury:AstronomicalObject {name: "Mercury"})
MERGE (venus:AstronomicalObject {name: "Venus"})
MERGE (earth:AstronomicalObject {name: "Earth"})
MERGE (mars:AstronomicalObject {name: "Mars"})
MERGE (jupiter:AstronomicalObject {name: "Jupiter"})
MERGE (saturn:AstronomicalObject {name: "Saturn"})
MERGE (uranus:AstronomicalObject {name: "Uranus"})
MERGE (neptune:AstronomicalObject {name: "Neptune"})
MERGE (mercury)-[:ORBITS]->(sun)
instruction output
Who directed The Matrix? MATCH (m:Movie {title: 'The Matrix'})<-[:DIRECTED]-(d:Person) RETURN {director: d.name} AS result
timestamp endTime URL
648.18 667.92 https://youtube.com/watch?v=nrI483C5Tro&t=648
1455.24 1498.38 https://youtube.com/watch?v=nrI483C5Tro&t=1455
1514.58 1529.10 https://youtube.com/watch?v=nrI483C5Tro&t=1514
1537.86 1560.48 https://youtube.com/watch?v=nrI483C5Tro&t=1537
1664.64 1703.52 https://youtube.com/watch?v=nrI483C5Tro&t=1664
source relationship target mentions
morays INTERACTS_WITH Lionfish 1
morays HUNTS fishes 1
morays SHARE_HOME congareal 1
morays HUNTS_IN Reef 1
morays SEARCHES_FOR Female Moray 1
morays STAYS_IN Cave 1
morays HUNTS_IN coral head 1
morays ABLE_TO_GET_IN Cracks_and_Crevices 1
morays LIVES_IN reef 1
entity type mentions
morays animal 7
Lionfish animal 5
brittle star animal 3
monkfish animal 3
Cardinal fish animal 3
i entity
0 danger
1 column-shaped_foot
2 poisonous_tentacles
3 child protection
4 flirting