I don't like organising my bookmarks in directories because my bookmarks often belong to several categories. I use tags instead, that offer more flexibility.
I wanted to "see" my graph of tags and bookmarks.
In firefox, click on the bookmarks menu, then Show all bookmarks. In the new window, click on Import and Backup then Backup.... Choose where to put the file and you're done.
neo4j is a graph database management system. You can load a graph, query it and modify it.
Download neo4j and follow the installation instructions.
I use neo4j-community-3.0.4. I haven't tried other versions.
The script will delete all data from the database. Back up your existing database if you want to keep it.
Check your server config file to find the database location. The default is <NEO4J_LOC>/data/graph.db/. You can simply use cp -r or mv/ln -s to put it somewhere else.
- Make sure the server is not running when you move the files.
- The directory
<NEO4J_LOC>/data/graph.db/must exist. It can be empty.
Alternatively, see the neo4j-backup command.
<NEO4J_LOC>/bin/neo4j startThe script will connect to this running instance.
Requirements:
I use Python 3.5, py2neo 3.1.2 and json 2.0.9. I haven't tried different versions.
Run:
./load_bookmarks.py --input ~/Desktop/bookmarks-2017-01-01.json./load_bookmarks.py --helpThe graph you built has 3 types of nodes:
bookmarktagcontainerfor the directory structure
containers and bookmarks are linked to their parent container.
bookmarks are linked to their tags.
Open http://localhost:7474 in your favourite browser.
If prompted for a user/password, try the default: neo4j/neo4j.
You are in the neo4j browser. You can enter queries (in cypher language) in the top banner with a $.
Try this for example: MATCH (n) RETURN n LIMIT 50. Click the play button on the upper right corner to execute the query, or press Enter or Ctrl+Enter.
I recommend styling the nodes and relationships to get the shape of the graph at a glance.
More on neo4j browser More on cypher query language
Get all the nodes:
MATCH (n) RETURN nNote that by default the graph view shows all relationships between displayed nodes. So the query above will show your entire graph.
If you have lots of bookmarks, you can limit the number of returned nodes:
MATCH (n)
RETURN n
LIMIT 100Get the root of the bookmark directory hierarchy:
MATCH (n:container {title:"ROOT"}) RETURN nFrom there, double-click on nodes to get its neighbours.
See the bookmark directory hierarchy only, no bookmarks, no tags.
MATCH (c:container) RETURN c
Get the bookmarks and tags only, not directory.
MATCH (t:tag)--(b:bookmark) RETURN t,bBookmarks with no tags are not shown.
Get the bookmarks that don't have tags.
MATCH (b:bookmark)
WITH b, size((b)-->(:tag)) as degree
WHERE degree = 0
RETURN bGet tags that are only used once
MATCH (t:tag)
WITH t, size((t)<--()) as degree
WHERE degree <= 1
RETURN tSee if there are 2 directories with the same name:
MATCH (c1:container), (c2:container)
WHERE c1.title = c2.title AND c1 <> c2
RETURN c1, c2Get the tags and directories that share the same name.
MATCH (c:container), (t:tag)
WHERE c.title = t.name
RETURN c, tGet the bookmarks tagged with NLP and the directories they live in.
MATCH (:tag {name:'NLP'}) <-- (b:bookmark) -[:has_parent*]->(c:container) RETURN b, cGet the tags of bookmarks that are under my tech directory.
MATCH (:container {title:"ROOT"}) <-- (:container {title:""}) <-- (:container {title:"Bookmarks Menu"}) <-- (:container {title:"tech"}) <-[:has_parent*0..]- (:container) <-- (:bookmark) --> (t:tag)
RETURN tProbably quite a lot, given that:
- there's no tests!
- I've only tried with my own bookmarks, that I use in a peculiar way. All my bookmarks live in
Bookmarks Menu. I don't usekeywords,
If you find an issue, please create a github issue. Pull requests welcome.