Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Neo4J backend #50

Open
nichtich opened this issue Jun 12, 2024 · 1 comment
Open

Add Neo4J backend #50

nichtich opened this issue Jun 12, 2024 · 1 comment

Comments

@nichtich
Copy link
Member

Subjects and occurences can also be retrieved from a Neo4J (or compatible) Property Graph database. Requires documentation of the database model and CYPHER queries for each query type. The backend graph is going to be created anyway with https://github.com/gbv/k10plus-graph

@MontyBitto
Copy link

MontyBitto commented Jun 12, 2024

CYPHER queries for each query type:

occurrences
MATCH (t:title)-[]->(n:?) WHERE n.notation = "?" RETURN count(t) AS freq

coOccurrences
MATCH (t:title)-[]->(n:?) WHERE n.notation = "?" MATCH (t)-[]->(m:?) RETURN head(LABELS(m)), m.notation, count(m) AS freq

subjects
MATCH (t:title)-[]->(n) WHERE t.ppn = "?" RETURN head(LABELS(n)), n.notation

records
MATCH (t:title)-[]->(n:?) WHERE n.notation = "?" RETURN t.ppn LIMIT ?

CYPHER queries with their respective sample query:

occurrences of RVK DG 9000
MATCH (t:title)-[]->(r:rvk) WHERE r.notation = "DG 9000" RETURN count(t)

co-occurrences of RVK DG 9000 in BK
MATCH (t:title)-[]->(r:rvk) WHERE r.notation = "DG 9000" MATCH (t)-[]->(b:bk) RETURN head(LABELS(b)), b.notation, count(b)

co-occurrences of RVK DG 9000 in all vocabularies
MATCH (t:title)-[]->(r:rvk) WHERE r.notation = "DG 9000" MATCH (t)-[]->(n) WHERE not LABELS(n) = ["rvk"] RETURN head(LABELS(n)), n.notation, count(n)

co-occurrences of RVK DG 9000 in all vocabularies (including RVK)
MATCH (t:title)-[]->(r:rvk) WHERE r.notation = "DG 9000" MATCH (t)-[]->(n) RETURN head(LABELS(n)), n.notation, count(n)

subjects of a record (all vocabularies)
MATCH (t:title)-[]->(n) WHERE t.ppn = "012401471" RETURN head(LABELS(n)), n.notation

subjects of a record (selected vocabulary)
MATCH (t:title)-[]->(r:rvk) WHERE t.ppn = "012401471" RETURN head(LABELS(r)), r.notation

records of a subject
MATCH (t:title)-[]->(b:bk) WHERE b.notation = "20.04" RETURN t.ppn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants