fcs.server.graph_db¶
This module describes API for graph database, used by GraphAndBTreeDB in fcs.server.link_db.
- class GraphDB(location)¶
Class provides easy access to Neo4j database.
Parameters: location (string) – Location of database. - graph¶
Reference to database.
- is_in_base(link)¶
Checks if the given link is already in database.
Parameters: link (string) – Searched link. Returns: Information if the link is in database. Return type: bool
- change_link_priority(link, priority)¶
Changes link priority.
Parameters: Returns: Link’s old priority.
Return type: int
- get_details(link)¶
Returns information stored in database about specified link.
Parameters: link (string) – URL with priority modified. Returns: List with 3 strings - priority, fetch date(could be empty string) and depth. Return type: list Raises Exception: if link has not been found in databse
- add_link(link, priority, depth)¶
Adds given link to database.
Parameters: Returns: Object representing new node in database.
Return type: neo4j.Nodes if successful, None otherwise
- points(url_a, url_b)¶
Connects two URLs-representing nodes in graph with relationship: “url_b obtained from page identified with url_a”.
Parameters: Returns: Object representing edge between nodes representing url_a and url_b.
Return type: neo4j.Relationships
- get_connected(links)¶
Provides list of URLs which can be extracted from specified pages.
Parameters: links (list) – List of strings representing URLs. Returns: List of URLs (as strings). Return type: list
- clear()¶
Clears database instance.