Set a custom 'no results' message from invalid SPARQL queries - sparql

Currently, I'm creating some SPARQL queries, which I am brand new at, for our data analysts. We want them to be able to fill in what they're looking for in custom search boxes that edit the query under the hood. So far I have most working, but I was hoping there is a way to return a custom message if they, say, search for a non-existing table in our dataset. Currently, they get the default "query returned to results" message, but I'd like to change that to something more informative.
I've tried a few loose ideas, but as a newbie myself, it's hard for me to figure out how to implement anything. For instance, I've tried using filters and such to see if I can change a value if the results return a count of 0, but that is not a valid query, unfortunately. I've tried putting the filters in OPTIONAL blocks, creating some BINDs, trying to work with IF statements, etc., but can't seem to get them all working how I'd like.
Does anyone have any experience implementing something like this, or is this idea even possible?? Thanks in advance for any input/tips

Related

Setting up alerts for metrics in Splunk

I'm sending data to Splunk and everything is working just fine, i can see the data that i'm sending and run a query and get results. Right now I'm only using a test data set, but eventually people will be sending their own fields (as well as the mandatory ones). My question is, since I don't know what kind of data they will be sending, can I still set up alerts for them? Can I create something general?
It's pretty hard to create a generic alert that's actually useful. You may be able to craft something using the mandatory fields, but it may not be all that helpful.
If you're opposed to letting users create their own alerts then let them come to you with what they want.

How to get some some specific result using MarkLogic search API

I am new to MarkLogic and now I am trying to get some specific result of searching query.
More specifically, searching some word through search API and supposed to get a result of documents which include specific word.
No header information, no rank or any other meta data, just want to get documents as a result.
Is there any way to just one request and get documents as a result?
Or do I need to write some code to get specific result.
I'll be appreciated if you help me.
Thanks
If you are accessing MarkLogic from outside, I'd have a look at a POST call to /v1/search with an Accept header of multipart/mixed. Details should be described here: https://docs.marklogic.com/REST/POST/v1/search
If running inside MarkLogic, you could consider using the low-level cts:search, which indeed returns documents directly. Keep in mind though that it won't paginate results, and it is usually unwise to return more than about 50 to 100 documents at once. It would just hog memory, and not allow for parallel processing.
HTH!

MusicBrainz API search provides different results from web page

I'm trying to work with MusicBrainz's API but I'm having some issues with the results of the search endpoint.
Let's have an example searching for Who's Who? - SIZE020 - Klack (Mix Two)
Searching from their site leads to this page, with an almost correct first result (probably because the 100% correct infos are not on the database at all).
Using the API leads to different situations which are causing some issues.
I made some different attempts with no success, even if I think I know enough of Lucene's syntax to write a successful query for this service.
Take 1 - empty results with the query "Who's Who? - SIZE020 - Klack (Mix Two)"
Take 2 - completely wrong results with the query Who's+Who%3F+-+SIZE020+-+Klack+(Mix+Two) (same result with the unescaped ? character)
Take 3 - empty results with the query "Who's" AND "Who?" AND "SIZE020" AND "Klack" AND "Mix" AND "Two"
Now, I know that SIZE020 shouldn't be in the query, but I don't want to deal with file names on client side so I'm just pushing the query to their service hoping that everything will work. And it works, but only if I query the service through their website, making me think that my query syntax is wrong and leaving me clueless.
Do you have any hint on why I get different results between website and xml API?
EDIT: as a side question, given a random file name, what's the better way to submit the query? I'm getting good result using the web version and submitting the typical mp3 filenames (like artist_-_title_(version).mp3 but I'm not getting anything good from my client.
Searching via the web service always uses the "indexed search with advanced query syntax" search method, this can't be changed.

Facebook like scroll down and searching/adding

I am working on enhancing the a search functionality of a website.
The current search is working as
1.reading all the rows from the database
2.find keywords from each rows and return the result.
The problem is it is too slow and it has to prepare all the data in the backend which mean read all the data from different database and put them to html.
The solution comes to my mind is:
show partial search results (like 10) which means as long as it find enough result in the databse it will stop reading and searching rows.
once user scroll down the page, using ajax to trigger another process of searching
My questions is:
Is it a good way(possible way) to do that?
Any tutorial source I should look up.
i know it is kinda abstract question, but I need advice for this.
Thanks in advance.
Update my research:
https://github.com/webcreate/infinite-ajax-scroll
this jquery lib can do the front end job

Best approach to build a DYNAMIC query-by-example form in AngularJS?

I'm relatively experienced with Angular having written many directives, but I have a new requirement where I have to build a query-by-example form into which a user can enter different search criteria. My problem is that I do not know ahead of time what the possible criteria will be. This criteria information will be coming from the server via an ajax request and can differ per user. Thus I will need to dynamically construct a suitable user interface based on the information I get from the server.
I have built individual directives suitable for capturing the search criteria (for example a custom calendar control for date criteria) but I am unsure of the best approach to adding these directives to a form dynamically. Is this even possible in Angular?
I have built something like this before in jQuery but its not so clear to me how I would best do this in an 'Angular way'?
Any suggestions would be most appreciated!
Everything that you can express as a model-to-view projection can be implemented in AngularJS.
I think here you can make a model consisting of "query params". Each of them has name, type and data for filter builder. For example, for the "select" type a data can contain a list of all possible values to choose from.
Then you iterate through the list of "query params" with ng-repeat, rendering each control differently according to its type. That's all.
If I understood the task wrong, please provide more info.