Is there a way to request the cluster id from a cluster name?
Context:
In our context the default cluster allow child cluster to see, but not update, the data. I would like to notify the user that it is looking at data provided from a different cluster than its own.
Example
Cluster Product
#15:0 // cluster name : product. Product provided from head office
#115:0 //cluster name : productmybranch. Product provided from the branch
The branch sees the product from the head office, but should not update it. The oRoles fixes that.
How can I know that a branch user is currently looking at a product from the head office?
I was looking for a request like (That query does not work)
select metatdata:cluster from cluster:productmybranch
Or any way via the JAVA API
(running on orientdb 2.1.0)
this might help you at least with knowing, it isn't directly possible.
Can I access Cluster/s name for objects during a query on OrientDB?
Scott
I have done it through the Java API. The call to getClusterIdByName just looks up the class/table name in a ConcurrentHashMap that the OrientDB Java API uses.
OObjectDatabaseTx objectDB = OObjectDatabasePool.global().setup(1, 4).acquire(dbName, dbUser, dbPassword);
int clusterId = objectDB.getClusterIdByName("ClassName");
objectDB.close();
Related
A customer has implemented an OPC-UA server and has provided some documentation for us to access it. The only information we have is the endpoint to contact the server at and the tags that the data points are linked to.
I have to implement a client without having access to the server to test it with. Is this enough information to go by? I imagine we would at least need some namespace uri. From what I understand, in order to use a function such as translateBrowsePathsToNodeIds I would also need to know some namespace ID's.
For instance, in python-opcua it would be something like:
mynode = client.uaclient.translate_browsepaths_to_nodeids(ua.QualifiedName("StaticData", 3)) (which somehow is not working but that's another question)
It doesn't help that the client examples I find somehow all use hardcoded namespace ID's.
TranslateBrowsePathToNodeIds is generally used when programming against type definitions where you know what the path of BrowseNames will be because they are defined by the type definition of each node in the path.
If this doesn't sound like your situation then you should push back for the documentation to include the NodeIds of all the Nodes you need to access.
I am currently working at an Powershell script that will automatically download the billing data from my companies CSP platform. I use following powershell module (https://github.com/Microsoft/Partner-Center-PowerShell)
And use the following api(that the module calls I guess) To get the overall price from the last month of all my subscriptions. https://learn.microsoft.com/en-us/partner-center/develop/get-a-subscriptions-resource-usage-information. With the Powershell module that is wonderfull I've managed to recieve good data from my Azure Resources and print them out in a CSV file for Power BI to create a report of them.
My question now is when I use power BI to create graphs of my cost and usage. I don't see the name of my resources (vm, storage, sql) instead I see names of the types (Read Operations,LRS Write Additional IO, ...) And of course that's also a good indicator. I would love to see the VM (the name of the vm or storage or sql) with the highest cost and usage not which type. The ResourceName in the response of the api is not exactly right. The Resource name ( in Resource URL formatting) however is available with this api: https://learn.microsoft.com/en-us/partner-center/develop/get-a-customer-s-utilization-record-for-azure.
But here I cannot retrieve the cost of my Azure Resource. I tried to combine the 2 api's (one to retrieve the cost and the other one to retrieve the Resource URL with the Resource ID as a combiner) but strangly enough some customers have data in the usage api and not in the utilization api. So that didn't helped out well. My question today is: Is it possible to retrieve the resource name or URL with the response data i got from this api: https://learn.microsoft.com/en-us/partner-center/develop/get-a-subscriptions-resource-usage-information . Or is there another way of providing the name of the object instead of the service.
The resource usage feature will not return the resource name. So, you will need to combine data from Get-PartnerCustomerSubscriptionUtilization and Get-PartnerAzureRateCard to get the resource name and the partner cost associated with each billable meter. Since you are working with Power BI, it might be a good idea to check out Partner-Center-Query. It is another project that allows you query data from the Partner Center API through Power Query.
The objective that I have is to run multiple applications with some metadata embedded into applications/services so that I could query applications/services using the metadata. Is this possible?
I was looking at the following post and the answer hints at this possibility, but no specific details on how to achieve the result.
The primary piece of "metadata" you get is the service/application instance name. That's what I talked about in my other post. The way that works is by creating each service/application instance with a name that contains some information clients can use when resolving them. Clients can then query Service Fabric for named application/service instances and connect to a specific one. A service/application instance name is URI, so you can use a path hierarchy to categorize information.
Continuing with the audio/video example: Let's extend that example so we have an application that can perform specific tasks for specific media formats for audio or video. Each combination of task + media format is a unique named service instance, resulting in a deployment that looks something like this:
Application:
fabric:/avapp
Services:
fabric:/avapp/video/encoding/mp4
fabric:/avapp/video/encoding/h264
fabric:/avapp/video/captioning/english
fabric:/avapp/video/captioning/czech
fabric:/avapp/audio/encoding/aac
fabric:/avapp/audio/encoding/mp3
etc.
Now clients can query Service Fabric to discover what services are available:
FabricClient fabricClient = new FabricClient();
System.Fabric.Query.ServiceList services = await fabricClient.QueryManager.GetServiceListAsync(new Uri("fabric:/avapp"));
Then you can simply query the list of services with LINQ. For example, if I want to see all services that do video encoding:
services.Where(x => x.ServiceName.AbsolutePath.Contains("video/encoding"));
And then you can resolve an address for a specific service to connect to it:
ServicePartitionResolver resolver = ServicePartitionResolver.GetDefault();
ResolvedServicePartition servicePartition = await resolver.ResolveAsync(new Uri("fabric:/avapp/video/encoding/h264"), new ServicePartitionKey(1), cancellationToken);
ResolvedServiceEndpoint endpoint = servicePartition.GetEndpoint();
There's a bit more to the address resolution part (see here), but that's the general idea.
Application instances also allow you to set custom application parameters (key-value pairs) that can be set per instance at creation time. They don't show up in the application name, but you get that information back when you ask Service Fabric for a list of running application instances. That can potentially also be used as metadata by clients when they need to decide what application to connect to.
Update: More info on application instance parameters:
When you create a new application instance you can supply a set of key-value pairs in the application description. Then when you query Service Fabric for application instances you get back a list of Application result objects that have said parameters. This also shows up in Visual Studio, in your application project, where you have environment-specific application parameter files. Visual Studio extracts those key-value pairs from the XML files and uses them in the application description when it creates an instance of your application.
I'm trying to do a merge statement. I'm trying to get the node with his node id, the problem that merging doesn't allow me to use 'where id(node)=nodeId'.
Something like:
merge( user:User) where id(user)=111
on create set user =
{facebookId:"13",name:"",gender:"",pushId:"", picoAccessToken:"",
accessTokenExpires:""}
on match set user +=
{facebookId:"13",name:"",gender:"",pushId:"",picoAccessToken:"",
accessTokenExpires:""}
return user
General question, should I use the node id to retrieve nodes? or should I add an id property to the node.
You can't use the "ID()" function with MERGE because it behaves as "MATCH or CREATE" and you can't assign internal ids manually to nodes.
On the other hand, YES! it is better to use an id generation at the application level that you will assign to nodes OR use the GraphAware UUID plugin that will do it for you https://github.com/graphaware/neo4j-uuid/tree/master.
Relying on nodes internal ids is considered as bad practice as ids of deleted nodes are reused in the database lifecycle.
Michael Hunger from Neo Technology has already answered the question regarding internal ids here on StackOverflow.
The bottom line is that the node id should not be used, rather they should be considered an implementation detail.
So, the recommended approach is to use your own id property*. This can be a UUID, some kind of counter or whatever id that is suitable for your project.
Personally I like the UUID-approach. They are easy to generate from any language (e.g. the UUID-class in Java). The are unique and it is obvious that the are generated.
This is for people with knowledge on REST and Neo4j.
Is it possible to name a node before creating it in Neo4j ?
Typical Restful thing, you create a URI "XXX/db/data/node/mynode" and you want to create a node with this identifier if it is not existent in the moment.
For all that I have been researching (and testing) to the present moment, the answer is : "no it is not possible, neo4j will just always automatically give ids to the created nodes and the attempt to do create a URI and use POST to cause its creation will result in 405"
Thanks in advance.
That's correct, you can't set the id of a node. What you can do is to add some other kind of id as a property, see create node with properties. Just make sure it's indexed automatically and then you can query that index for exact matches.