Sparql query for searching specific label - search

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?

Related

Using different analyzers for different fields in same query in arangosearch views

I have a use case where given a user input I want to search across different fields. So I am able to do a query like
for v in myview
search analyzer(v.host_name == tokens(SOME_INPUT, 'text_en')[0] OR
v.ip_address == tokens(%input%, 'text_en')[0], "text_en")
return v
and it works.
But now some of the fields have different analyzer so I in the above query, I would like to use e.g. ngram for ip_address but then the above query will not work as the second argument to analyzer(....) is text_en.
Reading the docs at https://www.arangodb.com/docs/stable/aql/operations-search.html, it does not seem like I can have multiple SEARCH stanza in the same query.
What would be the way to do a query like that?

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.

Honoring previous searches in the next search result in solr

I am using solr for searching. I wants to improve my search result quality based on previously searched terms. Suppose, I have two products in my index with names 'Jewelry Crystal'(say it belongs to Group 1) & 'Compound Crystal'(say it belongs to Group 2). Now, if we query for 'Crystal', then both the products will come.
Let say, if I had previously searched for 'Jewelry Ornament', then I searches for 'Crystal', then I expects that only one result ('Jewelry Crystal') should come. There is no point of showing 'Compound Crystal' product to any person looking for jewelry type product.
Is there any way in SOLR to honour this kind of behavior or is there any other method to achieve this.
First of all, there's nothing built-in in Solr to achive this. What you need for this is some kind of user session, which is not supported by Solr, or a client side storage like a cookie or something for the preceding query.
But to achive the upvote you can use a runtime Boost Query.
Assuming you're using the edismax QueryParser, you can add the following to your Solr query:
q=Crystal&boost=bq:(Jewelry Ornament)
See http://wiki.apache.org/solr/ExtendedDisMax#bq_.28Boost_Query.29

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?

SharePoint FullTextSqlQuery Search FREETEXT with multiple columns

I have a custom FullTextSqlQuery used to retrieve some specific pages.
The query contains multiples FREETEXT predicates and gives unusable rankings, which is expected behavior according to MSDN, the query should contain only one FREETEXT
The basic query that gives expected results is
SELECT Title, ACLanguage, ACContent, ACCategory, ACKeywords, ACID
FROM scope()
WHERE (FREETEXT(Title,'text') OR FREETEXT(ACContent, 'text') OR FREETEXT(ACSubtitle, 'text'))
The documentation says this query can be rewritten to use a single predicate using a group alias, but it isn't clear about syntax. I tried multiple statements ending with :
SELECT Title, ACLanguage, ACContent, ACCategory, ACKeywords, ACID
FROM scope()
WHERE WITH(Title, ACSubtitle, ACContent) AS #SearchColumns FREETEXT(#SearchColumns,'text')
But all my attemps ended with a QueryMalformedException
How should this query be written ?
Specify multiple columns like this:
SELECT Title, ACLanguage, ACContent, ACCategory, ACKeywords, ACID
FROM scope()
WHERE (FREETEXT((Title,ACContent,ACSubtitle),'text'))
Or, shorthand for searching all full text indexed columns:
SELECT Title, ACLanguage, ACContent, ACCategory, ACKeywords, ACID
FROM scope()
WHERE (FREETEXT(*,'text'))
(source)

Resources