What is the meaning of these restriction notices - here-api

A number of categories contain one or more of the following notations:
Note: This category is a HERE protected category.
Note: This category is a HERE owned category.
Note: This category is a HERE search-only category.
(RESTRICTED)
For example, airports is such a listed category. Do these restrictions mean I may not search for the location of airport?

You may search for RESTRICTED categories and still find results. RESTRICTED doesn't mean you cannot search for it. It means that these data should be from highest places quality providers (for example: government or HERE driven quality).
Example: In the query below I am able to search for Airport terminal category (RESTRICTED) and get relevant results. Hope you find this useful.
https://places.cit.api.here.com/places/v1/discover/explore?at=50.038174%2C8.562152&cat=400-4000-4582&cs=pds&Accept-Language=en-US%2Cen%3Bq%3D0.5&app_id=xxxx&app_code=xxxx

Related

AQL and Graph Traversal: Product recommendation example

I have been learning Arangodb and graph traversal using AQL, and I have looked at some of the examples that can be found online like flight paths, actors and movies, but I have trouble wrapping my head around writing what I initially thought would be a simple product recommendation experiment where a customer is recommended products he/she has not bought based on other customers' (who have made similar purchases) purchases.
This is what I managed to achieved to so far, retrieving products that other customers' who have purchased the same product as the current customer
FOR products IN 1..1 OUTBOUND 'customers/118685' bought
FILTER products._id LIKE "products/%"
FOR other_buyers IN 1..1 INBOUND products bought
FILTER other_buyers._id != 'customers/118685'
FOR other_buyers_products IN 1..1 OUTBOUND other_buyers bought
return other_buyers_products
Also, I haven't reached the stage where the recommendation would could be refined to customers who have made more similar purchases (i.e. based on higher count) with the current customer. Appreciate advice or helpful examples.
this is a very open question. a more precise question would result in more and better answers... but i will give it a try.
you can express your current query in a more condense way:
FOR product IN 3..3 ANY 'customers/1' purchases
RETURN DISTINCT product
counting occurrences of a product can be added easely with COLLECT:
FOR product IN 3..3 ANY 'customers/1' purchases
COLLECT pid = product._id WITH COUNT INTO count
RETURN { pid, count }
this is still a very naive approach. you will end up with recommendations like "you once bought banana, you should by toilet paper", because everybody bought those things eventually. you can improve your results by not just saving what product a customer bought, but also when. Then you will be able to find out what products are bought together often, f.e. a flashlight and batteries.
look around on the internet for further inspiration, f.e. here.

How to find all places, which belong to a category like atms in an area, which is defined according to a radius or some latitutes and longtitutes?

I have to get all places, which belongs to a category like restaurants, atms, hospitals in an area according to a radius or some latitutes and longtitutes, which is defined by the user. As an example, imagine I want to get all the ATMs in an area. This area must be abled to define for the user. I want to get all these atms in that defined area. I couldn't find a query in APIs to fulfill my requirement. Can you please help me to do this?
I tried Google places api to do this. Following is one of a query I tried.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=6.927079,79.861244&radius=1500&type=atm&key=YOUR_API_KEY
I couldn't get all atms using this query. The output was limited in this case.
And I also tried Places (Search) API in Here Maps. But I couldn't find a way to fulfill my requirement.
Maybe the manual is misleading. It says that a query is required, but you can actually just do a browse/ query without a 'q' if a 'cat' is specified and you'll get all of the responses with that category near your 'at' (or restricted to your 'in'), sorted by distance.
So, to get 50 ATMs near the center of San Francisco, you can use a query like https://places.api.here.com/places/v1/browse?at=37.7672%2C-122.4425&cat=700-7010-0108&size=50&cs=pds...
For restaurants, it's a bit more complicated since there are many different kinds of restaurants and they all won't necessarily have the "Restaurant" category. Some might only have "Fine Dining", for example. But 'cat' can be a comma-separated list of categories, so the user can specify all of the subtypes to make sure they get all of them.
You need to set cs=pds and use the category ids from the places-category-system documentation reference below, so if users are typing in category names you'll have to do some transformation in your code. If you are interested in looking for specific types of restaurants like Chinese or Italian, there's a set of food types that can also be put in the 'cat' parameter (ids need to be used there as well)
https://developer.here.com/documentation/places/topics_api/resource-browse.html
https://developer.here.com/documentation/places/topics/place_categories/places-category-system.html
https://developer.here.com/documentation/places/topics/place_categories/food-types-category-system.html

modeling scenario with mostly semi-additive facts

Im learning dimensional modeling and Im trying to create a model. I was thinking about a social media platform which rates hotels. The platform has following data:
hotel information: name and address
a user can rate hotels (1-5 points)
a user can write comments
platform stores the date of the comments
hotel can answer via comment and it stores the date of it
the platform stores the total number of each rating level (i.e.: all rates with 1 point, all rates with 2 point etc.)
platform stores information of the user: sex, name, total number of votes he/she made and address
First, I tried to define which information belongs to a dimension or fact table
(here I also checked which one is additive/semi additive/non-additive)
I realized my example is kind of difficult, because it’s hard to decide if it belongs to a fact table or dimension.
I would like to hear some advice. Would someone agree with my model?
This is how I would model it:
Hotel information -> hotel dimension
User rating -> additive fact – because I can aggregate them with all dimensions
User comment -> semi additive? – because I can aggregate them with the date dimension (I don’t know if my argument is correct, but I know I would have new comments every day, which is for me a reason to store it in a fact table
Answer as comment -> same handling like with the user comments
Date of comment-> dimension
Total Number of all votes (1/2/3/4/5) -> semi-additive facts – makes no sense to aggregate them, since its already total but I would get the average
User information sex and name, address -> user-dimension
User Information: total number of votes -> could be dimension or fact. It depends how often it changes. If it changes often, I store it in a fact. If its not that often, then dimension
I still have question, hope someone can help me:
My Question: should I create two date dimensions, or can I store both information in one date dimension?
2nd Question: each user and hotel just have one address. Are there arguments, to separate the address dimension in a own hierarchy? Can I create a 1:1 relationship to a user dimension and address dimension?
For your model, it looks well considered, but here are some thoughts:
User comment (and answers to comments): they are an event to be captured (with new ones each day, as you mention) so are factual, with dimensionality of the commenter, type of comment, date, and the measure is at least a 'count' which is additive. But you don't want to store big text in a fact so you would put that in a dimension by itself which is 1:1 with the fact, for situations where you need to query on the comment itself.
Total Number of all votes (1/2/3/4/5) are, as you say, already aggregates, mostly for performance. Totals should be easy from the raw data itself so maybe not worthwhile to store them at all. You might also consider updating the hotel dimension with columns (hotel A has 5 '1' votes and 4 '2' votes) that you'd update as you go on, for easy filtering and categorisation.
User Information: total number of votes: it is factual information about a user (dimension) and it depends on whether you always just want to 'find it out' about a person or whether you are likely to use it to filter other information (i.e. show me all reviews for users who have made 10-20 votes). In that case you might store the total in the user dimension (and/or a banding, like 'number of reviews range' with 10-20, 20-30). You can update dimensions often if you need to, but you're right, it could still just live as a fact only.
As for date dimensions, if the 'grain' is 'day' then you only need one dimension, that you refer to from multiple facts.
As for addresses, you're right that there are arguments on both sides! Many people separate addresses into their own dimension, referred to from the other dimensions that use them. Kimball suggests you can do that behind the scenes if necessary, but prefers for each dimension to have its own set of address columns(but modelled as consistently as possible).

Graph data modeling assistance relating to soccer matches

I am trying to model soccer matches and the referees and teams that play in them. I want to create nodes based on matches, referees, and players and am not clear on the best approach to model them? That is should I model it after cities, matches? Do I create a root node Id etc?
The kind of information I would looking for later would be stuff like:
1). Show all the matches for a particular referee (could be in multiple cities)
2). Show all matches where referee worked and home team won
3). show all referees that that have the highest count of wins for the home team?
4). show most active refereess in a particular city
As you can see there are all sorts of questions and for someone new this can be a little overwhelming. While I am reading some books, I wanted to see if any experts could help me in the scenario above. Again not sure if I need a root node that connects all the cities and referees and matches or just keep things independent. Your feedback would be most appreciated.
One of the possible models that at the moment seem to satisfy the queries you've posted:
(Team)-[:PLAYS]->(Match)
(Match)-[:HAS_REFEREE]->(Referee)
(Match)-[:PLAYED_IN]->(City)
The PLAYS relation could have a property to indicate if the team was the home team. You could also have a property on the PLAYS relation to indicate whether that team won or not. Or if winning is a big part of what you're looking for, you can create an extra relation such as
(Team)-[:WON]->(Match) (though then you need to think about how to model draws. The absence of a WON relation on either of the two teams for a match could indicate a draw maybe).
1) All matches for a particular referee: Start at the referee, traverse through the Match to the Cities. You might index some unique property of the referee to be able to look him up quickly
2) All matches where the referee worked and the home team won: Start at the referee, find all his matches, filter on the WON relation/property and the home team property
3)All referees that have the highest count of wins for the home team: Same as above, start at all referees
4)Most active referees for a city: Start at the city, find all matches and their referees
You might move things around a bit depending on more questions that you want to answer (especially home team properties, WIN/LOSE relations or properties etc.)
And I don't think you need the root node at all. You can index all matches/cities/referees etc if you want to find all of them
I've done some modelling of football/soccer matches which might be interesting to look at - http://staging.thinkingingraphs.com/
Mostly the same as what Luanne said although I've got specific relationship types indicating which team played at home and away. I've been writing up what I discovered while building out the model here as well - http://www.markhneedham.com/blog/tag/neo4j/page/2/

Drupal, Ubercart: is there a way to select all Europeans / Not-Europeans countries in the shipping settings?

I usually create conditional rules with shipping to assign different costs for:
national shipping (a specific country is selected)
and international shipping (the same country is selected but a NOT is added to the condition)
I have now to assign different shipping costs according to Europe / Not Europe. A solution would be to select all countries in Europe, but I was wondering if there is a faster way
thanks
For the sanity of your users just do it the way everybody else does!
Have a country pull down with a list of all supported countries in it. Defaulting to you "home" nation.
If you are sending stuff there are a lot more considerations than just shipping costs, you may need to fill in specific tax forms for some countries and depending on what your site is selling you may need special processing for some countries (try sending coffee to Thailand -- you need to obtain permission from thier ministry of agriculture!).
Create the different shipping methods at admin/store/settings/quotes (one for Europe, one for non-Europe).
Add a Rule by editing the new shipping method and adding a condition
or go to the Rules config at admin/workflow/rules
Use a text comparison condition with a order:delivery-address:country data selector
In the value field place the regular expression to match any of the desired country names, for example the list of EU member states below.
Maybe it could be done with postal codes too, but I do not know how they are structured. Everyone keeps their sanity.
(\W|^)(Austria|Belgium|Bulgaria|Croatia|Cyprus|Czech|Republic|Denmark|Estonia|Finland|France|Germany|Greece|Hungary|Ireland|Italy|Latvia|Lithuania|Luxembourg|Malta|Netherlands|Poland|Portugal|Romania|Slovakia|Slovenia|Spain|Sweden|United\sKingdom)(\W|$)

Resources