Is there any Mql command to print the connection between two admin objects? - mql

In Enovia Mql, if we want to print the details of a connection between a person and its company object what is the command. For Ex: Business objects can be explored using "Expand", similarly what is the way for Admin Objects?

I think we need some clarification on question as when you talk about "connection between a person and its company object" that means you are talking about business objects.
But for admin objects query is different.
I will try to answer both the questions.
A. Admin object query
print person PERSONNAME;
B. Business object information:
as you need all connection information below query will help you.
expand bus Person PERSONNAME - type Company select rel id attribute.value;
as we have mentioned "type Company" the expand will only consider connected Company type of objects.
"select rel" clause selects information from relationships.
You can add any selectable for relationship in above query.
also for more information on expand you can use following query in mql and check expand bus section.
help bus;

Please try to perform below query:
Print person XYZ selectable;
Thanks_Sachin

May be it would be good if you have mentioned specific admin object names.
As per current schema design admin objects are not connected in the way business object are connected. But admin objects are referenced/added to another admin object.
For example Attribute admin object is added to type object.
print type Part select attribute
Similarly type admin object is added into policy admin object.
Print policy Engineering selet type store format;
In above example we can see type ,store and format admin objects being referenced from policy.
Similar way each admin object is referenced/added to another admin object

Related

What is the URL when I DELETE an object

I'm running a local server playing around with an API using Django. I have a model called 'Users' populated with a few objects, and am using DefaultRouter.
I want to know what the URL would be if I were to DELETE a specific object from this model. For example, if I wanted to GET a user with an ID of 1 in this model, the URL would be: "localhost:8000/Users/1/". What would the equivalent be to DELETE this user?
I found an explanation of this on the REST API website (below), however, I don't understand what any of the syntaxes means.
What is {prefix}, {url_path}, {lookup} and [.format]? If anyone could provide an example of what this might be using a localhost that would be really helpful.
Thanks
Let us take an example of an API (URL) to update book data with id (pk) being 10. It would look something like this:
URL: http://www.example.com/api/v1/book/10/
Method: PUT/PATCH
With some data associated.
If you want to delete you just need to change method to DELETE instead of put or patch.
Regarding your second question lets compare the url with the parameters.
prefix: http://www.example.com/api/v1/book
lookup: 10
format: It specifies what type of data do you expect when you hit the API. Generally it is considered to be json.
url_path: In general, every thing after look up except query string is considered to be url_path.

How to train watson on names entity or general string?

I need to train watson assistant on the following utterance, what is the order status of Bob/Jane or some name.
I tried with #sys-person but it does not recognize all names.
I defined an intent like this
what is order status of #name
and created entity #name as \b[A-Za-z0-9]\b
This is a good use for contextual entities. You can read up on those here:
Contextual Entities with IBM Watson Assistant
All about entities: Contextual entities with Watson Assistanthttps://medium.com/ibm-watson/all-about-entities-contextual-entities-with-watson-assistant-part-2-7697d2b73db0)
The idea is that you don't need your bot to know all possible names in advance, but instead it can recognize a name based on the context within an intent.
To set this up, you'd go to your order status intent and add some training examples such as:
what is the order status of Name
what is the order status of Another Name
what is the order status of Yet Another Name
(These examples can have any kind of name, whether fake or real.)
And then you'll annotate each of those to associate the name with the #name entity, by double-clicking on the name portion of the training examples (i.e. Name, Another Name, Yet Another Name) to bring up the entity selection UI and specifying your #name entity.
After Watson finishes training, you can test it in the "Try it out" window. Enter something like "what is the order status of Charles Flint" or "what is the order status of Thomas Watson" and you should see your #name entity matched. From there, you can access the name specified by the user with #name.value.
Hi JohnDon't wish to dismiss your entity pattern, however from experience I have seen its almost impossible to determine a complete list of people names. I use both #sys-person and my own #names entity which contains over 6,000 common names, and we are still adding missing values to the list. We also have a #bad_names list which contains names that match common words like; summer, cherry, star, cj, etc. By using both your intent or #sys-person or #names, etc in your condition you have a good chance to catch a high percent of the users messages.

Field Level Permission in Spring Domain Object. View and Edit permission based filtering of object

I am looking for a spring based solution for this problem. I have solved this in crude way but looking for better solution.
I have a client server architecture application.
Based on user permission, I am able to :
get list of fields for loggedin user which he is not permitted to write.
get list of fields for loggedin user which he is not permitted to read.
Now, how can I verify that the object to be written into database is as per user permission in an efficient way. I can iterate over fields, check if its value is different from that stored in db and reject accordingly. Is there any effecient way ?
Example:
One domain entity "Account" which is stored in MongoDB.
class Account {
String name;
String email;
String mobile;
}
Corresponding DTO Object to be returned to client
class AccountDto {
String name;
String email;
String mobile;
}
Two User -> User A, User B
Scenario:
User A can edit [ name ] but not email, mobile.
User A can view [name, email] but not mobile.
How can I design to return only those field which he is permitted to view. I donot want to create numerous DTO based on every user permission.
How can I write a code to check that the Object to be written to database is valid as per permission assigned to loggedin user. I dont want to iterate over fields and check field permission and then discard. Expensive operation.
My solution: Whenever user is going to write to db, I can fetch the existing record , compare with the record he is going to write and reject if field value is changed if he has not that permission. But this adds DB read cost and is not that generic solution.

How to model data for a JSON API and a Document Database

I am making a simple REST API in front of a NoSQL database that stores records as documents similar to JSON (but not exactly the same). Each record has some fields, including id for the database, and also including some derived fields, like dateCreated.
Any time I GET anything, I want to return the objects with all the fields.
// GET /users returns an array of these in JSON
// [{id:"xxx", name:"Bobby", dateCreated:"YYYY-MM-DD"]
data User = User { id :: String, name :: String, dateCreated :: XXX }
But any time I POST or PUT anything, they client should send an object with the id field and any derived fields missing. The database is responsible to create the id when I save it, and I would create some derived fields
// POST /users would need you to post only the name.
// {name:"Henry"}
data PartialUser = PartialUser { name :: String }
If resource represents objects of type User, what should I call the thing client is sending to me? Would you make all the derived fields Maybe values? Or would you create a second object called PostedUser or something?
It can be many things:
a request body
the representation of the intended resource state of the client
a command DTO which you can send to the domain logic in order to process it by CQRS
I would make it CreateUser command, but if you don't want to use CQRS and DDD, then you would probably call it as PartialUserRepresentation, or you don't create a data structure, just use the properties to create a new User entity. Ofc. if you use entities.
So I would say it depends on the architecture of your system.

ServiceNow - JSON Web Service, display related tables

I'm working on a C# program that retrieves data from a ServiceNow database and converts that data into C# .NET objects. I'm using the JSON Web Service to return my data in JSON format.
What I want to achieve is as follows: If there is a relational mapping between a value (for
example: I have a table called Company, where CEO is not a TEXT field but an sys_id to a Employee Table) I want to be able to output that data not with an sys_id (or just displaying the name property by using the 'displayvariable' parameter) but by an object displayed in JSON.
This means that the value of a property should be an object in JSON instead of just a single value.
A few examples:
// I don't want the JSON like this
{"Company":{"CEO":"b181e841c9212c008aeb36850331fab2"}}
// Or by displaying the name of the sys_id table
{"Company":{"CEO":"James Henderson" }}
// I want the data as follows, so I can have all the data I need inside a single JSON record.
{"Company":{"CEO":{"name":"James Henderson", "age":34, "sex":"male", "office":"SBN Left Floor 23"}}}
From reading the documentation I couldn't find anything in the JSON Web Service that allowed me to display the information like this nor
find any other alternative. It should have something to do with joining the tables and displaying it all in the right format.
I have been using SNC for almost three years and have not found you can automatically join tables in a web service. Your best option would be to use a scripted web service which possibly takes a query parameter and table parameter. Then you can json serialized your result as you see fit.
Or, another option would be to generate a new processor that will traverse the GlideRecord object. The ?JSON parameter you pass in to the URL is merely a flag to pass your request to a particular processor. Unfortunately the OOB one I believe is a Java class not a JS script, so you would need to write a script much like I mentioned earlier to traverse the object path serializing the object graph as far down as your want to go.