I have used this query
g.V().has('empId','123').as('a').V().has('deptId','567').addE('worksAt').properties('startedOn','17/15/07','title','manager','pay',15000)
which doesn't work.
Adding a single property works with a .property step
g.V().has('empId','123').as('a').V().has('deptId','567').addE('worksAt').property('startedOn','17/15/07')
Instead of specifying all properties in one property-step, you can simply concatenate multiple property-steps:
g.V().has('empId','123').as('a').V().has('deptId','567').addE('worksAt').
property('startedOn','17/15/07').property('title','manager').property('pay',15000)
Your query doesn't specify which vertices should be connected by the edge. When you want the edge to go out from the vertex with the empId 123, then you have to insert a from:
g.V().has('empId','123').as('a').V().has('deptId','567').addE('worksAt').from('a').
property('startedOn','17/15/07').property('title','manager').property('pay',15000)
See the addEdge-step for more information.
Related
I'm trying to design a custom shape in Visio.
My structure is like this:
In the "Edit Master" page I have some rectangles, I called my shape "MyDay", so that's its document's name in the Master Explorer and in the edit window.
My problem is, that I can't find a way to refer the shape's date itself (like =MyDay!Name() or =MyDay!User.MyUserField) from one of my sub-shapes.
If I add a reference to ThePage and drop the master on a page - I adds that property to the page itself - again - no reference to the main shape from its sub-shapes.
I know there is no "Parent" property in ShapeSheet formulas (only on VBA), but I'm really trying to find a way to refer it using fields or formulas, without the need to write and run VBA code.
Many appreciations for any help!
Paul is correct, but I will add that it is normally expected that a Master contains only one shape, but that can be a group shape that contains other shapes. Therefore, a formula in a sub-shape can refer to any shape in that group, including the top level group shape, using the Sheet.n syntax. When an instance of the master shape is dropped onto a page, then Visio will automatically update the n ID to the actual shape ID in the page. The shape ID has to be unique within the shapes collection that it is part of, so the top-level group shape needs to be assigned a new unique ID, but the sub-shapes do not because they already have an ID that is unique within the shapes collection that they are part of.
You need to find the parent shape's Sheet reference number (select it and then ribbon Developer -> Shape Name -> Shape). This will be something like Sheet.6.
Use this reference in your formula e.g.
Sheet.6!User.MyUserField
I have an my own MDG, consist of several elements. I need change view of those elements when its placed at different diagram. There is a mechanism called "user-selected settings" in MDG and I use its to change view of elements (e.g. via shape script function "HasProp" ). But for several reason I need to change diagram property for element via script. Are there any way to work with diagram property for element within script ?
It's possible but a bit tricky. First of all you need to get hold of the right diagram's table data stored in t_diagram. Issue a SQL like
SELECT StyleEx FROM t_diagram WHERE Diagram_ID = <theID>
Of course <theID> must be the diagram id of the diagram. Now you can use some string operations. Here's what my test diagram brought:
ExcludeRTF=0;DocAll=0;HideQuals=0;AttPkg=1;ShowTests=0;ShowMaint=0;SuppressFOC=1;MatrixActive=0;SwimlanesActive=1;KanbanActive=0;MatrixLineWidth=1;MatrixLineClr=0;MatrixLocked=0;TConnectorNotation=UML 2.1;TExplicitNavigability=0;AdvancedElementProps=1;AdvancedFeatureProps=1;AdvancedConnectorProps=1;m_bElementClassifier=1;ProfileData=;MDGDgm=VW VA Functional 3::Use case activity;STBLDgm=;ShowNotes=0;OPTIONS_9CEFE070=Structure=1:;VisibleAttributeDetail=0;ShowOpRetType=1;SuppressBrackets=0;SuppConnectorLabels=0;PrintPageHeadFoot=0;ShowAsList=0;SuppressedCompartments=;Theme=:119;SaveTag=79E21B13;;
which is a CSV at its best. See the
OPTIONS_9CEFE070=Structure=1:;
which actually encodes the diagram properties. Here it's just one with the name Structure and its value is set to 1. The 9CEFE070 refers to the GUID the diagram object. Of course not directly.
So find the diagram objects of the diagram itself with
SELECT Object_ID, ObjectStyle FROM t_diagramobjects
The Object_ID is for identifying the object behind (you might use a join to get needed information). And the ObjectStlye contains something like (from my test)
DUID=9CEFE070;HideIcon=0;
And there you have that hex string. Now you know that this one object has a diagram property set.
You should issue some queries manually to get familiar with that.
Now, to set a property, you "just" have to find the DUID from the diagram object of the diagram (just use the query above). Now you can add that OPTIONS_<duid> part or in case it already exists you need to modify it with according string operations. Finally you need to update the diagram table with
Repository.Execute("UPDATE t_diagram SET StyleEx = `<new string>` WHERE diagram_id = <theID>")
Note that this is an undocumented operation and you get
a) no support and
b) can easily clobber your whole model which is
c) the reason for a).
Have a backup!
I have a unique constraint on edge:
CREATE CLASS hasAssignee extends E
CREATE PROPERTY hasAssignee.out LINK Assignable
CREATE PROPERTY hasAssignee.in LINK User
CREATE INDEX UniqueHasAssignee ON hasAssignee(out,in) UNIQUE
I want to multiple create edges if they don't yet exist in one query. If they do exist, then either replace them, or simply don't add them. Something like that, but without possibility of errors:
CREATE EDGE hasAssignee FROM ( SELECT FROM Project WHERE id=:id ) TO ( SELECT FROM User WHERE login in :login )
UPSERT from what I've noticed can deal with only one edge at a time (at least I couldn't produce query parsable by studio)
I see a few possibe solutions (but I don't see anything like it in docs):
something like CREATE IFNOTEXISTS
Soft indexes, that don't throw an error, simply don't create additional edges
Remove unique index, create duplicates, and somehow remove duplicates after each query (?)
Is it possible to do something like that in orientdb? Should I fill out a request?
There is an open feature request for this:
https://github.com/orientechnologies/orientdb/issues/4436
My suggestion is to vote on it
Is there a way to create both a Vertex and Edge in the same query?
I am aware that we can use out_EdgeName/ in_EdgeName to update the edge of a vertex if it already exists in an UPDATE query, but how to do that so that a new edge is created and assigned to the vertex?
Example use case in an Update Upsert query - a Vertex is being created and we require a new Edge to be created for that vertex. Can we do it in the same query or we would need 2 queries at least for that (i.e 2 UPDATE - UPSERTS)?
Taking cue from orientdb sql update edge? :
Something like - UPDATE Persons SET phone=000000, out_Inside=(
UPDATE Edge UPSERT where in=#some_rid/sub-query, out=$this) where person_id=8
This question is actual if you are using new version of orientdb 2.1.
But as far as i know this features was implemented in 2.2 version.
"As far as I can tell, update works (including in/out):"
UPDATE FRIEND SET in=#11:5 WHERE in.name="Samantha" and out.name="Mat"
Although, using a query inside the set clause for in/out will cause it to return array:
UPDATE Friend SET in=(SELECT FROM User WHERE name="Jason") WHERE in.name="Samantha" and out.name="Mat"
Upsert also works, although when creating a new vertex it doesn't set the in/out properties.
You could set the in/out properties your self, like this:
UPDATE Friend SET comment="Wazzzaup", in=#11:5, out=#11:6 UPSERT WHERE in.name="Jason" AND out.name="Mat"
It will result in a longer query when using sub-query for in= and out=, but at least it works (sub-query has same problem as above).
I got this information from issue:
https://github.com/orientechnologies/orientdb/issues/1114#issuecomment-156585776
Suppose i have a two vertexes A and B.
Can the edge between this vertices have Set of properties. By Set i mean Set. Not a map of key values.
EG Edge from A to B has Set tags.
I want model someting like A workswith B
Now workswith has properties likes ondays [monday,tuesday,friday]
tags values = ['Monday','Tuesday','Friday'];
Here tags is a single propery but its type is Set.Is it possible?
Now will traversing i would like to find something like
Find with all A works on monday?
Find will all A works on an day?
Note :This is a simple example depicting my use case .My real use case is more complex.
Yes you can. An edge is a document so can be very very complex with collections, maps and nested documents.