I have three class in my ontology
class babyAge (6+, 8+, 12+)
class taste (asam, manis, asin)
class food (recipe name)
i want to querying data food for babyAge (6+) and have taste (asam)
i use this code in my java program (i dont know if there are other code more simple than this one, if you know please tell me too) :
SELECT ?babyAge ?taste ?food
WHERE { ?babyAge mpasi:hasResep ?food.
?food mpasi:hasRasa ?taste.
FILTER regex(str(?babyAge),"6+").
FILTER regex (str(?taste),"asam")}
and i get my data. but when i execute that code in protege, i dont get anything. Can someone help me?
It's difficult to tell without seeing the ontology.
My first move would be to ensure mpasi is bound to the same value in the ontology and in your query - it might be a case of mismatched IRIs.
You might also want to try without filters and see if anything is returned.
Related
I would like, if possible, to have some control on the job description and name. I tried to add the JobDisplayName to the Controller that is activating the job, also to the method that is being called to run in background but no luck.
Also the job description page is very polluted with unnecessary information that i would like to remove, or to format to a readable information.
In the A case, i would like to remove this, or to format it to a more readable format.
In the B case what can i do to output it to a human readable object?
Issue A: there are quite a few bugs that have been opened but most of them suggest there is no way to update the information displayed there, but, you should follow the Best Practices and keep the method and arguments small.
Fix B
Change the return statement of your method that's enqeued to fix the data displayed.
When I do something in Python or in JavaScript I always have a lot of opportunities, both, to read documentation of a particular library and to try tons of teeny-weeny examples.
Unfortunatelly, in C++ it is not so popular (for what reason?) to provide at least a little ammount of working examples in documentation. Two good examples are C++ clients for MongoDb and RethinkDb.
My question here concerns RethinkDB. In Python I know how to list all table names, not because there is documentation and I'm supposed to dive into the driver code, but just because there is a tiny handy example of doing this:
r.db('test').table_list().run(conn)
And I'm done. In C++ I do not know how to do this - how to list all table names. I do not know even if there is such a method. I wish someone could provide little instructions and share their knowledge.
EDIT
It seems, like I found an appropriate method table_list, but unfortunatelly I do not know how to use it. Besides, it seems that I try to connect to the database in a wrong manner - by this I mean that I connect to the server, but not to a particular database (and again I do not know how to implement this). So, this is what I have now:
std::unique_ptr<R::Connection> conn = R::connect("localhost",28105);
//^^^ I want to connect to a particular database "mydb" - how to do that?
R::Cursor cursor = R::table_list().run(*conn);
for(R::Datum& item : cursor){
do_something(R::write_datum(item).c_str());
// ^^^ is that right???
}
If I do it, like I showed - without specifying the database name, then I get nothing. If, however, I try to connect like this:
R::connect("localhost",28105,"mydb");
then inside for I get an infinite loop. So, I need some help. Thanks!
EDIT
Phew, I found a solution. And I must confess, that it is rather intuitive. I will post it below.
This is the solution:
std::unique_ptr<R::Connection> conn = R::connect("localhost",28105);
R::Cursor cursor = R::db("mydb").table_list().run(*conn);
for(R::Datum& item : cursor){
do_something(R::write_datum(item).c_str());
}
and it works great. I want to thank AtnNn - the sole developper of this great driver.
I'm using Sitecore. I want to get the full name/description of a DMS rule in programcode by Sitecore ID, for example: "Where the DayOfWeek has a value that is equal to Tuesday".
Who knows how to do this?
Thanks a lot.
Jordy
I don't know of a simple way, but the class responsible for rendering the rule text is Sitecore.Shell.Applications.Rules.RulesRenderer in Sitecore.Client.dll.
Its constructor accepts the XML from a rules field and you call the Render method, passing in a prepared HtmlTexteWriter. It also has a bunch of fairly self-explanatory private methods like RenderRule, RenderCondition etc.
I'm sure if you decompile that class you can pick out the bits you need.
I want to validate an opinion with you.
I have to design a web service that searches into a database of restaurants affiliated to a discount program in a specific country around a given address.
The REST call to such a webservice will look like http://server/search?country=<countryCode>&language=<languageCode>&address=<address>&zipcode=<zipcode>
The problem is that some countries do not have zipcodes or do not have them in the entire country.
Now, what would you do if the user passes such a parameter for a country that does not have zipcodes, but he/she passes a valid address?
Return 400 Bad request.
Simply igonre the zipcode parameter and return results based on the valid address
Return an error message in a specific format (e.g. JSON) stating that zipcodes are not supported for that country
Some colleagues are also favoring the following option
4. Simply return no results. And state in the documentation that the zipcode parameter is not supported. Also we have to create a webservice method which returns what fields should be displayed in the user interface.
What option do you think is best and why?
Thanks!
Well the OpenStreetMap Nomination Server returns results even if you dont know the ZIP Code and you can look at the results anyway. What if the user doesnt know the zip code but wants to find hist object?
I would try to search for that specific object anyway, especially because you said that some countries have zip codes partially.
If you simply return nothing te user doesnt know what went wrong and he wont know what to do.
That would depend on the use case. How easy is it for a user of the API to trigger that case? Is it a severe error which the user really should know how to avoid? Or is it something that is not entirely clear, where a user may know (or think he knows) a zipcode where officially there shouldn't be one? Does it come down to trial and error for the user how to retrieve correct results from your API? Is it a bad enough error that the user needs to be informed about it and that he needs to handle this on his side?
If you place this restriction in your API, consider that it will have to be clearly documented when this case is triggered, every user of the API will have to read and understand that documentation, it needs to be clear how to avoid the problem, it needs to be possible for the user to avoid the problem and every user will have to correctly implement extra code on his side to avoid this problem. Is it possible for the user to easily know which areas have zipcodes and which don't?
I think the mantra of "be flexible in what you accept, strict in what you output" applies...
Regexs make me cry, so, I came here for help.
I'm looking for some tips on Find & Replace in Panic's Coda. I know the F&R
is pretty advance but I'm just looking for the best way to do this.
I'm trying to rewrite a 'template engine' (very basic) I have going on with a
webapp I'm coding in PHP (CodeIgniter).
Currently I'm calling my template like so:
$this->load->view('subviews/template/headerview');
$this->load->view('subviews/template/menuview');
$this->load->view('subviews/template/sidebar');
$this->load->view('The-View-I-Want-To-Load'); // This is the important line
$this->load->view('subviews/template/footerview');
However it's inefficient using five lines of code every time I want to
load up a different page, in every different controller. So I rewrote it like this:
$data['view'] = 'The-View-I-Want-To-Load';
$this->load->view('template',$data);
That way if I need to make any major changes to the design it can
easily be done from the template.php view file (which contains the header, menu, sidebar views etc. etc.).
However I use the previous 5-lines all over the place in many
different controllers and functions. So, my question is --- How can I
find and replace the old template engine (5 lines of code) for the new
one - substituting in the name of the view in the important, unique
line for the one in $data['view]?
Does that make any sense?! If not I'll try and rephrase! I mean, is there a way of doing this via a Regex or something? Or am I on completely the wrong lines here?
your regex will look something like this :
\$this->load->view\('subviews/template/headerview'\);\n\$this->load->view\('subviews/template/menuview'\);\n\$this->load->view\('subviews/template/sidebar'\);\n\$this->load->view\('([^']*)'\);\n\$this->load->view\('subviews/template/footerview'\);
and replace with
\$data['view'] = '$1';\n\$this->load->view('template',\$data);