Editing
Knowledge Graphs
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== <span style="color: #FFFFFF;">Applying</span> == '''Building and querying a knowledge graph with Neo4j (Python driver):''' <syntaxhighlight lang="python"> from neo4j import GraphDatabase driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "password")) def create_knowledge_graph(session): """Create a simple research knowledge graph.""" # Create entities and relationships using Cypher session.run(""" MERGE (p:Person {name: 'Geoffrey Hinton'}) MERGE (u:University {name: 'University of Toronto'}) MERGE (a:Award {name: 'Nobel Prize in Physics'}) MERGE (c:Concept {name: 'Backpropagation'}) MERGE (p)-[:WORKED_AT {from: 1987, to: 2023}]->(u) MERGE (p)-[:RECEIVED {year: 2024}]->(a) MERGE (p)-[:PIONEERED]->(c) MERGE (c)-[:ENABLES]->(deep:Concept {name: 'Deep Learning'}) """) def find_award_winners_and_contributions(session): """Find Nobel Prize winners and what they pioneered.""" result = session.run(""" MATCH (p:Person)-[:RECEIVED]->(a:Award {name: 'Nobel Prize in Physics'}) MATCH (p)-[:PIONEERED]->(c:Concept) RETURN p.name AS person, c.name AS contribution ORDER BY p.name """) return [dict(record) for record in result] def multi_hop_query(session, concept_name): """Find all researchers connected to a concept within 2 hops.""" result = session.run(""" MATCH path = (p:Person)-[:PIONEERED|CONTRIBUTED_TO*1..2]->(c:Concept) WHERE c.name CONTAINS $concept RETURN p.name AS researcher, [node in nodes(path) | node.name] AS path_names LIMIT 10 """, concept=concept_name) return [dict(record) for record in result] with driver.session() as session: create_knowledge_graph(session) winners = find_award_winners_and_contributions(session) print(winners) </syntaxhighlight> ; Knowledge graph construction pipeline : '''Manual curation''' β Domain experts curate high-precision triples (medical ontologies, legal KGs) : '''Crowd-sourced''' β Wikidata model: community contributes and validates : '''Information extraction''' β NER + relation extraction from text corpora (automated, noisy) : '''Web scraping + structured sources''' β Infoboxes, tables, linked data sources (Freebase model) : '''Hybrid''' β Automated extraction + expert curation + community correction </div> <div style="background-color: #8B4500; color: #FFFFFF; padding: 20px; border-radius: 8px; margin-bottom: 15px;">
Summary:
Please note that all contributions to BloomWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
BloomWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information