Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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.

share|improve this answer
    
Sounds promising. Is this soloution also viable for a batch client, which hasn't the need to drill down because it wants to ask only one time with every facet. In example: City A has only one branch and the batch client asks, give me the branch for city A, district 5, street foostreet. Will it then receive the only existing branch or do the additional specific query facetes exclude the city only result? –  Turbokiwi Mar 19 '13 at 17:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.