I am building a heterogenous graph database looking at organisational structures. The vertices are: people, role, entity and each have different properties.
I want to be able to return properties from the different vertices but can’t seem to get all three vertices and multiple properties from each of them.
Any ideas?
from what I see in your comment
(first name, last name, age) —(fills)—> role (role name, role type, rank) <— (has) — entity (entity name, address, entity type)
You can try:
g.V("person").
has("first name", "Bob").
out("fils").as("a").
in("has").as("b").
select("a", "b").by(valueMap())
Related
I know the question seems weird but hear me out...
Say I have a group of users called Managers.
List userList = [Manager1, Manager2,Manager3,...,ManagerN]
And I wanted to assign one of these managers to a record using a round robin which uses a modulus to determine the count.
integer count = 0;
integer userModulus = Math.round(Math.mod(Count, userList.size()));
count++;
Then use this value to return the index of the list like userList[userModulus] right?
Originally I planned to use custom metadata types to house the lists with the intent of managing these custom metadata lists by screen flow... but on implementation I don't see this being realistic.
Is there a way to store this list of users in a field, or some other kind of structure where it can be maintained by managers or other non-admin users?
There are code-free ways to do it, see https://help.salesforce.com/s/articleView?id=sf.essentials_round_robin_lead_assignment.htm&type=5
Or ready pieces of code you can get inspired with: https://gist.github.com/eskfung/f342b47ecc0849deb0cb
Many ways to achieve this. You could have a field on the User (picklist? checkbox? being assigned a special Role?) and then
List<User> users = [SELECT Id, Name
FROM User
WHERE IsActive = true AND UserRole.Name = 'Sales Manager'
ORDER BY Name];
Bit crude but should get the job done.
You could also add them to a public group or queue? Queues should be pretty close to normal owner assignment functionality anyway. And then you'd query all group/queue members. Queues are a type of group so it'd sit in same table: Group, GroupMember
SELECT Id, Name, Type
FROM Group
WHERE Type IN ('Regular', 'Queue')
SELECT Id, Name
FROM User
WHERE Id IN (SELECT UserOrGroupId FROM GroupMember WHERE Group.Name = 'MyGroup' AND Group.Type = 'Regular')
It's bit simple, it assumes people are directly assigned to the group. In reality groups/queues often consist of other groups, roles, roles+subordinates, not just manually assigned individuals... You'd need to keep querying the GroupMember records till you exhaust the tree.
Still, should be enough to get you started?
I try to create an ontology in OWL, using Protégé 5.5.0. No I have a little trouble with inferred classes.
I have three classes: Agents and as subclasses Groups and Persons. Persons can be members of Groups. Now I want to create two inferred classes: a) "Members of groups" and b) "Not members of groups" (both as subclasses of Person)
I was successful with a), using the axiom equivalent class: Person and member_of some Group.
I created one individual, which is a person and member of a group and it was inferred to be member of the class "Members of groups".
Now I'm stuck with b). I tried several options for the equivalent class, for example:
Person and member_of max 0 Group
Or: Person and member_of exactly 0 Group
Or: Person and not member_of some Group
I created an individual which is a person but no groupmember. But the reasoner does not agree with me about the fact, that this individual should belong to the inferred class "Not members of groups".
What did I do wrong?
One way to achieve this in OWL, using your Person and not member_of some Group,
is to define a MemberOfGroup class that is defined as you suggested. Then define a NotMemberOfGroup class, that is disjoint with the MemberOfGroup class. If you now define your individual to be of type Person, as well as of type not member_of some Group, then your individual will be classified as belonging to the NotMemberOfGroup class.
The reason why you have to do this, is that OWL uses the open world assumption and hence it can only make inferences about things it knows for sure. I.e. saying that the individual is a Person, while making no statement regarding member_of provides the reasoner with zero explicit info to determine that the individual either belongs or does not to a group.
The other option is to use SHACL/SHEX/SPIN.
I am new to study graph databases (using Neo4j), I am modelling for my project. The business rule is that we need to store the users and devices they used, and this is my current model:
Account A uses device D: (Account A) -[USED]-> (Device D)
Account B also uses device D: (Account B) -[USED]-> (Device D)
=>
(Account A) -[USED]-> (Device D) <-[USED]- (Account B)
In future, account B will use other devices & be related with other accounts.
My questions are:
Is it a good model in this case?
With this model, how to find all associated account with account A?
Thank for you help.
Yes, this model works, as :Account and :Device nodes are distinct in the graph.
As for figuring out what other accounts that are associated with :Account a (only considering the link via using the same device), simple queries should do the trick. Assuming we have :Account(name) in the graph, and that there's an index on this (for fast lookup of :Account nodes by name), we could use this:
MATCH (:Account {name:'A'})-[:USED]->()<-[:USED]-(other:Account)
RETURN DISTINCT other
If :USED relationships always are incoming to :Device nodes, we could simplify this to:
MATCH (:Account {name:'A'})-[:USED*2]-(other:Account)
RETURN DISTINCT other
If we also needed the devices used in common between the two connected account nodes, we could include that as a collection of the nodes between the two linked accounts:
MATCH (:Account {name:'A'})-[:USED]->(device)<-[:USED]-(other:Account)
RETURN other, collect(device) as sharedDevices
I have an og course group type (not group content). I need to add members to the created groups. I have two groups: students and instructors.
I have added two OG memberships types ("student membership" and "instructor membership") each with a different set of fields that the user should submit when subscribing to a group:
1- Student
2- Instructor
The problem is that the fields that appear are only those in the "default" membership type and neither the members (students or instructors) nor the admin can select the membership type.
I am also struggling to understand where I should specify the membership type for each group type.
Can anyone provide a step by step guide for this?
P.N: I also keep seeing this message Notice: Undefined index: membership_type in og_entity_property_info() (line 236 of /home/devkat/public_html/albinacourses/sites/all/modules/og/og.module).
Thanks a million!
I try to get all users "memberOf" all groups begining with "JE_"
I know that I cannot do the following:
memberOf=CN=JE*,OU=JE,OU=Gruppen,DC=subd,DC=dom,DC=net
But all the JE_* are located under a knot called "JE". Is it possible to get all users memberOf the groups located under the knot "JE"?
yes but you need to approach the problem differently. Rather than search against the user object you should search against teh group object with the user's DN.
For example, consider the user
cn=dave,OU=user,DC=subd,DC=dom,DC=net
The user is a member of several JE* groups.
CN=JE_1,OU=JE,OU=Gruppen,DC=subd,DC=dom,DC=net
CN=JE_2,OU=JE,OU=Gruppen,DC=subd,DC=dom,DC=net
CN=JE_3,OU=JE,OU=Gruppen,DC=subd,DC=dom,DC=net
In order to find the JE* groups to which the user belongs search for groups with a base of OU=JE,OU=Gruppen,DC=subd,DC=dom,DC=net and a search filter of
(&(objectclass=group)(member=cn=dave,OU=user,DC=subd,DC=dom,DC=net))
That will return all of the JE* group objects that contain the user in question. Ensure to specify that you only want the group name returned as an attribute otherwise all of the members will be returned too. Not a problem if there are only a handful but it might be a nuisance if there are thousands.