---
# System prepended metadata

title: Untitled

---

## Membership type


```
with
    $selectedCommunityId as selectedCommunityId, $name as name, $description as description
with
    name, selectedCommunityId, replace(description, "'", '') as cleanDescription
with
    name, selectedCommunityId, replace(cleanDescription, "'", '') as cleanDescription
create
    (type:_Community:_Element:_UserDefined)
set 
    type._displayName = name
set
    type._description = cleanDescription
set
    type._communityId = selectedCommunityId
set
    type._chainverseId = apoc.create.uuid()
return
    count(type) as created
```

```
match
    (community:_Main {_communityId: $selectedCommunityId})
match
    (type:_UserDefined {_communityId: $communityId})
with
    community, type
merge
    (community)-[r:_HAS_MEMBERSHIP_TYPE]->(type)
return
    count(r) as created

```






## ingest query - wallets

```
WITH datetime(apoc.date.toISO8601(apoc.date.currentTimestamp(), 'ms')) as timestmap
LOAD CSV WITH HEADERS FROM '$file' AS row
MERGE (w:Wallet {address: row.address})
ON CREATE 
    SET
        w.uuid = apoc.create.uuid(),
        w.createdDt = timestamp,
        w.lastUpdateDt = timestamp
ON MATCH
    set
        w.lastUpdateDt = timestamp()
RETURN 
    count(distinct(w)) as count
```


## ingest query - wallets

```
with $addresses as addresses, $name as name, $selectedCommunityId as selectedCommunityId
match (type:_Community:_Element:_UserDefined)
where (type._displayName = $name 
and type._communityId = selectedCommunityId)
with type
call apoc.periodic.commit('
match (w:Wallet)
where w.address in addresses
and not (w)-[:_HAS_MEMBERSHIP_TYPE]->(type)
with w, type limit 10000
merge (w)-[:_HAS_MEMBERSHIP_TYPE]->(type)
return count(distinct(*) as count
')


```
        



