Hi Alan
can you try this:
START ip=node:IPaddrNode('*:*')
OPTIONAL MATCH (nic)-[:ipowner]->(ip)
WHERE NOT ((host)-[:nicowner]->(nic))
RETURN ip, nic
ORDER BY ip.ipaddr
in 2.x syntax
MATCH (ip:IPAddress)
OPTIONAL MATCH (nic)-[:ipowner]->(ip)
WHERE NOT ((host)-[:nicowner]->(nic))
RETURN ip, nic
ORDER BY ip.ipaddr
On Tue, Sep 1, 2015 at 2:43 PM, Alan Robertson <[email protected]> wrote:
> I just read my email, and it didn't seem like I gave good context and
> explained things very clearly...
>
> Let me try again and see if I can be a little clearer...
>
> My problem domain is modelling IT environments (data centers, clouds,
> etc). In this world, there are IP addresses, ethernet chips (NICs) [which
> have MAC addresses], and hosts, to which NICs are attached. We discover the
> interrelationships between these different things. Sometimes we have all
> the information, sometimes we have 2/3 of it and sometimes only 1/3 (IP
> addresses).
>
> So...
>
> I have IPs which are related to NICs, which are related to (attached to)
> hosts.
>
> I want to find all the (IP, NIC) pairs which have no relationship to any
> host.
>
> Some IPs will have an associated NIC, and some will not.
>
> I want to retrieve all (IP, NIC) pairs where there is an associated NIC,
> and (IP, NULL) for the cases where there is no NIC.
>
> In effect I want to know all the IP addresses which I don't know
> everything about...
>
>
>
> On 08/31/2015 09:59 PM, Alan Robertson wrote:
>
> Hi,
>
> I have a question about how to write a cypher query...
>
> Here's the query that comes close to working ;-)
>
> START ip=node:IPaddrNode('*:*')
> OPTIONAL MATCH host-[:nicowner]->nic-[:ipowner]->ip
> WITH ip, nic, host
> WHERE host IS NULL
> RETURN ip, nic
> ORDER BY ip.ipaddr
>
> This always returns ip, NULL. :-(
>
> It returns the right ips, but I would like the nic for the case that a nic
> exists in an ipowner relationship to an IP address.
>
> Sometimes there's just a standalone IP (with no associated NIC)
> Sometimes there's an IP, NIC pair
> and sometimes there's a host, IP, MAC triple.
>
> I want to return the IP, NIC pair if it exists, and the IP and NULL if
> there is no related NIC. But I want the NIC if it exists.
>
> How should I do this?
>
> Thanks!
>
> -- Alan Robertson
> [email protected]
>
>
>
>
> --
>
> Alan Robertson / CTO
> [email protected] / +1 303.947.7999
>
> Assimilation Systems Limited
> http://AssimilationSystems.com
>
> [image: Twitter] <https://twitter.com/ossalanr> [image: Linkedin]
> <https://www.linkedin.com/in/alanr> [image: skype]
> <https://htmlsig.com/skype?username=alanr_unix.sh>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
>
>
> --
>
> Alan Robertson / CTO
> [email protected] / +1 303.947.7999
>
> Assimilation Systems Limited
> http://AssimilationSystems.com
>
> [image: Twitter] <https://twitter.com/ossalanr> [image: Linkedin]
> <https://www.linkedin.com/in/alanr> [image: skype]
> <https://htmlsig.com/skype?username=alanr_unix.sh>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Neo4j" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>
--
You received this message because you are subscribed to the Google Groups
"Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.