what are best practices, to model and query spatial responsibilities of company local branches?
My company has many local branches which are all in general responsible for 1 city. This is the easiest case. However, there are some exceptional cases. Here’s a list of all possible cases:
- branch a is responsible for city a (general case)
- branch a is responsible for city a, b and c
- branch a is responsible for disctricts 1 and 2 of city a, whereas branch b is responsible for districts 3, 4 and 5 of city a
- branch a is responsible for city a and for Foostreet of district 2, whereas branch b is responsible for district 2 of city a
- branch a is responsible for city a and for odd housenumbers of Foostreet of district 2, whereas branch b is responsible for district 2 of city a
- branch a is responsible for city a for all customers whose surname begin with letters A-F, whereas branch b has G-K, and branch c has ….
- branch a is responsible for city a in case of handling Foos, whereas branch b is responsible for city a in case of handling Bars
These are the possible responsibility cases, which could of course also be mixed. The planned system should provide the answer to the question: “Which branch is responsible for city a (or b or c …)?”. If there are exceptional cases, then the question has to be more specific.
Is it possible to provide hints like: “City a has more than one branch, please chose a district!” or “For which case are you asking? Responsible branch for handling Foos, Bars, ….?”
The question which would most likely to be asked is: “Which branch is responsible for Foostreet 345 in 12345 Foocity?”
My requirements are Java Enterprise and a mySQL Database. It may be possible to use MongoDB or Neo4j if it really makes more sense.
I already have database with every city, district, zipcode and street, with which the data could be “connected”.
I hope this question doesn’t sound like: “Please do my job for me.”, but my experience in spatial domain modelling is almost zero.
Since all your criteria are not strictly geographic, I think what you’re looking for falls more closely under faceted search. Faceted search allows the user to “drill down” until they get the information they want, in this case the responsible branch. You see it most frequently on shopping sites. You do a general search, then a list of criteria, or “facets,” appears on the left side. The user then chooses a price range, or a review rating, or a brand name, etc. Searching for computers gives you a different list of facets than searching for clothing.
In your case the facets would be the city, the district, the street, odd or even house numbers, etc. You may not be able to use solr’s faceted search directly, but that should give you a good place to start.
1