DBpedia REST API - dbpedia

http://dbpedia.org/page/IBM
Can anyone suggest how can I use DBpedia REST API to get the fields that are displayed in above link like, e.g., founded by, assets, etc.
Any kind of suggestion would be extremely helpful.

You can use this api: https://github.com/dbpedia/ontology-driven-api
This project is based on REST Api.

Possibly this query (results) is what you were looking for...
SELECT DISTINCT ?p
WHERE
{
OPTIONAL { <http://dbpedia.org/resource/IBM> ?p ?o }
OPTIONAL { ?s ?p <http://dbpedia.org/resource/IBM> }
}
ORDER BY ?p

Related

Sparql query for searching specific label

I want a lookup service for Wikidata similiar to what DBpedia lookup (https://lookup.dbpedia.org/) is for dbpedia but for Wikidata.
Because I didn't find any I try to create a query which searches the labels of Wikidata.
Here is my problem. I have this object https://www.wikidata.org/wiki/Q67639471 (Standards of Conduct Committee - Fourth Assembly)
The following Sparql query should find the object shouldn't it?
select distinct ?o ?oLabel where {
?o rdfs:label ?oLabel.
filter(contains(?oLabel, "Standards of Conduct Committee - Fourth Assembly"#en)).
}
But the query times out everytime. When I add the line ?o wdt:P31 wd:Q865588.(?o is an instance of comitee) then it finds it.
Why doesn't the query find the exiting object?
Does anybody know how to make or find such a lookup service?

How to query the "Props" table from Flexible Search?

Inside my code I have the primary keys of some page components in Hybris and I have to find all their attributes (properties like title, content etc.)
I can query the "Props" table using an SQL query, but I'm not sure how to find the equivalent in Flexible Search, since querying the database directly is not recommended.
Is there any other simpler way to retrieve all the properties of a component having just the primary key?
What you can do is retrieve the required component using it's primary key. Example:
select {pk} from {SimpleCMSComponent} where {pk} ='8796093056060'
Usually flexible searches are used in DAO classes(Platform example: DefaultProductDao).
When this flexible search is run by the flexible search service you get a ComponentModel. Please see below a groovy script I just created in order to exemplify how to print the ID of a Component retrieved based on its PK(In the same way by using getters you can get the title, content, etc.. ):
import de.hybris.platform.cms2.model.contents.components.SimpleCMSComponentModel;
def flexibleSearchService = spring.getBean("flexibleSearchService");
SimpleCMSComponentModel simpleCmsComponent = flexibleSearchService.search("select {pk} from {SimpleCMSComponent} where {pk} ='8796093056060'").getResult().get(0);
println(simpleCmsComponent.getUid())
I believe though that the best practice in case of CMS Components is to use their IDs instead of PK.

Azure Search - Match value from comma-separated values string

How do you structure a Azure POST REST call to match a value on a comma-separated list string?
For Example:
I want to search for "GWLAS" or "SAMGV" within the Azure field "ProductCategory".
The "ProductCategory" field in the documents will have a comma-separated value string such as "GWLAS, EXDEB, SAMGV, AMLKYC".
Any ideas?
If you use the default analyzer for your ProductCategory field (assuming it is searchable), it should word-break on commas by default. This means all you should need to do is search for the terms you're interested in and limit it to the right field:
POST /indexes/yourindex/docs/search?api-version=2016-09-01
{
"search": "GWLAS SAMGV",
"searchFields": [ "ProductCategory" ]
}
There are other ways to do this, but this is the simplest. If you already scope parts of your search query to other fields, here is how you can scope just the desired terms to ProductCategory:
POST /indexes/yourindex/docs/search?api-version=2016-09-01
{
"search": "(Name:\"Anderson John\"~3 OR Text:\"Anderson John\"~3) AND ProductCategory:GWLAS SAMGV",
"queryType": "full"
}
Please consult the Azure Search REST API documentation for details on other options you can set in the Search request. Also, this article will help you understand how Azure Search executes queries. You can find the reference for the full Lucene query syntax here.

Get dbpedia link of entity using stanford NER

I am trying to find entities from text using stanford NER. It is working fine so far. Now I want to find the dbpedia link of the entities.
I have seen it is available in alchemy API.
Is it possible to find the dbpedia links of entities using stanford NER?
Normally all the entities in Dbpedia have rdfs:label that is a string assigned to the entity. Therefore, when you are faced with a name extracted by your NER, you can use it for filtering purposes. The following example will provide he URI of all the entities that have label Sulfuric acid:
select distinct *
where {
?URI rdfs:label ?name.
filter(str(?name)="Sulfuric acid")
}
However, labels are not always what you seek, you sometimes need to actually look for the name assigned to your URI. For example, if you open sulfuric acid page, you can see that it contains dbpprop:iupacname. As a result you need to change the query to:
select distinct *
where {
?URI dbpprop:iupacname ?name.
filter(str(?name)="Sulfuric acid")
}
In this particular example the result sets are the same. But imagine you are tasked with finding London then you need to change your property to foaf:name and when running both the following queries, the result sets are quite different.
select distinct *
where {
?URI rdfs:label ?name.
filter(str(?name)="London")
}
this contains 8 results while the following query contains 21 results.
select distinct *
where {
?URI foaf:name ?name.
filter(str(?name)="London")
}
So my point is that you need to decide if you want to use labels or names. And if you decide to use names, you need to find the appropriate property to write a SPARQL query. After that, you just need a method to access DBpedia with your query.
You can use Stanford NER to extract the entity names and DBpedia Spotlight to link to the DBpedia URIs.

Which DBpedia dataset dump contains dbpedia ontology labels?

My aim is to be able to perform the following kind of queries within Virtuoso, without being dependent on whether DBpedia's SPARQL endpoint is currently up or not:
SELECT ?label WHERE {
?prop rdfs:domain <http://dbpedia.org/ontology/SpaceMission> .
?prop rdfs:label ?label .
FILTER (lang(?label) = 'en')
}
The problem is that I cannot seem to be able to identify the correct data set to download that would also include the labels of these properties. I currently have the mapping-based properties installed: http://downloads.dbpedia.org/3.9/en/mappingbased_properties_en.nt.bz2 and I do get the properties but there are no property labels there.
Is there another installation I am missing or is the only way to query that data from DBpedia's live endpoint?

Resources