Get all properties and related ID of an item using SPARQL query - sparql

I want to retrieve all properties and their ID of one item from Wikidata by using SPARQL. I have two queries.
This query only can retrieve properties without their IDs:
The result of it is shown like this:
This query only can retrieve two-level properties with ID:
And this is the result:
Is there any way to mix them to show all properties with their IDs?

Related

Obtain country from wikidata item using SPARQL

I am trying to get the country of a Wikidata item using SPARQL. I am quite new and I am not able to obtain only the property country (P17) and its label.
I used this example and I am able to obtain all properties. Link.
In this case using the output of a previous query, for example, I get the item Q1492 corresponding to Barcelona. How can I obtain its country, Spain?

how to get additional fields on udemy api

I would like to list fields on course eg title,header when use course-list. does anybody knows about a way to query by fields so the returned list of fields ?
when query on
GET api-2.0/courses/?category=Development&subcategory=Web Development&price=price-free&is_affiliate_agreed=True&instructional_level=all&fields=title,headline
result
result is count all query

ElasticSearch Get Value of Nested Attribute

I have this structure in index:
{ details: {errors:[], warnings:[], results:[]}}
I want a query so that I can get the count of errors warnings and results for each record.
I was looking into the script filter on an aggregate, but the thing is I am already aggregating and I'm unsure on how to use the value count filter with this since I need to
1) Get the .length attribute of the array
2) When I do that I get an error saying no attribute like that exists
Can I get a sample query? I'm guessing it will somehow incorporate the script filter.
The best way to achieve this is the token count data type told in the below link
LINK - http://www.elastic.co/guide/en/elasticsearch/reference/1.4/mapping-core-types.html#token_count
You can couple this with multi fields to achieve an extra field per error , warning and results. This can be used in the query to view the count of elements.

Few questions about Grails' createCriteria

I read about createCriteria, and kind of interested on how these works, and its usability in providing values for dropdown box.
So say, i have a table in the database, Resource table, where i have defined the table in the domain class called Resource.groovy. Resource table has a total of 10 columns, where 5 of it are
Material Id
Material description
Resource
Resource Id
Product Code
So using the createCriteria, and i can use just like a query to return the items that i want to
def resList = Resource.createCriteria().list {
and {
eq('resource', resourceInstance)
ne('materialId', '-')
}
}
Where in the above, i want to get the data that matches the resource = resourceInstance, and none of the materialId is equal to '-'.
I want to use the returned data from createCriteria above on my form, where i want to use some of the column on my select dropdown. Below is the code i used for my select dropdown.
<g:select id="resourceId" name="resourceId"
from="${resList}"
disabled="${actionName != 'show' ? false : true}" />
How do i make it so that in a dropdown, it only shows the values taken from column Product Code? I believe the list created using createCriteria returns all 10 columns based on the createCriteria's specification. But i only want to use the Product Column values on my dropdown.
How do i customize the data if in one of the select dropdown in my form, i wanted to show the values as "Resource Id - Resource Description"? The values are combination of more than 1 columns for one select dropdown but i don't know how to combine both in a single select dropdown.
I read that hql and GORM query are better ways of fetching data from table than using createCriteria. Is this true?
Thanks
First of all refer to the document for using select in Grails. To answer all questions:
Yes, the list to select from in the dropdown can be customized. In this case it should be something like from="${resList*.productCode}"
Yes, this can be customized as well with something like
from="${resList.collect { \"${it.resourceId} - ${it.resourceDesc}\" } }"
It depends. If there are associations involved in a domain then using Criteria will lead to eager fetches which might not be required. But with HQL one gets the flexibility of tailoring the query as needed. With latest version of Grails those boundries are minimized a lot. Usage of DetachedCriteria, where queries etc are recommended whereever possible. So it is kind of mixing and matching to the scenario under consideration.

How to work with map property in RQL (Oracle's ATG Web Commerce)

We use Oracle's ATG Web Commerce for our project. And currently we need construct RQL query which obtain products which SKU's tacticalTradeStatuses contains certain status and ordered by status value.
I briefly describe the relationship between entities: Product item descriptor contains list of SKUs. Each SKU contains map tacticalTradeStatuses (key - tactical trade status, value - sequense)
For example, how to obtain all products which SKU's tacticalTradeStatuses property contains key 'BEST_SELLER' and ordered by value associated with key 'BEST_SELLER'.
Key by which we want to select products we want to pass as RQL parameter.
i have two ways to doing that
1) first create a query which fetches all the product based on map key BEST_SELLER
2) Now pass it to foreach droplet and add sort properties. which help to sort the result based on your requirements
for sorting please refer to below link
http://docs.oracle.com/cd/E23095_01/Platform.93/PageDevGuide/html/s1316foreach01.html
2 way i think is to use query options in RQLStatement.. which work same as sort properties in for each
If you provide some XML Repository structure that will be good..hope it will help you