Querying the IYP database requires to be familiar with:
- Cypher, Neo4j's query langage https://neo4j.com/docs/getting-started/current/cypher-intro/
- Basic networking knowledge (IP, prefixes, ASes, etc..)
- IYP ontology (TODO link to ontology)
Below are examples queries that you can copy/paste in Neo4j browser:
- Names for AS2497
- All nodes related to 8.8.8.0/24
- Country code of AS2497 in delegated files
- Countries of IXPs where AS2497 is present
- Top domain names hosted by AS2497
- ASes hosting top domain names in Japan
- Topology for AS2501's dependencies
Find 'Name' nodes directly connected to the node corresponding to AS2497.
MATCH (a:AS {asn:2497})--(n:Name) RETURN a,n
Find nodes of any type that are connected to the node corresponding to prefix 8.8.8.0/24.
MATCH (gdns:Prefix {prefix:'8.8.8.0/24'})--(neighbor)
RETURN gdns, neighbor
Here we search for a country node directly connected to AS2497's node and that comes from NRO's delegated stats.
MATCH (iij:AS {asn:2497})-[{reference_name:'nro.delegated_stats'}]-(cc:Country)
RETURN iij, cc
Starting from the node corresponding to AS2497, find IXPs where AS2497 is member of, and then the country corresponding to each IXP.
MATCH (iij:AS {asn:2497})-[:MEMBER_OF]-(ix:IXP)--(cc:Country)
RETURN iij, ix, cc
Select domain names in top 50k rankings that resolves to an IP originated by AS2497.
MATCH (:Ranking)-[r:RANK]-(dn:DomainName)--(ip:IP)--(pfx:Prefix)-[:ORIGINATE]-(iij:AS {asn:2497})
WHERE r.rank < 50000
RETURN dn, ip, pfx, iij
From the top 10k domain names select domain names that ends with '.jp', the corresponding IP, prefix, and ASN.
MATCH (:Ranking)-[r:RANK]-(dn:DomainName)--(ip:IP)--(pfx:Prefix)-[:ORIGINATE]-(net:AS)
WHERE dn.name ENDS WITH '.jp' AND r.rank<10000
RETURN dn, ip, pfx, net
Select IHR's top 20 ASes in Iran and show how they are connected to each other using AS relationships.
MATCH (a:AS)-[ra:RANK]->(:Ranking {name: 'IHR country ranking: Total AS (IR)'})<-[rb:RANK]-(b:AS)-[p:PEERS_WITH]-(a)
WHERE ra.rank < 20 AND rb.rank < 20 AND p.rel = 0
RETURN a, p, b
Select AS dependencies for AS2501 and find the shortest PEERS_WITH relationship to these ASes.
MATCH (a:AS {asn:2501})-[h:DEPENDS_ON {af:4}]->(d:AS)
WITH a, COLLECT(DISTINCT d) AS dependencies
UNWIND dependencies as d
MATCH p = allShortestPaths((a)-[:PEERS_WITH*]-(d))
WHERE a.asn <> d.asn AND all(r IN relationships(p) WHERE r.af = 4) AND all(n IN nodes(p) WHERE n IN dependencies)
RETURN p