How to get labels from wikidata? - wikidata

I want to use wikidata for MultiLabelClassify. I don't understand the struct of wikidata, I want get all the labels from a entity of wikidata. Could you give me some suggestion?

Either use Wikidata Query Service (see link by Kiran) oder use the MediaWiki API.
With the MediaWiki API, you can get all labels of an entity by calling:
https://www.wikidata.org/w/api.php?action=wbgetentities&props=labels&ids=ENTITYID
For example for entity Q42:
https://www.wikidata.org/w/api.php?action=wbgetentities&props=labels&ids=Q42

Related

Get request data (GET) in a Symfony (5) formType without using data_class

I'm building a formType to filter products on a collection page. You can set multiple select boxes which makes other auto filled or unnecessary. I want to be able to manipulate the formType based on the data like when using a data_class object. I'm not using data_class because the search isn't a persisted object which is saved to the database. I'm using a GET form.
For example 2 select boxes:
category
productType
When setting a category makes some of the productTypes unnecessary. So i want to not show it.
To do so in the formType I need the data of the request (GET) but I can't find a way to do so.
To retrieve data from the form, you can use $form->getData().
As you're in a GET context, I suspect you can take advantage from FormEvents (take a closer look to POST_SET_DATA event) and get rid of values you don't need.
One other thing I would like to point out, is that you still can use some kind of object that's not persisted to DB, like DTO or whatever.
Forms and entities are not related anyhow, neither in the usage nor in the intentions.

In GraphQl dot net how we can get projected field names from ResolveFieldContext

I am new in Graphql and using graphql-dotnet in my asp.net core project.
Consider I have written a query like following.
restaurants {
id
name
}
Now I want to get this field names from ResolveFieldContext. Is there any way to get this filed names?
Expecting your valuable help.
According to https://github.com/graphql-dotnet/graphql-dotnet/issues/903
The solution is we need to use SubFields to get projected fields

Marketo REST API - is there a way to get all records of a custom object?

I created a custom object and i want to get all its existing records. Is there a way of doing that via the REST API? Seems like a very basic and simple operation but i couldn't find information about it anywhere.
As you say, it seems like a basic task, but in the reality, it is more complex indeed.
Unfortunately, the Get Custom Object endpoint (which is the only endpoint to fetch Custom Objects) requires the filterType and filterValues parameters to be present as well. Basically this means that you have to have some information about the queried objects beforehand.
Also, a further restriction is that the value of filterType can only be one of the “searchable” fields of the Custom Object, meaning that it has to be either a Link field or a Dedupe field. (These fields are listed under the searchableFields property in the response from the Describe Custom Objects endpoint.)
So as mentioned above, you have to know the values for at least one of the properties of your Custom Objects before you make the query.
With additional queries though, you can grab these required values.
Let's say, you have your Custom Object linked to the Lead Object, and the Link field is called Owner Email (with the REST API name being ownerEmail) which links to the Email Address field of the Lead Object. In this case you could set the filterType to ownerEmail and set the emails of the leads as filterValues.
Then it is up to you how you gather the emails of those Leads who has a Custom Object attached. Luckily the REST API won’t throw an error if you provide a value that has no corresponding Custom Objects.
If your Custom Object is linked to a Lead, it's a bit complex but you can do like this:
Create a smart list and filter with "Has You Custom Object"
Get the smart list with API (GET /rest/asset/v1/smartLists.json)
Based on this list of Leads, get all Custom Objects (see the other answer).

NelmioApiDocBundle hide list of choices

I'm using Symfony2, FOSRestBundle and NelApiDoc to create Rest services.
Documentation created by NelMioApiDoc I have a field that is defined as a choice and extracts all the records in the database. How can I tell NelMioApiDoc to hide values retrieved from database?
Thanks for the answers
I think this is your answer, once it is merged:
https://github.com/nelmio/NelmioApiDocBundle/pull/543

umbraco and custom system table

I have the following scenario:
My website db has a system table called "Companies", which includes an id field, companyName field, and companyImageUrl field.
How do I set up an umbraco document type for adding entries to this table ?
Maybe I shouldn't use a custom table at all ?
Thanks.
As far as I know, Umbraco doesn't support what you want to do out of the box (mapping a document type to a table that isn't part of the umbraco core).
One approach that might work is to create an action handler that syncs a Company doc type to your table when creating a node of that type.
It's a bit of a hack though. I've found that I've very rarely needed to create custom tables. What exactly are you trying to do with it? My guess is that you don't really need it and would be better off working with a doc type instead. Umbraco provides a variety of ways to get and act upon doc types from within custom C# code (check out the umbraco.NodeFactory namespace). You'll also get the added benefit of being able to easily interact with these nodes from XSLT/Razor.

Resources