Neo4j – Tokensize berechnen

MATCH (n:ADAccount)-[:rel_member*..]->(g) where n.type='group' and g.type='person' 
and not n.objectSID='S-1-5-11' and not n.objectSID='S-1-1-0' and not n.domain='local' 
and not size (g.sAMAccountName) = 0 and not n.grouptype='Universal_Distribution_Group' 
and not n.grouptype='BuiltIn_Group' and not n.grouptype='Local_Distribution_Group' and 
not n.grouptype='Global_Distribution_Group'

with distinct n,g

Return (1200 + sum(

case

when n.grouptype='Global_Security_Group' then 8

when n.grouptype='Local_Security_Group' then 40

when n.grouptype='Universal_Security_Group' then

case

when g.domain = n.domain then 8

else 40

end

end)) as Tokensize,

sum(

case

when n.grouptype='Local_Security_Group' then 1

end) as Count_DLG,

sum(

case

when n.grouptype='Global_Security_Group' then 1

end) as Count_GG,

sum(

case

when n.grouptype='Universal_Security_Group' then 1

end) as Count_UG,

count(

case

when n.grouptype='Global_Security_Group' then 1

when n.grouptype='Local_Security_Group' then 1

when n.grouptype='Universal_Security_Group' then 1

end) as Anzahl, g.sAMAccountName as account, id(g) order by Tokensize desc

 

 

 

 

Dies ist eine Variante mit APOC in einer schleifen Version, in der die Werte direkt auf den Knoten geschrieben werden.

 

CALL apoc.periodic.iterate("MATCH (g:ADAccount) where g.type='person' and not size 
(g.sAMAccountName) = 0 return g",

"MATCH (n:ADAccount)-[:rel_member*..]->(g) where n.type='group' and not n.objectSID=
'S-1-5-11' and not n.objectSID='S-1-1-0' and not n.domain='local' and not n.grouptype=
'Universal_Distribution_Group' and not n.grouptype='BuiltIn_Group' and not n.grouptype=
'Local_Distribution_Group' and not n.grouptype='Global_Distribution_Group' with distinct 
n,g with g, (1200 + sum( case

when n.grouptype='Global_Security_Group' then 8

when n.grouptype='Local_Security_Group' then 40

when n.grouptype='Universal_Security_Group' then

case

when g.domain = n.domain then 8

else 40

end

end)) as Tokensize,

sum(

case

when n.grouptype='Local_Security_Group' then 1

end) as Count_DLG,

sum(

case

when n.grouptype='Global_Security_Group' then 1

end) as Count_GG,

sum(

case

when n.grouptype='Universal_Security_Group' then 1

end) as Count_UG,

count(

case

when n.grouptype='Global_Security_Group' then 1

when n.grouptype='Local_Security_Group' then 1

when n.grouptype='Universal_Security_Group' then 1

end) as Anzahl set g.Anzahl=Anzahl, g.Tokensize=Tokensize, g.Count_DLG=Count_DLG
, g.Count_GG=Count_GG, g.Count_UG=Count_UG", {batchSize:1, parallel:true})

 

 

 

Permanentlink zu diesem Beitrag: https://help.migraven.com/neo4j-tokensize-berechnen/