Amazon Product API - get list of books for multiple author names in one request - amazon-product-api

anybody knows if it is possible to get books for multiple authors in one request from Amazon Product API?
i'm using power search to query amazon but neither of these two power queries return any results:
author: (Dan Brown or Stephanie Meyers or J. K. Rowling) and pubdate: after 30-06-2006
author: Dan Brown and author: Stephanie Meyers and author: J. K. Rowling and pubdate: after 30-06-2006
query with a single name works fine.
is there something wrong with the query or is it just not possible?

You can try to send two individual requests at once using a BatchRequest
http://docs.amazonwebservices.com/AWSECommerceService/2011-08-01/DG/index.html?BatchRequests.html

Related

Database Design for Language Learning App?

My app is targeting people who are learning English, Thai and Chinese vocabulary.
Corresponding to each type of language that learners have chosen to learn, there will be different courses (contain set of relating vocabulary), like "Number Vocabulary Course", "Color Vocabulary course"
The app supports learners in about 20 countries
table: english_words
EnglishWord_id
EnglishWord_name
1
Hello
2
Student
table: english_thai_dictionaries ( For Thai Learner), for Chinese learner, have other table with the same structure (english_chinese_dictionaries)
englishword_id
full_meaning
1
mmmmm
2
Sample Full
table: english_course => course_name
table: english_course_words =>
course_id
english_word_id
1
2
2
3
For Thai language, there are also have another table, like:
Thai_chinese_dictionaries. Thai_Indo_dictionaries.
The App also support offline search for Vocabulary (For example: When they are Indo, they want to learn Thai, the Thai_indo_dictionaries Database will be download and import to SqLite file)
My Question:
I would like to ask if you think the above Database design is appropriate or not? Is it optimized or not?
I choose MySQL InnoDB because my data is more often read than write.
How about MongoDB and Json Structure? If you have any idea or some suggest, could you tell me?

Read a CSV file in prolog and format the data into predicates of the form: prefers(employer 1, [Student1, Student2, Student3])

I have been trying to figure this out for days now. I have a two csv files. One with the names of employers and students in order of the employer's preferences. The other with the names of students and the employers they wish to work form, again in order of preference. The files look like this:
Thales, Melissa, Craig, Luke
US Post, Craig, Luke, Melissa
IBM, Luke, Melissa, Craig
and
Melissa, Thales, US Post, IBM
Craig, IBM, Thales, US Post
Luke, US Post, IBM, Thale
I need to read this file line by line and populate a prolog database with the predicates like:
prefers(Thales, [Melissa, Craig, Luke]).
prefers(Craig, [IBM, Thales, US Post]).
student(Melissa).
employer(IBM).
I know how to open the file, read it, and create a stream, but I have no clue how to do what I asked for in this question. The solution is most likely DCG based.

Xpath doesn't find anything

I have this webiste : http://directory.ccnecommunity.org/reports/rptAccreditedPrograms_New.asp?sort=institution
Each university is separated with a line. I want to get the dates under Bacalaureat, Master's and Doctor of Nursing Practice of each university.
My XPATH :
/table[#width="95%" and #align="center" and #class="center"]
//table[#width="260px"]/tr/td[#style="width: 100%;"]/text()'
it returns an empty list.
As you see between the root table and the second there are a lot of other elements so I did a double slash //.
P.S. I do this from root because I would like to retrieve the data by index :
/table[#width="95%" and #align="center" and #class="center"][1]
//table[#width="260px"]/tr/td[#style="width: 100%;"]/text()'
I want to get the dates under Bacalaureat, Master's and Doctor of Nursing Practice of each university.
Try this xpath for Bacalaureat:
//tr/td[span="Baccalaureate"]
For Master's try:
//tr/td[contains(span,"Master")]
And for Doctor of Nursing Practice"
//tr/td[span="Doctor of Nursing Practice"]
And all together:
//tr/td[span="Baccalaureate"] | //tr/td[contains(span,"Master")] | //tr/td[contains(span,"Master")]
Update:
To access each university with wonted data (here only with Baccalaureate and Master) by an index you may try:
(//tr[ td[span="Baccalaureate"] or td[contains(span,"Master")] ]/ancestor::tr[1])
[3]//tr/td[span="Baccalaureate" or contains(span,"Master")]/text()

translating street names with meaning creates a wrong address

I'm using google translate API to translate text in my application but when it comes to street names its not the right way t go.
I want to keep the phonetics of the name using the letters of the new language for example '1828 oak street' should be 'Calle 1828 oak' and not 'Calle 1828 roble' when translating to spanish, I can give a Russian example but then the problem would be lost in translation :-)
every name that has a meaning like Church Street, Main Street, Walnut Street, Maple Avenue, just naming few, will be translated to its right meaning and the result is the wrong street name.
any ideas on how to solve this?
There are two options I can think of:
Make a dictionary/matrix of words and how they translate across different languages. When given a string of an address in a known language, take the street keywords from a list for that language, and search through the string for matches. When this is received, replace the found keywords with their translations. Pros: more accurate. Won't use up query limits. Cons: will require a lot of manual work and cultural knowledge. (i.e. Languages like Russian have a ton of different words for streets, and may not match up exactly with English, as an example).
Translate the string into a default language (such as English), and check for keywords. Then, use Google Translate the keywords into the desired language, and substitute it into the original string. Pros: Simple and easy to implement. Cons: less control on the output or cultural differences.

Use Hibernate to find partial matches of a phrase with respect to database entry

I have an Entity called User:
public class User {
private String title;
}
I provide a text field to my clients. when they type in a phrase I would like to find all User entities whose names include the given phrase.
For example consider having list of entries in database with following titles:
[ Alan Smith, John Cane, Juno Taylor, Tom Caner Junior ]
jun should return Juno Taylor, and Tom Caner Junior
an should return Alan Smith, John Cane, and Tom Caner Junior
It is possible to do this by loading all user entries from database and then check if the title contains the given phrase, but I may have numerous users on the system and loading all of them seems not to be a good choice.
Hence I want to handle this in database layer and preferably with Hibernate Criteria of some sort. Please let me know if this makes any scene and is there a cost effective way to achieve this.
You want to use an ilike restriction.
Something along the lines of
String value = "jun";
Criteria criteria = session.createCriteria(User.class);
criteria.add(Restrictions.ilike("title", value, MatchMode.ANYWHERE);
should do the trick.
I don't know how efficient it is, and it may well vary depending on your DB (esp as it mimicks something actually available in Postgres, and may use that operator in the postgres dialect). It's probably better than getting everything and filtering in Java though.