SlideShare a Scribd company logo
Drools JBoss Rules 5 0 developer s guide develop
rules based business logic using the Drools
platform 1st Edition Michal Bali pdf download
https://ebookfinal.com/download/drools-jboss-rules-5-0-developer-
s-guide-develop-rules-based-business-logic-using-the-drools-
platform-1st-edition-michal-bali/
Explore and download more ebooks or textbooks
at ebookfinal.com
We have selected some products that you may be interested in
Click the link to download now or visit ebookfinal.com
for more options!.
Rebound Rules The Art of Success 2 0 1st Edition Rick
Pitino
https://ebookfinal.com/download/rebound-rules-the-art-of-
success-2-0-1st-edition-rick-pitino/
Type Rules The Designer s Guide to Professional Typography
2nd Edition Ilene Strizver
https://ebookfinal.com/download/type-rules-the-designer-s-guide-to-
professional-typography-2nd-edition-ilene-strizver/
Challenging The Rules s of Law Kalpana Kannabiran
https://ebookfinal.com/download/challenging-the-rules-s-of-law-
kalpana-kannabiran/
A Guide to the UNCITRAL Arbitration Rules 1st Edition
Clyde Croft
https://ebookfinal.com/download/a-guide-to-the-uncitral-arbitration-
rules-1st-edition-clyde-croft/
Who rules the earth how social rules shape our planet and
our lives 1st Edition Steinberg
https://ebookfinal.com/download/who-rules-the-earth-how-social-rules-
shape-our-planet-and-our-lives-1st-edition-steinberg/
Brain Rules John Medina
https://ebookfinal.com/download/brain-rules-john-medina/
JK Lasser s Small Business Taxes 2006 Your Complete Guide
to a Better Bottom Line J K Lasser s New Rules for Small
Business Taxes Barbara Weltman
https://ebookfinal.com/download/jk-lasser-s-small-business-
taxes-2006-your-complete-guide-to-a-better-bottom-line-j-k-lasser-s-
new-rules-for-small-business-taxes-barbara-weltman/
JK Lasser s Small Business Taxes 2007 Your Complete Guide
to a Better Bottom Line J K Lasser s New Rules for Small
Business Taxes Barbara Weltman
https://ebookfinal.com/download/jk-lasser-s-small-business-
taxes-2007-your-complete-guide-to-a-better-bottom-line-j-k-lasser-s-
new-rules-for-small-business-taxes-barbara-weltman/
Power Rules Leslie H. Gelb
https://ebookfinal.com/download/power-rules-leslie-h-gelb/
Drools JBoss Rules 5 0 developer s guide develop rules based business logic using the Drools platform 1st Edition Michal Bali
Drools JBoss Rules 5 0 developer s guide develop rules
based business logic using the Drools platform 1st Edition
Michal Bali Digital Instant Download
Author(s): Michal Bali; James Taylor; Sammy Larbi
ISBN(s): 9781847195654, 1847195652
Edition: 1
File Details: PDF, 2.27 MB
Year: 2009
Language: english
Drools JBoss Rules 5.0
Developer's Guide
Develop rules-based business logic using the
Drools platform
Michal Bali
BIRMINGHAM - MUMBAI
Drools JBoss Rules 5.0 Developer's Guide
Copyright © 2009 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of
the information presented. However, the information contained in this book is sold
without warranty, either express or implied. Neither the author, Packt Publishing,
nor its dealers or distributors will be held liable for any damages caused or alleged to
be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.
First published: July 2009
Production Reference: 1060709
Published by Packt Publishing Ltd.
32 Lincoln Road
Olton
Birmingham, B27 6PA, UK.
ISBN 978-1-847195-64-7
www.packtpub.com
Cover Image by Vinayak Chittar (vinayak.chittar@gmail.com)
Table of Contents
Preface 1
Chapter 1: Introduction 7
Problems with traditional approaches 7
The solution 9
Advantages 10
Disadvantages 12
When not to use a rule engine 13
Drools 13
Alternatives to Drools 15
Summary 15
Chapter 2: Basic Rules 17
Rule basics 17
Executing rules 19
Rule syntax 23
Rule concepts 23
Variables in rules 23
Types 24
Comments 24
Package 25
Imports 25
Global variables 25
Functions 26
Dialect 27
Rule condition 28
And 28
Or 29
Not 29
Exists 30
Eval 30
Return value restriction 30
Inline eval 30
Table of Contents
[ ii ]
This 32
Working with collections 32
Rule consequence 33
Rule attributes 34
salience (priority) 35
No-loop 35
Dialect 35
Summary 35
Chapter 3: Validation 37
Banking domain model 37
Problem definition 38
Analysis 39
Design 39
Validation package 41
Object required type rules 44
Testing 45
Minimal account balance rule 49
Student account rule 50
Unique account number rule 52
Implementation 53
Validation service 56
Summary 58
Chapter 4: Data Transformation 59
Process overview 59
Getting the data 60
Loading facts into the knowledge session 61
Writing transformation rules 63
Testing 64
Address normalization 67
Testing the findAddress rule 68
Unknown country 69
Currency conversion 70
One account allowed 72
Transformation results 74
Implementation of the data loading 76
Database setup 76
Project setup 77
iBatis configuration 78
Running iBatis 79
Alternative data loading 80
Summary 80
Table of Contents
[ iii ]
Chapter 5: Human-readable Rules 81
Domain Specific Language 81
DSL as an interface 84
DSL for validation rules 84
File formats 86
DSL file format 86
DRL file format 87
DSLR file format 88
DSL for multiple constraints in a condition 88
Named capture groups 89
DSL for data transformation rules 90
Decision tables 92
Advantages of a decision table 95
Disadvantages of a decision table 96
Calculating the interest rate 96
Project setup 98
Testing 98
Comma Separated values 100
Rule Templates 101
Drools Flow 101
Drools Agenda 101
Methods for managing rule execution order 102
Ruleflow 103
Start 104
End 104
Action 104
RuleFlowGroup 104
Split 105
Join 106
Example 106
Rules 107
KnowledgeBase setup 107
Tests 108
Summary 110
Chapter 6: Stateful Session 111
Introduction to stateful session 111
Validation using stateful session 112
Design overview 113
Stateful validation service 113
Integration testing 118
Logical assertions 121
Keeping the validation report up-to-date 123
Collect conditional element 124
Table of Contents
[ iv ]
Serialization 126
Knowledge session re-creation 126
Testing 128
Session serialization 129
Full session serialization 130
Summary 132
Chapter 7: Complex Event Processing 133
CEP and ESP 133
Drools Fusion 134
Fraud detection 134
Problem description 135
Design and modeling 135
Fraud detection rules 138
Notification 139
Monitoring—averageBalanceQuery 143
Two large withdrawals 144
Sequence of increasing withdrawals 148
High activity 158
Summary 160
Chapter 8: Drools Flow 161
Loan approval service 161
Model 162
Loan approval ruleflow 162
Invalid loan application form 163
Email work item 163
Fault node 165
The size of the loan 168
Test for a small loan 169
Rating Calculation 169
Subflow 170
Subflow diagram 170
Rating calculation subflow test 173
Decisions on rating 174
Testing the 'Rating?' node 175
Transfer Funds work item 175
Work item definition 177
Work item registration 178
Work item handler 178
Work item handler registration 180
Testing the transfer work item 180
Human task 181
Test for the human task 183
Final Approval 186
Test for the 'Approve Event' node 186
Table of Contents
[  ]
Banking service 187
Disadvantages of a ruleflow 188
Summary 188
Chapter 9: Sample Application 189
Users 189
Architecture 189
Technologies used 190
Additional Drools projects used 191
Libraries used 191
Business logic 191
Design 192
Configuration 192
JPA annotations for domain objects 193
JPA configuration 194
Spring Framework configuration 195
Web application setup 197
Tag library 199
Tomcat setup 199
Deployment 200
Repositories 200
Validation 201
Services 203
Transactions 204
Presentation layer 206
Localized messages 208
Customer save form controller 208
Complex Event Processing service 211
Loan approval 211
Loan request form 212
Process persistence 213
Task list 220
Working on a task 222
Loan approval event 225
Summary 227
Chapter 10: Testing 229
How to write unit tests for rules 229
Rule integration testing 230
Rule acceptance testing 230
Creating a test scenario 232
Running a test scenario 234
Running all test scenarios 235
Table of Contents
[ vi ]
Static analysis of rules 236
Troubleshooting techniques 237
Event listeners 238
Debugging 239
Source of generated classes 241
mvel tricks 241
Summary 242
Chapter 11: Integration 243
Dynamic KnowledgeBase loading 243
KnowledgeAgent 244
External artifact building 246
Building with Ant 246
Drools execution server 248
Interest rate calculation example 249
The server 249
The client 251
Spring Framework integration 252
KnowledgeBaseFactoryBean 253
Standards 255
JSR94 Java Rule Engine API 255
Summary 256
Chapter 12: Performance 257
Rete algorithm 257
Node types 259
Rete node 260
EntryPointNode 260
ObjectTypeNode 261
AlphaNode 261
LeftInputAdapterNode 261
TerminalNode 262
BetaNode 262
More complex example 264
EvalNode and FromNode 266
Retracting or modifying a fact 266
Initial fact 266
Node sharing 267
Example 268
Node indexing 269
AlphaNode indexing 269
Computation complexity 270
BetaNode indexing 271
Example 271
Table of Contents
[ vii ]
KnowledgeBase partitioning 273
Parallel execution 274
Summary 275
Appendix A: Development Environment Setup 277
Environment setup 277
Dependencies and their licenses 279
Appendix B: Custom Operator 281
Summary 287
Appendix C: Dependencies of Sample Application 289
Index 293
Preface
Business rules and processes can help your business by providing a level of agility
and flexibility. As a developer, you will be largely responsible for implementing
these business rules and processes effectively, but implementing them systematically
can often be difficult due to their complexity. Drools, or JBoss Rules, makes
the process of implementing these rules and processes quicker and handles the
complexity, making your life a lot easier!
This book guides you through various features of Drools, such as rules, ruleflows,
decision tables, complex event processing, Drools Rete implementation with various
optimizations, and others. It will help you to set up the Drools platform and start
creating your own business. It's easy to start developing with Drools if you follow
our real-world examples that are intended to make your life easier.
Starting with an introduction to the basic syntax that is essential for writing rules,
the book will guide you through validation and human-readable rules that define,
maintain, and support your business agility. As a developer, you will be expected
to represent policies, procedures, and constraints regarding how an enterprise
conducts its business; this book makes it easier by showing you the ways in which
it can be done.
A real-life example of a banking domain allows you to see how the internal workings
of the rules engine operate. A loan approval process example shows the use of the
Drools Flow module. Parts of a banking fraud detection system are implemented
with Drools Fusion module, which is the Complex Event Processing part of Drools.
This in turn, will help developers to work on preventing fraudulent users from
accessing systems in an illegal way.
Finally, more technical details are shown on the inner workings of Drools, the
implementation of the ReteOO algorithm, indexing, node sharing, and partitioning.
Preface
[  ]
What this book covers
Chapter 1: This chapter introduces the reader to the domain of business rules and
business processes. It talks about why the standard solutions fail at implementing
complex business logic. It shows a possible solution in the form of a declarative
programming model. The chapter talks about advantages and disadvantages of
Drools. A brief history of Drools is also mentioned.
Chapter 2: This chapter shows us the basics of working with the Drools rule
engine—Drools Expert. It starts with a simple example that is explained step-by-step.
It begins with the development environment setup, writing a simple rule, and then
executing it. The chapter goes through some necessary keywords and concepts that
are needed for more complex examples.
Chapter 3: This chapter introduces the reader to a banking domain that will
be the basis for examples later in this book. The chapter then goes through an
implementation of a decision service for validating this banking domain.
A reporting model is designed that holds reports generated by this service.
Chapter 4: This chapter shows how Drools can be used for carrying out complex data
transformation tasks. It starts with writing some rules to load the data, continues
with the implementation of various transformation rules, and finally puts together
the results of this transformation. The chapter shows how we can work with a
generic data structure such as a map in Drools.
Chapter 5: The focus of this chapter is on rules that are easy to read and change.
Starting with domain specific languages, the chapter shows how to create a data
transformation specific language. Next, it focuses on decision tables as another
more user-friendly way of representing business rules. An interest rate calculation
example is shown. Finally, the chapter introduces the reader to Drools Flow module
as a way of managing the rule execution order.
Chapter 6: This chapter talks about executing the validation decision service in a
stateful manner. The validation results are accumulated between service calls. This
shows another way of interacting with a rule engine. Logical assertions are used
to keep the report up-to-date. Various ways of serializing a stateful session
are discussed.
Chapter 7: This chapter talks about Drools Fusion—another cornerstone of the
Drools platform is about writing rules that react to various events. The power of
Drools Fusion is shown through a banking fraud detection system. The chapter
goes through various features such as events, type declarations, temporal operators,
sliding windows, and others.
Preface
[  ]
Chapter 8: This chapter goes into more detail about the workflow aspect of the Drools
platform. It is showed through a loan approval service that demonstrates the use of
various nodes in a flow. Among other things, the chapter talks about implementing
a custom work item, human task, or a sub-flow.
Chapter 9: The purpose of this chapter is to show you how to integrate Drools in a
real web application. We'll go through design and implementation of persistence,
business logic, and presentation layers. All of the examples written so far will be
integrated into this application.
Chapter 10: The focus of this chapter is to give you an idea about the various
ways of testing your business logic. Starting with unit testing, integration testing
through acceptance testing that will be shown with the help of the Business Rules
Management Server—Guvnor, this chapter provides useful advice on various
troubleshooting techniques.
Chapter 11: This chapter shows integration with the Spring Framework. It describes
how we can make changes to rules and processes while the application runs. It
shows how to use an external build tool such as Ant to compile rules and processes.
It talks about the rule execution server that allows us to execute rules remotely. It
briefly mentions support of various standards.
Chapter 12: This chapter goes under the hood of the Drools rule engine. By
understanding how the technology works, you'll be able to write more efficient rules
and processes. It talks about the ReteOO algorithm, node sharing, node indexing,
and rule partitioning for parallel execution.
Appendix A: It lists various steps required to get you up and running with Drools.
Appendix B: It shows an implementation of a custom operator that can be used to
simplify our rules.
Appendix C: It lists various dependencies used by the sample web application.
What you need for this book
In order to learn Drools and run the examples in this book, you'll need a computer
with any Operating System (Windows, Mac, or Linux), Java Development Kit (JDK)
version 1.5 or later, Drools binary distribution, some IDE—preferably Eclipse IDE
for Java EE developers, Drools plugin for Eclipse, and some third-party libraries that
will be specified per chapter. All of the mentioned software is freely available on the
Internet under a business friendly license.
You can download some additional support material from
http://code.google.com/p/droolsbook/.
Preface
[  ]
Who this book is for
The book is for Java developers who want to create rules-based business logic using
the Drools platform. Basic knowledge of Java is essential.
Readers are requested to note that they should follow the text
carefully. Some additions to the code are required in order to
run the examples successfully.
Conventions
In this book, you will find a number of styles of text that distinguish between
different kinds of information. Here are some examples of these styles, and an
explanation of their meaning.
Code words in text are shown as follows: Drools keywords are rule, when, then,
and end.
A block of code will be set as follows:
package droolsbook;
rule basic rule
when
Account( balance  100 ) // condition
then
System.out.println(Account balance is  +
less than 100); // consequence
end
New terms and important words are shown in bold. Words that you see on the
screen, in menus or dialog boxes for example, appear in our text like this: After it
finishes execution, Action is executed, the flow continues to another ruleflow group
called Group 2, and finally it finishes at an End node.
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Preface
[  ]
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or may have disliked. Reader feedback is important for us
to develop titles that you really get the most out of.
To send us general feedback, simply drop an email to feedback@packtpub.com, and
mention the book title in the subject of your message.
If there is a book that you need and would like to see us publish, please
send us a note in the SUGGEST A TITLE form on www.packtpub.com or
email suggest@packtpub.com.
If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide on www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to
help you to get the most from your purchase.
Downloading the example code for the book
Visit http://www.packtpub.com/files/code/5647_Code.zip to directly
download the example code.
The downloadable files contain instructions on how to use them.
Errata
Although we have taken every care to ensure the accuracy of our contents, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in text or
code—we would be grateful if you would report this to us. By doing so, you can save
other readers from frustration, and help us to improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/support, selecting your book, clicking on the let us know link, and entering
the details of your errata. Once your errata are verified, your submission will be
accepted and the errata added to any list of existing errata. Any existing errata
can be viewed by selecting your title from http://www.packtpub.com/support.
Preface
[  ]
Piracy
Piracy of copyright material on the Internet is an ongoing problem across all media.
At Packt, we take the protection of our copyright and licenses very seriously. If
you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or web site name immediately so that we can
pursue a remedy.
Please contact us at copyright@packtpub.com with a link to the suspected
pirated material.
We appreciate your help in protecting our authors, and our ability to bring you
valuable content.
Questions
You can contact us at questions@packtpub.com if you are having a problem with
any aspect of the book, and we will do our best to address it.
Introduction
The need to build more and more complex systems is increasing. We're trying
to automate all kinds of business processes and implement complex business
decisions. However, these processes and decisions are not very well represented
using traditional programming languages such as Java or C#. Instead, we should
use specialized technology such as the Drools platform.
In this chapter, we'll look at why there is a need for the Drools platform, what
advantages and disadvantages it brings, and when (not) to use it. We'll briefly look
at its history and what modules it consists of. We'll also see some commercial and
open source alternatives.
Problems with traditional approaches
Enterprise systems usually have multiple layers. From top to bottom they are:
presentation layer, business logic layer, and persistence layer. The middle
layer—business logic represents the core of the application where all of the
business processes and decisions take place.
The requirements for the business logic layer tend to change more often than the
requirements for the rest of the application. We might be lucky when we get a
complete specification, but that happens rarely. Even then, the requirements usually
evolve over time and are often re-worked. As this happens, a standard solution using
imperative style language (imperative programs are a sequence of commands for the
computer to perform; for example, languages such as Java and C#) would quickly
end up with so-called spaghetti code—lots of nested if-else statements.
Introduction
[  ]
It is often a good idea to document the following separately:
Business processes: Represent what the business does
Business rules: Represent decisions that the business does
Requirements: Represent how the system supports the business,
defines goals
These areas change at different schedules, have a different
degree of business user involvement, and none the less they
are implemented differently.
I am referring to these three areas simply as requirements.
•
•
•
There is no well defined way of representing the business logic in Java or C#. What
usually happens is that every application represents business logic differently.
For example, consider the following code that does some checking on customer level,
customer accounts, and account balance:
if (customer.getLevel() == Level.Gold) {
//do something for Gold customer
} else if (customer.getLevel() == Level.Silver) {
if (customer.getAccounts() == null) {
//do something else for Silver customer with no accounts
} else {
for (Account account : customer.getAccounts()) {
if (account.getBalance  0) {
//do something for Silver Customer that has
//account with negative balance
}
}
}
}
Code listing 1: Code written in standard Java (or any imperative style language).
Readers are requested to note that they should follow the
text carefully. Some additions to the code are required in
order to run the examples successfully.
First, the code checks if the customer is a Gold level customer and does something,
then it checks if the customer is a Silver level customer, and if so, it checks if this
customer has no accounts and does something in this case. If the customer has
accounts, the code performs some logic for each account that has negative balance.
Chapter 1
[  ]
The point of this Java 'spaghetti code' is to give you an idea what we are trying to
prevent. You may think that it doesn't look that bad. However, after a couple of
changes in requirements and developers that are maintaining the code, it can get much
worse. It is usually the case that if you fix one bug, you are more likely to introduce
five new bugs. A lot of requirements are literally packed into a few lines of code. This
code is hard to maintain or change in order to accommodate new requirements.
As more conditions are added, the performance of this system will degrade.
Moreover, when we want to change the behavior of the application, we'll have
to re-compile and re-deploy the whole application.
It is not only difficult to represent business logic in a imperative programming style
language, but also hard to differentiate between code that represents the business
logic and the infrastructure code that supports it.
For developers, it is hard to change the business logic. For domain experts, it is
impossible to verify the business logic and even harder to change it.
There is a need for a different paradigm for representing the business logic.
The solution
The problem is that with an imperative style language, we are implementing
both, what needs to be done (business requirements) and how it needs to be done
(algorithm). Let's look at declarative style programming, such as SQL, in relational
databases (other declarative style languages include, for example, Prolog or XSLT).
SQL describes what we want to search, it doesn't say anything about how the database
should find the data. This is exactly what we need for our business requirements.
A rule engine provides an alternative computational model. We declare rules in
pretty much the same way as the business analyst does the requirements—as a group
of if-then statements. The rule engine can then take these rules and execute them
over our data in the most efficient way. Rules, which have all of their conditions true,
have their then part evaluated. This is different from imperative style programming
languages where the developer has to specify how it needs to be done explicitly
(with a sequence of conditionals and loops).
If we rewrite the code from code listing 1 in a declarative manner, it might look like
the following:
if Customer( level == Level.Gold )
then do something else for Gold customer
if Customer( level == Level.Silver )
and no Account( )
Introduction
[ 10 ]
then do something for Silver customer who has no accounts
if Customer( level == Level.Silver)
and Account( balance  0, customer.accounts contains account )
then do something for Silver Customer that has account with negative
balance
Code listing 2: Rules from code listing 1 written using declarative style.
Each rule represents one requirement. This is more readable and maps to business
requirements more naturally.
Advantages
The following is a summary of various advantages of a declarative style solution that
Drools brings:
Easier to understand: Rules are easier to understand for a business analyst
or a new developer than a program written in Java or other imperative style
languages. It is more likely for a technically skilled business analyst to verify
or change rules than a Java program.
Improved maintainability: As rules are easier to understand, a developer
can spend more time solving the actual problem. We don't care about how
to implement a solution. We only care about what needs to be done to solve
a problem.
Deals with evolving complexity: It is much easier to add new rules, modify
or remove existing rules than to change, for example, a Java program. The
impact this has on other rules is minimal in comparison with an imperative
style implementation.
Flexibility: It deals with changes to the requirements or changes to the data
model in a much better way. Changing or rewriting an application is never
an easy task. However, thanks to formalism that rules bring, it is much easier
to change rules than to change a Java program.
Reasonable performance: Thanks to the Rete algorithm that is behind
Drools, in theory, the performance of the system doesn't depend on the
number of rules. Because a rule engine is essentially a generic if-then
statement executor, there are numerous performance optimizations that
can be applied independently of the rules. With every release of Drools, the
performance of the engine is getting better, by adding various optimizations
such as Rete node sharing, node indexing, parallel execution.
•
•
•
•
•
Chapter 1
[ 11 ]
Requirements can be naturally translated into rules: The representation of
business rules is consistent. For example, let's take some business rule and
implement it in Java. Developers, depending on their experience, tend to use
different ways to solve a problem. We'll find out that the possible solutions
will wary greatly. Whereas with rules, this diversification becomes less
apparent. It is simply because we are expressing 'what' instead of 'how'.
As a result, the code is much easier to read even by new developers.
Ability to apply enterprise management to our rules: This builds on the
previous advantage of consistent representation. If we have consistent
representation, it is much easier to introduce new features that apply across
all of our rules (for example, auditing, logging, reporting, or performance
optimizations).
Reusability: Rules are kept in one place (separation of business logic from
the rest of the system), which means easier reusability (for example, imagine
you've written some validation rules for your application and later on there
is a need to do some batch imports of data; you could simply reuse the
validation rules in you batch import application)
Rules model the application invariants more closely: Imperative style
solutions tend to impose arbitrary and often unnecessary ordering on
operations depending on the algorithm chosen. This then hides the original
invariants of the application.
The Drools platform brings unification of rules and processes: It is easy to
call rules from a process or vice-versa.
Independent Lifecycle: Rules and processes tend to change far more often
than anything else in the application. With Drools, the rules and processes
can be authored, deployed, versioned, managed, and so on, independently
from the rest of the application.
Embedability: Drools can be easily embedded into existing applications in
order to implement just a section of a system.
•
•
•
•
•
•
•
Discovering Diverse Content Through
Random Scribd Documents
had not been properly tested before being used again. Thus closed
the third chapter in a day which illustrated the truth of the proverb
that “misfortunes never come singly.”
The following day, Tuesday, showed no signs of improvement in
the weather. Thick mist on the tops, steady rain, and a wind, as
usual, in the wrong direction. Stuart was obliged to drive some miles
off to see a friend, but I determined once more to try the hill. This
time I was sent out on the home beat. I started off with the stalker
and an old gillie named Angus, who had had so much experience
that he would have made an admirable stalker, and who is always
very keen. I also had two ponies and a pony boy. The pony path
goes straight up the mountain-side for two and a half miles. By the
time we reached the point where the path stopped we were close to
the edge of the mist, and the outlook seemed hopeless. We decided
to cross over the opposite hill and go down on the other side, hoping
that by that time the mist might have lifted. We left instructions with
the pony boy to wait for two hours, and then if he heard nothing
from us to go back right round to a point on the other side of the hill
and wait there. On our way up the hill I found some beautiful little
bastard pimpernel in flower, not very common in this part of the
country. As we worked our way up the mountain-side the wind
became stronger and the rain heavier. It was intensely cold, and
very difficult to see what was in front of us. Having arrived at the
ridge, nearly 3000 feet up, we tried to spy the corrie below. What
with the tremendous wind and driving rain this was a matter of the
greatest difficulty, and in conditions of this kind I always think there
is a better chance of picking up deer with first-rate field-glasses than
with a telescope. I managed, with my field-glasses, to discover two
stags feeding in a sheltered part of the opposite side of the corrie,
and, after shifting our position in order to get a better view of them,
we found that there were some hinds feeding below them. We came
to the conclusion that the only chance of obtaining a shot at the
stags was by getting in between them and the hinds. After some
trouble we succeeded in doing this, but old Angus, who knew the
corrie well, said that the wind at this place was very uncertain, and
that it was a question whether the stags would not get our wind. He
had hardly uttered this warning before there was a fatal puff in the
wrong direction, and away went the stags long before we were near
them. We decided to go on and try the next corrie. It is difficult to
imagine a greater contrast than the comparative warmth and peace
which we were now enjoying as compared with the strife of the
elements outside the corrie. The rain, too, had stopped, and I said
to the stalker, “No wonder the deer came here; what a haven of
rest!”
THE FIVE SISTERS OF KINTAIL.
By Finlay Mackinnon.
We now worked our way across the ridge, and then spied the big
corrie below. We discovered two lots of stags. Those in the first lot
were moving on. The others were lying down in a place where they
could be stalked without much difficulty; we therefore crawled some
400 or 500 yards, and, creeping cautiously up to the top of a little
hill, saw the stags had got up and begun to feed. There was one
quite clean about 90 yards below us, and another also clean about
130 yards from where we were lying. I fired at the near stag, who
fell dead at once; I then covered the other stag and pulled the
second trigger—result a missfire. I hastily reloaded and fired, killing
the stag. We then went down to the stags which I had shot. The
first was a six-pointer, whose horns and teeth showed him to be an
old warrior. The second, a nine-pointer, was a younger beast, rather
heavier. Both stags were in good condition, and weighed 13 st. 9 lb.
and 14 st. 3 lb. clean. After gralloching the stags, we dragged them
down the hill to a point from which we could signal to the pony boy.
The ponies had long been used for carrying stags, and stood quietly
whilst the stags were put on them. We soon reached the pony path,
and after a walk of five miles reached the lodge.
The following day, Wednesday, it rained and blew all day, and the
mists hung low on the mountains, so that it was quite useless to
attempt any stalking.
The next day, Thursday, was the last day of my visit and that of
Stuart. Stuart was particularly anxious to kill one more stag in the
company of the second stalker, because he had killed his first stag in
his company sixteen years ago in this forest, and had since then
killed forty-eight stags in various forests. The day looked anything
but propitious; there was mist and rain, and the wind was again in
the wrong quarter. My host said he would go fishing up the glen;
Stuart was sent to try one of the far beats in the company of his old
friend the second stalker, whilst I was left to try the home beat
again. As we went up the hill the mist gradually lifted, and we saw
two huge golden eagles circling round and round. We saw no deer
up to two o’clock; but whilst taking lunch we suddenly saw several
stags coming round the side of a distant hill. We hastily finished our
lunch and set out on what proved to be a long and exciting stalk.
From time to time we had to remain lying perfectly flat, not daring to
move a muscle. Once we thought every chance of success was
gone, for an old cock-grouse rose with his “Go-back,” “Go-back,” as
we were nearing the rock from which we hoped to get a shot. The
sun, of which we had seen nothing for so long, kept coming out and
going in again. On a long stalk of this kind it is extraordinary what
one sees and how ineffaceable is the memory of these sights—the
eagle circling over the high tops not far distant; the blue hare
leisurely making off, then stopping, sitting up and looking back; the
ptarmigan, so beautiful in its mottled plumage, running in front of
us, stopping now and again and peering around; the old cock-grouse
rising with his warning described above, which too often brings the
stalk to an untimely end; the many insects, some of them so strange
and weird, that we see as we lie flat gazing into a clump of grass
and moss; the granite boulders sparkling in the sunlight as if
studded with many diamonds—most, if not all, of these things I saw
in this particular stalk. Everything, however, comes to an end, and so
at last I succeeded in getting a shot at the heaviest of the stags,
who was standing on the side of a very rocky and precipitous hill. He
ran a few yards and fell down dead. It was, indeed, fortunate that
he fell where he did, caught between two rocks, for immediately
below these rocks nothing could have stopped him from rolling down
a precipice of several hundred feet, and, as old Angus said, the
venison would not have been worth taking home and the horns
would have been smashed to atoms. The stag, an old one in good
condition, was dragged down to a place where the pony could come
up, and, leaving Angus to find and help the pony boy, the stalker
and I started to work our way homewards across the hill. We had
been moving slowly onwards, spying from time to time, when we
discovered a large number of stags feeding below us. A circuitous
stalk brought us up to them, but in a very awkward position. It was
impossible to get a shot, except by coming up to a point at the top
of the hill below which they were feeding, and we should then be
much too close to them. There was, however, no choice, and after a
cautious crawl we reached a point from which we could see the
horns of stags moving away from us, at a distance of not more than
30 yards. Crawling as flat as possible to the top of the little hill, the
stalker slowly raised his head, and as slowly lowered it. He then
whispered to me, “There’s a fine stag there, but he won’t wait long,
and you’d better shoot over my back.” I cautiously raised the rifle
over the stalker’s back in the direction indicated, and, slowly raising
my head, saw a fine stag, with a good head, standing broadside on,
about 70 yards away, looking straight at me. As quickly as possible I
covered the stag’s heart and pulled the trigger; there was the
unmistakable thud as the bullet struck the stag, who instantly turned
and disappeared. “He’ll be all right,” said the stalker; “you don’t
often hear a bullet strike more distinctly than that one did,” and on
reaching the point where the stag had been standing we saw him
about 80 yards below, lying dead. He turned out to be a royal, with
very regular points and a good head, although he was going back
and had evidently been better. Like two of the four stags I had
previously shot, he was an ancient warrior. The mist, which had
temporarily lifted, now came down again thicker than ever, and the
stalker said that we should have an awful job to get the stag down,
as it was a heavy one, and the ground was very awkward. We
gralloched the stag, and took out the heart and liver in order to
make him as light as possible, and then set to work to get the stag
down. This was a very heavy job, and I could not help thinking, as I
had often thought before, what an excellent thing it would be if
every one who is going to stalk, whether proprietor, tenant, or guest,
were obliged some time or other to take part in dragging a stag to
the place where he is to be put on the pony, and help in putting him
on the pony. We succeeded at last in getting the stag down, and the
stalker then arranged to wait on the pony path lower down, in order
to meet old Angus and the pony boy, who would be bringing the first
stag I had shot and the ponies. I took my rifle, the luncheon bag,
and the sticks and glasses, and struck across the hill for the lodge.
On my way down I began to speculate as to the age of the two old
stags I had shot that day, and came to the conclusion that they were
probably not less than fourteen or fifteen years old. The old Gaelic
saying, which shows how little was formerly known as to the age of
a stag, came into my mind:
Tri aois coin, aois eich;
Tri aois eich, aois duine;
Tri aois duine, aois feidh;
Tri aois feidh, aois firein;
Tri aois firein, aois dbaraich,
which may be translated:
Thrice dog’s age, age of horse;
Thrice horse’s age, age of man;
Thrice man’s age, age of deer;
Thrice deer’s age, age of eagle;
Thrice eagle’s age, age of oak.
It is probably true to say that a stag in its wild state rarely lives
beyond sixteen or seventeen years of age. In those forests which are
on islands, for example Jura, stalkers have unusual opportunities of
observing and learning the history of particular stags, and I recollect
when stalking in North Jura two years ago discussing this subject
with John Mackay, the head stalker. He told me that he had several
times been familiar with a stag all through its life, and in more than
one instance had seen a stag with a fine head gradually lose its
points, until at last it had only comparatively short upright narrow
horns with two, short brow points, the stag itself losing steadily both
in size and weight and becoming very light in colour.
OLD ANGUS NEARING HOME.
By V. R. Balfour-Browne.
I reached the lodge about 6.30. The stags weighed very nearly
the same weight—16 st. 2 lb. and 16 st. 5 lb. clean—the royal being
slightly heavier than the other. Our host returned about eight
o’clock, having waited an hour past the time at which he had
arranged to meet Stuart. The car was sent back for Stuart, who,
however, did not reach the lodge until half-past ten, after a very long
and strenuous day. He had, however, secured his fiftieth stag after a
most troublesome stalk. He was not able to get his shot till past
seven o’clock, at which time he was about seven miles from the
lodge. So ended a most delightful week’s sport, notwithstanding the
awful weather which we had had.
Drools JBoss Rules 5 0 developer s guide develop rules based business logic using the Drools platform 1st Edition Michal Bali
IX
A SALMON LOCH IN SUTHERLAND
Fishermen’s stories are said to be proverbially untrustworthy, and the
great majority of people—at any rate of those who are not
themselves fishermen—never seem to suppose that in the case of a
fisherman, as in the case of every one else, truth may sometimes be
stranger than fiction.
I have been a fly-fisher since my earliest days, and have had
many good days both with the salmon and the trout, but I have
never had a day full of such surprising contrasts as the day which I
had with a brother of mine many years ago in the early part of
September, on a loch through which flows one of the best of the
smaller salmon rivers in the North of Scotland. Strange as were the
events of that day, I can vouch for the absolute veracity of the
following story.
The loch in question is not very large, and is not deep in any part.
It contains a good many trout about three to the pound, and at
certain periods of the year many salmon. We had a long drive from
X., where we were staying, and reached the loch about 10 a.m. We
had with us a gillie, a salmon-fisher of long experience and a typical
Highlander, in height about 6 ft. 3 in., whose name, like his hair, was
Sandy. We had not expected to have any salmon-fishing while we
were at X., but fortunately I happened to have with me my salmon
rod as well as a trout rod, and we arranged on this day that we
would fish with the two rods alternately, and that as soon as one of
us caught a salmon the other would take the salmon rod.
When we arrived at the loch there was a good breeze blowing
from the west, with no sun. We put a medium-sized “Jock Scott” on
the salmon cast, while on the trout cast we put, as a tail fly, a queer,
nondescript fly, which Sandy fancied, and, as a bob fly, a “March
Brown.” These two latter flies were the ordinary medium-sized loch-
trout flies, and we thought it wiser, as we knew that there were a lot
of salmon in the loch, to put only two flies on the trout cast. My
brother began fishing with the salmon rod in the stern of the boat,
while I tried in the bow for trout. I very soon rose three or four
trout, and managed to secure two, but my brother had no luck with
the salmon. We had not been fishing for more than half an hour
when the wind went down and the sun came out. The surface of the
loch became absolutely calm, just like a sheet of glass, and fishing
appeared to be hopeless. The salmon now began to jump in
different parts of the loch, and, although Sandy said it was perfectly
useless, we kept trying to cast over them. At length, however, we
gave it up, and sat waiting for the breeze. Suddenly a salmon rose
about twenty yards from the boat. I said, “Come on, Sandy, put me
over that,” and, taking up the salmon rod, proceeded to cast over
the place where the salmon had risen. With great difficulty I got the
line out, as it was dead calm. I cast once, twice, and for a third time,
and just as I was getting to the end of my cast on the third attempt,
up came the salmon, rising apparently not with the intention of
taking the fly, but with the intention of drowning it. I struck at him
and hooked him, as we discovered later, by the tail, and a very lively
time he gave me. He played for about twenty-five minutes, during
which time he never showed himself, and we all thought he was
much larger than he turned out to be. He was a nice clean fish
about 9¼ lb. By the time we got him in the wind had risen, and we
began to fish again, my brother taking the salmon rod, whilst I
fished with the trout rod from the bow. I had not been fishing for
more than a few minutes before I rose something which did not
show itself. I struck, and exclaimed, “I’ve hooked him!” Away went
the line off my reel for about thirty yards, and at the end of this run
the fish, a salmon which looked considerably larger than the one we
had already caught, jumped right out of the water, high into the air.
Then began the longest and most exciting struggle I have ever had
with any fish. The rod with which I was fishing was a light 11-feet
trout rod; the cast was a medium-sized trout cast, and I had on my
reel about forty to fifty yards of medium-sized trout-line. There is no
doubt that I should have several times lost the fish had it not been
for the extraordinary skill and speed with which Sandy followed him
and managed the boat. Three times nearly all my line was taken out,
and once I had only a few inches left on my reel. After his first rush
the fish plunged deep down, and for a time adopted boring tactics. I
was able to recover most of the line he had taken out, and then he
made another run and a jump, and for some time after that we
followed him over the loch. On two occasions he made the most
determined efforts to get into some weeds, and it was only by
keeping a very severe strain upon him that I managed to keep clear
of them. I never played a fish which jumped so many times or
sulked less. On one occasion, after taking a large amount of my line,
he suddenly turned and headed straight back again for the boat, and
although Sandy did all he could to keep out of his way, the fish
startled us at the end of his mad run by jumping suddenly clean out
of the water within three or four yards of the boat, and falling with a
tremendous splash.
Do what I could I did not seem to have any real effect on the fish,
who seemed to do almost exactly as he liked with me, except on the
two occasions when he tried to get into the weeds, when, expecting
every minute that we might part company, I was determined,
whatever happened, that he should come where I wished him to
come.
We saw that the fish had taken the bob fly, and this added to my
apprehensions, as I was afraid, particularly as I knew the loch was
not deep, that the tail fly would catch in something at the bottom of
the loch, and there would then be a catastrophe. Time wore on, and
my back and arms began to ache most prodigiously. Still the fish
seemed as strong as ever. My brother said he must have some
lunch, and whenever Sandy and I got the chance we managed to
eat some sandwiches. I began to wonder how much longer the fly
would hold, and whether this fish would prove to be one more of the
many good fish lost through the fly working out at the end of a long
fight.
I could do nothing except hold on for all I was worth, keeping as
tight a line as I could, and, of course, lowering the point of the rod
whenever the fish jumped, as he frequently did. As time went on,
however, the rushes made by the fish were not so long, and he
seemed, at last, to have abandoned his leaping tactics, which had
given me so much anxiety in the earlier stages of the struggle. The
fish was gradually becoming exhausted, and the strain on the rod
and line seemed to be much greater. “He’ll be turning soon, I’m
thinking,” said Sandy. The end, one way or the other, could surely
not be far off now, and we discussed the question whether or not
we should try to land, but, on the whole, we thought we had better
not run the risk of getting into very shallow water. At last the fish
turned on his side, though he quickly righted himself and made
another short run. Sandy had got the boat in about three feet of
water, a few yards from the bank; he handed the oars to my brother,
seized the gaff, and got out of the boat. I slowly reeled in my line;
there was another short rush from the fish, and again I reeled him
up. Nearer and nearer he came to the boat, and again turned on his
side. Suddenly, in less time than it takes to tell, Sandy had the gaff
into him, and was struggling to the shore. Safely landed, the fish
was speedily given his coup de grâce. He was a very red male fish,
weighing rather over 10¼ lb., and I had hooked him in the hard part
of his upper jaw, which accounted partly for the fact that I had so
little power over him, and also for the fact that the hook had kept its
hold so well. “Now then, Sandy,” I said, as I got out my flask, “if any
man ever deserved a drop of good whisky, you do.” “Shlàinte”
(Gaelic for “Your good health”), said Sandy. “It was a grand fight,
sir; I’ve never seen a better.” “How long do you think you were
playing him?” said my brother. “Somewhere about an hour, I should
think,” I replied. “Four hours and six minutes,” he said. “I looked at
my watch when you hooked him, and it was then just a minute or
two before half-past one; and I looked at my watch when Sandy
gaffed him—it was then twenty-five minutes to six. I counted the
number of times the fish jumped, and it was seventeen. I don’t
suppose you noticed it,” he added, “but there was a cart going off
with peats, near the loch, soon after you began to play the fish, and
it came back again not long ago.” We heard afterwards that the men
in the cart thought I was playing another fish when they passed us
on their return journey.
The light was going as we pushed the boat out again. I handed
the salmon rod to my brother, and he began to fish from the stern of
the boat, while I fished again from the bow with the trout rod.
Sandy allowed the boat to drift slowly along the edge of some
weeds. I do not think that I had more than three or four casts when,
just as I was nearing the end of my cast, a salmon, which looked as
bright as silver, and about the same size as the one we had just
killed, rose at my tail fly, with a head and tail rise as if it meant
business; and, as it turned to go down, I felt the hook go home. The
fish did not run, but worked about near the surface of the water,
close to the weeds, as if it did not realise that it was hooked at all.
“Back the boat quickly, sir,” said Sandy, handing the oars to my
brother, and seizing the gaff. My brother took the oars and backed
the boat quickly in the direction of the fish. I reeled up my line;
there was a momentary vision of about three-quarters of Sandy
leaning out of the boat, a tremendously quick lightning-like
movement of the gaff, and the salmon, gaffed with extraordinary
skill behind the shoulder, was in the boat.
I do not think that more than four minutes could possibly have
elapsed from the time that I hooked the fish to the time it was in the
boat. It was a beautiful, clean-run female fish, with a small head,
and in perfect condition. It was very lightly hooked, and if it had run
or jumped at all it would almost certainly have got off. It weighed
within a few ounces of the weight of the fish which had given me
such a tremendous battle, and yet, owing to the extraordinary skill
of Sandy with the gaff, and the speed with which my brother had
acted, this fish occupied us only as many minutes as the other one
had hours!
We continued to fish for a short time, but it became dark so
rapidly that very soon we had to stop, and without a further rise of
any kind.
X
THE HOMING INSTINCTS OF
WOUNDED DEER
In these days one hears so much of the homing instincts of animals
and birds that the two following authentic instances of deer, whose
habits are not so generally known as those of some other animals,
may be of interest.
Stalkers, and those who know the habits of the red-deer, know
well that a stag when wounded will seek what he knows from
experience to be a haven of safety. Thus, if he has come in the
rutting season from his native forest and is wounded on other
ground, he will assuredly make for the sanctuary in that forest. So,
too, if he has been born and reared in a particular part of the forest
and has come to regard that place as his home, he will struggle to
reach it if wounded. One interesting illustration of this has come
within my own experience, and another was related to me by the
stalker who was with me on the occasion referred to.
I was stalking in a forest upon part of which unusual conditions
prevailed. That part which was nearest to the lodge was enclosed by
a deer fence, but, owing to careful management, and the
introduction from time to time of fresh stock, there are some very
good heads in this part of the forest. I always prefer, however, when
I have the chance, to stalk on the open ground outside the fence,
although it means harder work, as it is the far beat and part of it is
on very high and precipitous ground. It has, however, this great
fascination—that one never knows what sort of stag one may find
there. The forest itself is an exceptionally good one, and marches
with several of the finest forests in the Highlands.
THE SANCTUARY, KINLOCHEWE
FOREST.
By Finlay Mackinnon.
On the day in question I was on the far beat and secured a good
stag after an exciting stalk. After seeing the stag safely put on the
pony in charge of the gillie, the stalker and I set off towards the
farther end of the beat in the hope of getting a second stag. Not far
from the march, on precipitous ground covered with rough boulders
of rock, we spied a good stag with a large number of hinds. The
deer were in an awkward position, and we found that it was
impossible to get nearer to them than about 200 yards. The day was
getting late, therefore this was probably our only chance. The stag
was moving about and might very soon be over the march, so that
there was no time to be lost. Getting quickly into the best position I
could, I fired, and evidently hit the stag very hard. Directly I fired
the deer disappeared as if by magic. The stalker said he was quite
certain the stag could not go far. On reaching the spot on which the
stag had been standing when I fired we found marks of blood, and
had no difficulty in following these for some 50 yards, by which time
we were close to the march, and in full view of a large corrie and
other ground, all of which was in the neighbouring forest. We saw
what were evidently some of the hinds making off across the march,
but the stag and the rest of the hinds were nowhere to be seen. We
moved a little farther on where we could get a view of other ground,
when suddenly there was a tremendous clatter of loose stones, and
we saw the stag and some twenty hinds about 120 yards from us.
The deer stopped for a few seconds, the stag looking straight at us,
and then away they went. We ran quickly to the point where they
had disappeared, and saw the hinds we had last seen with the stag
going in the direction which the other hinds had previously taken,
but the stag was not with them. “He cannot go far,” said the stalker.
The ground was very much broken up by large stones and boulders,
and we both thought that the stag must be lying hidden not far from
us. We were quite certain from the position we were in that we
could not have failed to see him unless he had turned back below
the hill and gone into the forest from which we had come. We
noticed the hinds stopping every now and then and looking back, as
they so often do when one of their number has been wounded and
is behind them. By following the marks of blood on the stones we
traced the course the stag had taken for about 200 yards, but after
that we lost the tracks. We made the most careful search, and the
stalker went some distance into the adjoining forest, but all in vain.
The light was beginning to go, and at last we decided to give up the
search, for that day at any rate. The stalker, who had had his glass
on the stag when I had fired at him, said he was quite sure from
what he saw then and from the way that the stag was bleeding that
he had been mortally wounded and could not live long. I felt very
much depressed, for if there is one thing that distresses me more
than another it is to leave a wounded stag on the ground; and
though I thought that the stalker with his experience was right in
thinking that the stag could not live long, particularly as I knew my
rifle and felt sure that I must have hit the stag somewhere not far
from the heart, the fact remained that one could not be quite sure
what had really happened. This was the last day of the season, and
I was leaving on the following morning. The stalker promised me
that he would search the ground on the following day, and that he
would also tell the stalkers in the neighbouring forest, and that if he
heard anything of the stag he would let me know. “I shall certainly
know the head if it is ever found,” he said, “for when the stag looked
straight at me I could see the space between his forks at the top. It
was a ten-pointer, I think; the points were very regular, but as far as
the head goes it is not much to grieve over, for it was on the narrow
side.” “Still, it is a bad business,” I replied. “If we only had had a
tracker we should certainly have got him without any trouble.” A
really reliable tracker is indeed invaluable on an occasion of this
kind, but it is only in a few forests that dogs are now used in
following wounded stags. The noble deer-hounds which were the
trusty allies of our fathers on the hill have during the last forty or
fifty years been replaced in those forests where dogs are still used
by the golden retriever, or more often by the collie, the two dogs last
mentioned having been found more suitable for pursuing wounded
deer. The deer-hound was so high-couraged that he would not bay
the stag, but would pull him down or be killed by him. A further
objection was that he would hunt by sight rather than by scent, it
not being in his nature to put his nose to the ground, and it was
therefore practically impossible to train him as a tracker.
“THE TRUSTY ALLIES OF OUR FATHERS ON THE HILL.”
From the Picture “After a Hard Day” by Philip Stretton.
By permission of Messrs. Landeker  Brown, Ltd. London, E.C.2, Publishers
of the large engraving.
I heard no more of the wounded stag until the following season,
when I once more found myself in the same forest. I asked the
stalker whether he had any news of the stag. He said: “That is a
question. The stalkers in the other forest never found any stag, but
a very curious thing has happened. About 20 yards inside the fence,
at the nearest point in that part of the forest which is fenced in from
where you shot the stag, that would be about a distance of three
miles, the skeleton of a stag was found last April. The head stalker
on that part of the forest tells me he is quite sure it was not a stag
that was shot inside the fence. I have got the head here, and will
show it to you.” I examined it carefully. It was a good regular head
of ten points, with remarkably long forks at the top, and I thought it
looked a better head than that of the stag I had shot, and said so to
the stalker. He replied: “It is the same shape, and I well remember
noticing the space between the forks at the top. Not only that, but in
April when we found him there were no stags on that part of the
ground and had not been for some time; also by the bleached
condition of the horns, I am quite sure he must have died in October
or early in November, and he could not have died a natural death
after the winter was over. And as to his getting through the fence, at
that season of the year stags have a wonderful way of getting
through a fence if they want to do so. If he was mortally wounded
after he got outside he would be sure to go back to the place where
he was born and knew he was safe, and depend upon it he would
find his way back through the fence where he got out. One can
never be sure, but on the whole I think he is the stag you shot. You
see the only way he could have gone that day without our seeing
him was out of sight round that hill in the direction of the fenced-in
part of the forest. I am sure he was mortally wounded, he had seen
us; and after seeing us, being wounded, he would go straight on, as
you know, so long as his strength would carry him and he would go
straight to his old home. They’re wonderful in that way, deer are: I
shall never forget how I was taught that years ago when I was out
with the young chief at X.”
I asked the stalker to tell me the story, which I give in his own
words: “About twelve years ago, when I was a gillie at X, I was out
one day with the chief’s son late on in the season, about the end of
the first week in October. About 2 o’clock in the afternoon we saw a
Royal stag and some hinds above the black shed, between the lodge
and the second stalker’s house, and after a successful stalk, he fired
but wounded the stag, just grazing him in the lower part of the
body. The stag did not give the rifle another chance, but turned his
head fair south, towards the top of the C——. We watched him
crossing the top, then we made for where we saw him crossing, and
we saw him about 300 yards away as he was going down the
opposite side, and he was still going south, then getting out of view,
into a hollow. The stalker did not lose his chance, but made a sprint
to get up to him, which he managed to do, but the wily fellow was
always keeping his back to his enemy, and making fast for some
private corner, where he hoped he would be safe. The trigger was
not pulled for him. Being in plain ground there, and the Royal stag
fast on the move, we could do nothing but wait and watch where he
would cross the next ridge, which was fully a mile away. Once the
stalker saw him cross, we made at once for the spot he went out of
our view, getting there as soon as our legs could carry us, and after
spying that part of the ground very carefully, we failed to pick him
up. That was in the centre of the Glashan, a piece of ground about
1½ miles square, very level, with shallow peat bags, and guarded on
three sides with slightly rising ridges. The distance between where
the stag was wounded and where we lost him was about seven
miles. By this time the light was failing, so we had to make tracks for
home. One evening, a few days later, when it was beginning to get
dark, the head stalker was out about the larder, and noticing a stag
with some hinds above the lodge, and putting his glass on him, at
once knew the stag he had the run after a few days before. I was
just after getting home from the hill, and he ordered me to go and
shoot him. The rifle I never fired before, and the sight although
marked for 100 yards I afterwards found to be a 70 yards sight. I
got to about 100 yards from the stag, but having the evening light,
and being among juniper bushes, I had to shoot off my hand, and
missed him. There was no other chance that evening, as the light
was getting bad. Two or three days after, about 10 o’clock in the
morning, I was going along to the E—— Bothy, about a mile from
the lodge, when I saw about twenty hinds and a stag amongst
them, and after putting the glass on him, I knew it was the same
stag. I at once went back to tell the head stalker, but finding him not
at home, I took the rifle. I got to about 120 yards of the stag, but
shooting too low, I grazed his foreleg below the heart; he did not
give me another chance then, but left the hinds and turned to the
south across the top. When I got to the top I noticed him about half
a mile from me; keeping him in view he went for about two miles
south, then turning south-west I kept him in view for three miles,
then lost sight of him, but I could understand by the movements of
some hinds the line he was taking. I made for the place where I lost
sight of him, but having got there I could see nothing. I followed up
the burn that rises at Cairn-an-S——, and after getting half-way up
the burn, I came out to the open to spy. I was spying for some time,
and was putting my glass in its case when I noticed a black object
about half a mile away, about the size of a blackcock. I used my
glass, and who was this but the Royal lying in the centre of the
Glashan, on quite level ground. He was lying down licking the
scratch where I wounded him earlier in the day. With great difficulty
and after a long crawl I got to about 70 yards of him, and shot him
through the neck. That was a lucky range, as the rifle was sighted
for 70 yards. I was in an awful mess through crawling in burns and
gutters after him, but I was very keen on getting him, and as an old
chap once said to me, ‘When you have a difficult thing to do you
must not be minding your clothes.’ Well, I was pleased I got him as I
was sure he could not live very long. I considered what to do; my
first idea was to put him in some safe place, and come for him next
day, so I took him to a burnside into a hollow and hid him, but
before doing so I put a small chack with my knife above his brow
antler, to know him if ever I saw him again, as I did not know who
might be looking at me. I was in doubt whether I would take his
head off or leave it there all night. I at once changed my mind, as it
was so good a head I did not like leaving him out there all night. I
cut his head off, giving him a long neck for being stuffed. That
finished, I shouldered the Royal head, took him back five miles to
the E—— Bothy, left him there that night, and took it two miles
further to the lodge the next day, and to-day it hangs in the chief’s
mansion. The young chief was very glad to get it. The head was a
very good Royal, thick horns, points equal and well-shaped. The
distance between the place where I shot him through the neck and
the place we lost him the day the young chief wounded him is hardly
half a mile apart. That day the stag was first wounded, he went
whatever a distance of six or seven miles to that quiet spot in the
centre of the Glashan. The day I shot him through the neck I
followed him for about eight miles from the place where I grazed his
foreleg below the heart. He never saw me, he never stopped, always
making for that private spot, the place in the centre of the Glashan.
So this stag went two times to that same place, as he hoped he
would be safe there, and possibly that stag might have been lying in
the same bed both nights.” This shows the distance a stag will go for
safety, and that he goes back to his old home, the spot where he
thinks he is safe. And so I believe that my friend the stalker must
have been right in thinking that the stag he had found in April was
the stag I had shot in the early days of the preceding October.
“I WAS SPYING FOR SOME TIME.”
From a Photograph by the Author.
XI
THE METHOD BY WHICH EAGLES AND
HAWKS SECURE THEIR PREY
As is well known, the eagle lives largely on carrion such as dead deer
and carcases of sheep, differing in this respect from the peregrine
falcon, which lives exclusively on what it kills. Generally speaking,
the eagle secures its prey by pouncing on it on the ground and
carrying it away in its talons. He swoops down at a great pace in a
slanting direction, and in this way not only captures hares and
rabbits, but also grouse and ptarmigan on the ground and young
ducks on the loch. It is very interesting to watch the great bird
searching slowly along the side of a hill, about 50, 100, or 150 yards
above the ground; then he suddenly pounces, and in a moment is
up again and away with his prey in his talons. So regularly does the
eagle adopt this method of capturing his prey on the ground, that I
have met stalkers who have told me that they do not believe that an
eagle can overtake any swift-winged bird such as grouse or black
game. This is certainly wrong, for the eagle does sometimes, though
comparatively rarely, adopt the other method of securing his prey—
the method which I have already described (see p. 64, supra)—that
of pursuing and catching his prey in the air, and in this way without
doubt captures blackcock, grouse, and ptarmigan. I have already
stated (see pp. 57-70, supra) that in my opinion the eagle in his
downward flight is faster than the peregrine. Even in his horizontal
flight, once he gets going he can fly very fast if he chooses, but of
course is not nearly so agile and cannot turn and twist with the
rapidity of the peregrine, and the result is that when he overtakes
his quarry he frequently misses him.
Nearly a hundred years ago one of the most acute observers
amongst ornithologists wrote as follows: “In another part of the
Western Highlands of Scotland we had an opportunity of witnessing
the powers of flight of this bird in pursuit of its quarry. An old
blackcock was sprung and was instantly pursued by the eagle (who
must have been on a neighbouring rock unperceived) across the
glen, the breadth of which was at least 2 miles.
“The eagle made several unsuccessful pounces, but as there was
no cover and the bird large, it probably fell a victim in the end.”[28]
Lastly, as I have already said in the pages just mentioned where I
have fully discussed the matter, the eagle on rare occasions swoops
down at a terrific pace on his prey in the air, striking it to the ground
but not clutching it or, to use the falconer’s phrase, binding on it.
The eagle has a great partiality for hares, cats, young fox cubs,
and young lambs. I remember James Macintosh, head stalker at
Loch Rosque, telling me that on two occasions whilst waiting at a fox
den he had shot an eagle. He added that, whilst the old foxes are
away, the cubs, when they get hungry, sometimes make such a
noise that they can be heard at a considerable distance, and that he
believed this attracts the eagles, particularly if their eyrie in which
they are rearing their young happens to be in the vicinity. He went
on to say that he thought this accounted for his sometimes finding
fox dens containing only one or two cubs instead of the usual
number of three to seven. There is no doubt that eagles sometimes
attack deer calves, fixing their talons in their victim’s neck or back
and striking the calf with their wings. They frequently hunt in pairs,
and have been seen to drive the calf over a precipice.
On rare occasions eagles have been known to attack a full-grown
stag. In certain parts of the Highlands they have lately increased in
numbers, and perhaps as a consequence, their ordinary food not
being so plentiful, have become bolder.
Only last year I was stalking in a forest where a few days earlier a
stalker had witnessed a most unusual incident. The following is his
account of what he saw:
“A gentleman and I were out stalking on the 25th of September,
and while the gentleman was having lunch, I went off about 200
yards to have a spy. I got a stag lying at the foot of a rock. While I
had the glass on him, an eagle suddenly swooped down and
attacked him. The stag went headlong into a bog, but managed to
get up. I then ran back for the gentleman thinking we would have a
shot, but by the time we got back the stag and eagle were over the
sky-line and the eagle still following while going over the sky-line,
but after that we don’t know what happened, as both eagle and stag
went out of sight.”
Donald Matheson, who has had a lifelong experience in the forest
and has only recently retired after having been for many years
stalker at Glen Shieldaig to Mr. C. J. Murray of Loch Carron, told me
that on one occasion, but on one occasion only, he saw an eagle
attack an adult stag.
“It would be, as far as I remember,” he said, “between the 6th and
10th of October in the year 1888 when I was spying one morning at
the forest stables. I picked up a stag on the top of Glen Shieldaig,
quietly feeding on the Glaschnoc side, and while having my glass still
on the stag an eagle swooped down on his head. The stag fell on his
hind-quarters, but was soon on his feet again and ran for his life
while the eagle was fixed on him. The stag made for a thick clump
of birch-trees, and immediately the stag got under cover the eagle
could not keep its hold, owing to the thick branches of the trees, and
left the stag. The eagle kept hovering for some time above the wood
where the stag was concealed, but at last flew away.”
Whilst stalking in the neighbouring forest of Applecross two years
ago, Colonel the Hon. Claude Willoughby had a most interesting
experience, a description of which he has kindly given me
permission to reproduce here:
“On 30th September, 1921,” he writes, “I was stalking with Alick
Mackenzie on Applecross. We had come through Corrie Chaorachan
into Corrie Na Na and spied a stag with hinds on the west face
above the loch. The wind was west, and after a difficult and
exceedingly good stalk across the Corrie and above these deer,
avoiding hinds, also another stag with hinds, we arrived at a point
within 150 yards of the stag we were after and found him lying
down. Owing to the light and the distance, I determined to wait for
him to rise before shooting. After waiting half an hour, hinds which
we had seen beyond the place where he was lying came galloping
past him. He rose and I shot him; he fell dead. We at once saw that
the reason of these hinds galloping was that an eagle was after a
calf which had separated from the herd. We saw the eagle land on
the calf’s back twice, but the calf escaped.
“The eagle then attacked a hind in the herd. A kestrel hawk now
joined in, and mobbed the eagle. This attack lasted only a short
time. The eagle then circled round my dead stag, the kestrel soon
after disappearing. The eagle settled on a rock about five yards from
the dead stag, and remained there until we showed ourselves. All
this took place within 200 yards of us.
“On the Tuesday following Lord Derwent was also stalking on
Applecross, near Corrie Attadale. He and the head stalker Finlayson
saw an eagle attack a calf, which it knocked down twice, but the calf
escaped.”
THE APPLECROSS HILLS, AND A HIGHLAND FISHING VILLAGE.
By Finlay Mackinnon.
There has been much difference of opinion, and from time to time
considerable controversy as to how the peregrine kills its prey. Some
stalkers and ornithologists believe that it is done with the edge of
the wing, a smaller number with the beak, whilst others think it is
done with the talons. The last-mentioned view is that which is, I
believe, universally held by falconers, who after all have many more
opportunities of seeing how it is done than any other class of men. I
have frequently discussed this question with naturalists and stalkers,
keepers and others interested in this subject, and have listened to all
they could tell me. I have also had the great advantage of hearing at
first hand from falconers of experience their views and their reasons
for them. Further, I have myself been so fortunate as to see the wild
peregrine pursue and stoop at its quarry. I have seen it strike and
kill it and on occasion miss it. In addition to this, I have read
everything I could find on this subject, both in the older and more
modern books of authority. I am satisfied myself that the view held
by the falconers is the true one, and I cannot state their conclusions
better than, or indeed so well as, by quoting from three letters that I
have received. The writers of these three letters have kindly given
me permission to quote their Views.
Major C. E. Radclyffe, who has had almost unrivalled experience
as a falconer, writes as follows:
“All forms of falcons and short-winged hawks, such as sparrow-
hawks and goshawks, always strike their quarry with their feet, and
never with anything else. The killers are those which ‘bind to’ their
quarry in the air, that is, pick up a bird in their feet, and never let go
of it until they come to the ground. A really experienced old trained
falcon does this nine times out of ten.
“Sometimes, however, when stooping from a great height, the
impetus of the falcon is so terrific that she seems to know if she
‘binds to’ her quarry, the impact will be so great as nearly to tear her
legs from her body. Thus, when stooping at a heavy bird like a
grouse, or a pheasant, at great speed, the falcon slightly throws
upwards on her impact with the quarry, and delivers a raking blow
with her single long back talon. By this means (her back talon being
sharp as a razor) I have seen a grouse ripped open from its tail to its
neck. I have seen its wing broken and I have seen its head cut off.
“All falcons are very careful not to risk touching anything with their
wings, hence a falcon will never really stoop at a bird on the ground
with an idea of catching it, but they will keep stooping just over a
bird they can see on the ground in the hope of flushing it, and then
they will catch it in a minute.
“I have seen falcons and hawks break their wings by striking the
smallest twig on the branch of a tree when misjudging a stoop at a
bird.
“Therefore, you can imagine how easily a hawk would smash its
wing if it attempted this, to hit a heavy bird like a grouse or
pheasant going at terrific speed.
“If you threw a lawn-tennis ball against a falcon’s wing coming at
you at the rate of over a hundred miles per hour, and hit its wing-
bone, that hawk would never fly again.
“I have many times in my life, when casting lightly with a very
small trout rod, just touched the wing of a swift or swallow with the
tip of the rod. I never broke a rod thus, but nearly always broke the
bird’s wing. I think, when you come to consider these things, you
will see that a hawk dare not strike the smallest bird with its wing.
“It uses its beak only to finish off a bird on the ground, and this
she does by breaking the bird’s neck with its beak.
“I have lived amongst wild and trained hawks all my life, and I can
assure you the above facts are true.”
The reference in the above letter to the peregrine killing a grouse
by striking it with its talon reminds me of the following interesting
note in Birds of Great Britain (5 volumes), published by the author,
John Gould, F.R.S., in 1873.
“Evidence forwarded to Mr. James Burdett, keeper to the Earl of
Craven.... On dissecting a coot I saw taken and dropped by a
peregrine falcon, I found the neck dislocated at the third joint from
the head and an appearance as if the sharp point of the hind claw
had penetrated the brain at the occiput.”
Captain C. F. A. Portal, D.S.O., writes as follows:
“I have seen many dozens of game-birds struck down by trained
peregrines within 50 yards of me, and I can definitely state that the
hawk invariably aims a blow with the talons at his quarry....
“So true is a peregrine’s aim that he generally gets home with
both his hind talons somewhere near the middle of the quarry’s
back, but often he hits a wing and breaks it, and occasionally he
breaks the neck in the same way. I have examined hundreds of birds
(partridges) killed by hawks, and I have always found the mark of
two hind talons or one of them. The decapitation is generally
performed within a few seconds of the hawk’s alighting on the dazed
or crippled victim. It is performed by one powerful wrench of the
beak. No peregrine will eat or even pluck a living bird.... In my
experience it is a rare thing for a peregrine to strike a bird dead in
the air. It does occasionally happen that the blow falls on the head
or neck, but what generally happens is that the bird is thrown
violently to the ground with a wing broken or the back dislocated.
The concussion with the ground dazes it, and the hawk quickly drops
down upon it and kills it with its beak.
“The merlin often kills comparatively large birds (e.g. the thrush,
fieldfare, golden plover, etc.) by strangling them, as its beak is not
strong enough to break their necks. It kills larks, etc., in the same
way as the peregrine kills his quarry, that is, by sudden dislocation of
the neck.
“The sparrow-hawk kills its prey by gripping it with its feet and
driving the claws into its body; this is a slow death sometimes, and
the sparrow-hawk has none of the true falcon’s scruples about
plucking (and even, I fear, beginning to devour) a living bird.
“I do not like the sparrow-hawk for this reason, though, of course,
the falconer can generally prevent cruelty by killing the quarry
himself.”
Captain G. S. Blaine, another falconer of great experience, also
has no doubt on the matter. In a letter to me on this question he
writes:
“A peregrine strikes with its talons only. Of this I am certain,
having seen the blow given to countless quarries at close quarters.
How the other idea (that of striking with the wing) could possibly
have originated I do not know. It is quite obviously impracticable....
If a peregrine administered the terrific blow which she delivers when
striking a quarry with her wing, breast, or beak, she would be
knocked out at once, and permanently injured. A peregrine can
easily, after recovering from her stoop, turn over again and catch the
quarry in the air. I have seen this often done, when the bird had
been struck high up in the air. If near the ground, it would fall before
the hawk could get hold of it. Many also often catch and hold a
quarry without knocking it down. This is the way most successful
game hawks catch grouse or partridges. When struck, the blow is
delivered on any part of the body—it may be the head and it may be
the back or the wing which may be broken.”
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!
ebookfinal.com

More Related Content

PDF
Ejb 3 Developer Guide A Practical Guide For Developers And Architects To The ...
casabyuhassk
 
PDF
Net Compact Framework 35 Datadriven Applications Build Robust And Featurerich...
frockhanyaci
 
PDF
Study Guide Comprehensive Outline for the OutSystems 11 Web Associate Applica...
yrbfpyd0661
 
PDF
Applied Architecture Patterns On The Microsoft Platform An Indepth Scenariodr...
flegefosse93
 
PDF
WebWork in Action In Action First Edition Patrick Lightbody
sminkasimian
 
PDF
Getting MEAN with Mongo Express Angular and Node 1st Edition Simon Holmes
nqaoylllvg977
 
PDF
Kubernetes Best Practices 1st Edition Brendan Burns Eddie Villalba
duukkoofi65
 
PDF
(eBook PDF) Full Stack Development with JHipster: Build modern web applicatio...
ashyqqc893
 
Ejb 3 Developer Guide A Practical Guide For Developers And Architects To The ...
casabyuhassk
 
Net Compact Framework 35 Datadriven Applications Build Robust And Featurerich...
frockhanyaci
 
Study Guide Comprehensive Outline for the OutSystems 11 Web Associate Applica...
yrbfpyd0661
 
Applied Architecture Patterns On The Microsoft Platform An Indepth Scenariodr...
flegefosse93
 
WebWork in Action In Action First Edition Patrick Lightbody
sminkasimian
 
Getting MEAN with Mongo Express Angular and Node 1st Edition Simon Holmes
nqaoylllvg977
 
Kubernetes Best Practices 1st Edition Brendan Burns Eddie Villalba
duukkoofi65
 
(eBook PDF) Full Stack Development with JHipster: Build modern web applicatio...
ashyqqc893
 

Similar to Drools JBoss Rules 5 0 developer s guide develop rules based business logic using the Drools platform 1st Edition Michal Bali (20)

PDF
Getting MEAN with Mongo Express Angular and Node 1st Edition Simon Holmes
sherajqublan
 
PDF
WebWork in Action In Action First Edition Patrick Lightbody
qvpsslwlk478
 
PDF
WebWork in Action In Action First Edition Patrick Lightbody
goddesabot79
 
PDF
Activiti in Action Executable business processes in BPMN 2 0 Tijs Rademakers
qbfqcbj014
 
PDF
Angular Up and Running Learning Angular Step by Step 1st Edition Shyam Seshadri
maneskortyjt
 
PDF
Spring Microservices In Action 1st Edition John Carnell
kcjsuwx115
 
PDF
Open Source ESBs in Action 1st Edition Tijs Rademakers
krulatasev
 
PDF
Modelling Systems Practical Tools and Techniques in Software Development 2nd ...
trnfoep1208
 
PDF
JavaScript Application Design A Build First Approach 1st Edition Nicolas Beva...
mechagoins28
 
PDF
Azure Infrastructure As Code With Arm Templates And Bicep 1st Edition Henry Been
biprolarebo
 
PDF
The C Players Guide 2nd Edition 2nd Edition Rb Whitaker
lelukatagiri42
 
PDF
Open Source ESBs in Action 1st Edition Tijs Rademakers
zarievidaja
 
PDF
Reengineering Legacy Software Chris Birchall
mattyychonr
 
PDF
Making use of Python 1st Edition Rashi Gupta
nonsizueva
 
PDF
ASP NET MVC in Action 1st Edition Jeffrey Palermo
sysolkadieqj
 
PDF
(eBook PDF) Operations Management: Processes and Supply Chains 11th Edition
reethitwang
 
PDF
Making use of Python 1st Edition Rashi Gupta
jinzocrustag
 
PDF
SOA Governance in Action REST and WS Architectures Jos Dirksen
mpenaboyaro
 
PDF
Service Oriented Architecture Successfully Implement Your Own Enterprise Inte...
sestoslomaxf
 
PDF
Project Management Theory and Practice 2nd Edition Richardson
jexuastini25
 
Getting MEAN with Mongo Express Angular and Node 1st Edition Simon Holmes
sherajqublan
 
WebWork in Action In Action First Edition Patrick Lightbody
qvpsslwlk478
 
WebWork in Action In Action First Edition Patrick Lightbody
goddesabot79
 
Activiti in Action Executable business processes in BPMN 2 0 Tijs Rademakers
qbfqcbj014
 
Angular Up and Running Learning Angular Step by Step 1st Edition Shyam Seshadri
maneskortyjt
 
Spring Microservices In Action 1st Edition John Carnell
kcjsuwx115
 
Open Source ESBs in Action 1st Edition Tijs Rademakers
krulatasev
 
Modelling Systems Practical Tools and Techniques in Software Development 2nd ...
trnfoep1208
 
JavaScript Application Design A Build First Approach 1st Edition Nicolas Beva...
mechagoins28
 
Azure Infrastructure As Code With Arm Templates And Bicep 1st Edition Henry Been
biprolarebo
 
The C Players Guide 2nd Edition 2nd Edition Rb Whitaker
lelukatagiri42
 
Open Source ESBs in Action 1st Edition Tijs Rademakers
zarievidaja
 
Reengineering Legacy Software Chris Birchall
mattyychonr
 
Making use of Python 1st Edition Rashi Gupta
nonsizueva
 
ASP NET MVC in Action 1st Edition Jeffrey Palermo
sysolkadieqj
 
(eBook PDF) Operations Management: Processes and Supply Chains 11th Edition
reethitwang
 
Making use of Python 1st Edition Rashi Gupta
jinzocrustag
 
SOA Governance in Action REST and WS Architectures Jos Dirksen
mpenaboyaro
 
Service Oriented Architecture Successfully Implement Your Own Enterprise Inte...
sestoslomaxf
 
Project Management Theory and Practice 2nd Edition Richardson
jexuastini25
 
Ad

Recently uploaded (20)

PDF
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PDF
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PPTX
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
PDF
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
PPTX
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
PDF
Sunset Boulevard Student Revision Booklet
jpinnuck
 
PPTX
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
PPT
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
PDF
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
PPTX
Care of patients with elImination deviation.pptx
AneetaSharma15
 
PDF
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
PPTX
CDH. pptx
AneetaSharma15
 
DOCX
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
PPTX
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
PDF
Study Material and notes for Women Empowerment
ComputerScienceSACWC
 
Phylum Arthropoda: Characteristics and Classification, Entomology Lecture
Miraj Khan
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PG-BPSDMP 2 TAHUN 2025PG-BPSDMP 2 TAHUN 2025.pdf
AshifaRamadhani
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
How to Manage Leads in Odoo 18 CRM - Odoo Slides
Celine George
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
Types of Literary Text: Poetry and Prose
kaelandreabibit
 
PREVENTIVE PEDIATRIC. pptx
AneetaSharma15
 
Sunset Boulevard Student Revision Booklet
jpinnuck
 
Odoo 18 Sales_ Managing Quotation Validity
Celine George
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Software Engineering BSC DS UNIT 1 .pptx
Dr. Pallawi Bulakh
 
Python Programming Unit II Control Statements.ppt
CUO VEERANAN VEERANAN
 
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
Care of patients with elImination deviation.pptx
AneetaSharma15
 
2.Reshaping-Indias-Political-Map.ppt/pdf/8th class social science Exploring S...
Sandeep Swamy
 
CDH. pptx
AneetaSharma15
 
Action Plan_ARAL PROGRAM_ STAND ALONE SHS.docx
Levenmartlacuna1
 
Tips Management in Odoo 18 POS - Odoo Slides
Celine George
 
Study Material and notes for Women Empowerment
ComputerScienceSACWC
 
Ad

Drools JBoss Rules 5 0 developer s guide develop rules based business logic using the Drools platform 1st Edition Michal Bali

  • 1. Drools JBoss Rules 5 0 developer s guide develop rules based business logic using the Drools platform 1st Edition Michal Bali pdf download https://ebookfinal.com/download/drools-jboss-rules-5-0-developer- s-guide-develop-rules-based-business-logic-using-the-drools- platform-1st-edition-michal-bali/ Explore and download more ebooks or textbooks at ebookfinal.com
  • 2. We have selected some products that you may be interested in Click the link to download now or visit ebookfinal.com for more options!. Rebound Rules The Art of Success 2 0 1st Edition Rick Pitino https://ebookfinal.com/download/rebound-rules-the-art-of- success-2-0-1st-edition-rick-pitino/ Type Rules The Designer s Guide to Professional Typography 2nd Edition Ilene Strizver https://ebookfinal.com/download/type-rules-the-designer-s-guide-to- professional-typography-2nd-edition-ilene-strizver/ Challenging The Rules s of Law Kalpana Kannabiran https://ebookfinal.com/download/challenging-the-rules-s-of-law- kalpana-kannabiran/ A Guide to the UNCITRAL Arbitration Rules 1st Edition Clyde Croft https://ebookfinal.com/download/a-guide-to-the-uncitral-arbitration- rules-1st-edition-clyde-croft/
  • 3. Who rules the earth how social rules shape our planet and our lives 1st Edition Steinberg https://ebookfinal.com/download/who-rules-the-earth-how-social-rules- shape-our-planet-and-our-lives-1st-edition-steinberg/ Brain Rules John Medina https://ebookfinal.com/download/brain-rules-john-medina/ JK Lasser s Small Business Taxes 2006 Your Complete Guide to a Better Bottom Line J K Lasser s New Rules for Small Business Taxes Barbara Weltman https://ebookfinal.com/download/jk-lasser-s-small-business- taxes-2006-your-complete-guide-to-a-better-bottom-line-j-k-lasser-s- new-rules-for-small-business-taxes-barbara-weltman/ JK Lasser s Small Business Taxes 2007 Your Complete Guide to a Better Bottom Line J K Lasser s New Rules for Small Business Taxes Barbara Weltman https://ebookfinal.com/download/jk-lasser-s-small-business- taxes-2007-your-complete-guide-to-a-better-bottom-line-j-k-lasser-s- new-rules-for-small-business-taxes-barbara-weltman/ Power Rules Leslie H. Gelb https://ebookfinal.com/download/power-rules-leslie-h-gelb/
  • 5. Drools JBoss Rules 5 0 developer s guide develop rules based business logic using the Drools platform 1st Edition Michal Bali Digital Instant Download Author(s): Michal Bali; James Taylor; Sammy Larbi ISBN(s): 9781847195654, 1847195652 Edition: 1 File Details: PDF, 2.27 MB Year: 2009 Language: english
  • 6. Drools JBoss Rules 5.0 Developer's Guide Develop rules-based business logic using the Drools platform Michal Bali BIRMINGHAM - MUMBAI
  • 7. Drools JBoss Rules 5.0 Developer's Guide Copyright © 2009 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, Packt Publishing, nor its dealers or distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: July 2009 Production Reference: 1060709 Published by Packt Publishing Ltd. 32 Lincoln Road Olton Birmingham, B27 6PA, UK. ISBN 978-1-847195-64-7 www.packtpub.com Cover Image by Vinayak Chittar ([email protected])
  • 8. Table of Contents Preface 1 Chapter 1: Introduction 7 Problems with traditional approaches 7 The solution 9 Advantages 10 Disadvantages 12 When not to use a rule engine 13 Drools 13 Alternatives to Drools 15 Summary 15 Chapter 2: Basic Rules 17 Rule basics 17 Executing rules 19 Rule syntax 23 Rule concepts 23 Variables in rules 23 Types 24 Comments 24 Package 25 Imports 25 Global variables 25 Functions 26 Dialect 27 Rule condition 28 And 28 Or 29 Not 29 Exists 30 Eval 30 Return value restriction 30 Inline eval 30
  • 9. Table of Contents [ ii ] This 32 Working with collections 32 Rule consequence 33 Rule attributes 34 salience (priority) 35 No-loop 35 Dialect 35 Summary 35 Chapter 3: Validation 37 Banking domain model 37 Problem definition 38 Analysis 39 Design 39 Validation package 41 Object required type rules 44 Testing 45 Minimal account balance rule 49 Student account rule 50 Unique account number rule 52 Implementation 53 Validation service 56 Summary 58 Chapter 4: Data Transformation 59 Process overview 59 Getting the data 60 Loading facts into the knowledge session 61 Writing transformation rules 63 Testing 64 Address normalization 67 Testing the findAddress rule 68 Unknown country 69 Currency conversion 70 One account allowed 72 Transformation results 74 Implementation of the data loading 76 Database setup 76 Project setup 77 iBatis configuration 78 Running iBatis 79 Alternative data loading 80 Summary 80
  • 10. Table of Contents [ iii ] Chapter 5: Human-readable Rules 81 Domain Specific Language 81 DSL as an interface 84 DSL for validation rules 84 File formats 86 DSL file format 86 DRL file format 87 DSLR file format 88 DSL for multiple constraints in a condition 88 Named capture groups 89 DSL for data transformation rules 90 Decision tables 92 Advantages of a decision table 95 Disadvantages of a decision table 96 Calculating the interest rate 96 Project setup 98 Testing 98 Comma Separated values 100 Rule Templates 101 Drools Flow 101 Drools Agenda 101 Methods for managing rule execution order 102 Ruleflow 103 Start 104 End 104 Action 104 RuleFlowGroup 104 Split 105 Join 106 Example 106 Rules 107 KnowledgeBase setup 107 Tests 108 Summary 110 Chapter 6: Stateful Session 111 Introduction to stateful session 111 Validation using stateful session 112 Design overview 113 Stateful validation service 113 Integration testing 118 Logical assertions 121 Keeping the validation report up-to-date 123 Collect conditional element 124
  • 11. Table of Contents [ iv ] Serialization 126 Knowledge session re-creation 126 Testing 128 Session serialization 129 Full session serialization 130 Summary 132 Chapter 7: Complex Event Processing 133 CEP and ESP 133 Drools Fusion 134 Fraud detection 134 Problem description 135 Design and modeling 135 Fraud detection rules 138 Notification 139 Monitoring—averageBalanceQuery 143 Two large withdrawals 144 Sequence of increasing withdrawals 148 High activity 158 Summary 160 Chapter 8: Drools Flow 161 Loan approval service 161 Model 162 Loan approval ruleflow 162 Invalid loan application form 163 Email work item 163 Fault node 165 The size of the loan 168 Test for a small loan 169 Rating Calculation 169 Subflow 170 Subflow diagram 170 Rating calculation subflow test 173 Decisions on rating 174 Testing the 'Rating?' node 175 Transfer Funds work item 175 Work item definition 177 Work item registration 178 Work item handler 178 Work item handler registration 180 Testing the transfer work item 180 Human task 181 Test for the human task 183 Final Approval 186 Test for the 'Approve Event' node 186
  • 12. Table of Contents [ ] Banking service 187 Disadvantages of a ruleflow 188 Summary 188 Chapter 9: Sample Application 189 Users 189 Architecture 189 Technologies used 190 Additional Drools projects used 191 Libraries used 191 Business logic 191 Design 192 Configuration 192 JPA annotations for domain objects 193 JPA configuration 194 Spring Framework configuration 195 Web application setup 197 Tag library 199 Tomcat setup 199 Deployment 200 Repositories 200 Validation 201 Services 203 Transactions 204 Presentation layer 206 Localized messages 208 Customer save form controller 208 Complex Event Processing service 211 Loan approval 211 Loan request form 212 Process persistence 213 Task list 220 Working on a task 222 Loan approval event 225 Summary 227 Chapter 10: Testing 229 How to write unit tests for rules 229 Rule integration testing 230 Rule acceptance testing 230 Creating a test scenario 232 Running a test scenario 234 Running all test scenarios 235
  • 13. Table of Contents [ vi ] Static analysis of rules 236 Troubleshooting techniques 237 Event listeners 238 Debugging 239 Source of generated classes 241 mvel tricks 241 Summary 242 Chapter 11: Integration 243 Dynamic KnowledgeBase loading 243 KnowledgeAgent 244 External artifact building 246 Building with Ant 246 Drools execution server 248 Interest rate calculation example 249 The server 249 The client 251 Spring Framework integration 252 KnowledgeBaseFactoryBean 253 Standards 255 JSR94 Java Rule Engine API 255 Summary 256 Chapter 12: Performance 257 Rete algorithm 257 Node types 259 Rete node 260 EntryPointNode 260 ObjectTypeNode 261 AlphaNode 261 LeftInputAdapterNode 261 TerminalNode 262 BetaNode 262 More complex example 264 EvalNode and FromNode 266 Retracting or modifying a fact 266 Initial fact 266 Node sharing 267 Example 268 Node indexing 269 AlphaNode indexing 269 Computation complexity 270 BetaNode indexing 271 Example 271
  • 14. Table of Contents [ vii ] KnowledgeBase partitioning 273 Parallel execution 274 Summary 275 Appendix A: Development Environment Setup 277 Environment setup 277 Dependencies and their licenses 279 Appendix B: Custom Operator 281 Summary 287 Appendix C: Dependencies of Sample Application 289 Index 293
  • 15. Preface Business rules and processes can help your business by providing a level of agility and flexibility. As a developer, you will be largely responsible for implementing these business rules and processes effectively, but implementing them systematically can often be difficult due to their complexity. Drools, or JBoss Rules, makes the process of implementing these rules and processes quicker and handles the complexity, making your life a lot easier! This book guides you through various features of Drools, such as rules, ruleflows, decision tables, complex event processing, Drools Rete implementation with various optimizations, and others. It will help you to set up the Drools platform and start creating your own business. It's easy to start developing with Drools if you follow our real-world examples that are intended to make your life easier. Starting with an introduction to the basic syntax that is essential for writing rules, the book will guide you through validation and human-readable rules that define, maintain, and support your business agility. As a developer, you will be expected to represent policies, procedures, and constraints regarding how an enterprise conducts its business; this book makes it easier by showing you the ways in which it can be done. A real-life example of a banking domain allows you to see how the internal workings of the rules engine operate. A loan approval process example shows the use of the Drools Flow module. Parts of a banking fraud detection system are implemented with Drools Fusion module, which is the Complex Event Processing part of Drools. This in turn, will help developers to work on preventing fraudulent users from accessing systems in an illegal way. Finally, more technical details are shown on the inner workings of Drools, the implementation of the ReteOO algorithm, indexing, node sharing, and partitioning.
  • 16. Preface [ ] What this book covers Chapter 1: This chapter introduces the reader to the domain of business rules and business processes. It talks about why the standard solutions fail at implementing complex business logic. It shows a possible solution in the form of a declarative programming model. The chapter talks about advantages and disadvantages of Drools. A brief history of Drools is also mentioned. Chapter 2: This chapter shows us the basics of working with the Drools rule engine—Drools Expert. It starts with a simple example that is explained step-by-step. It begins with the development environment setup, writing a simple rule, and then executing it. The chapter goes through some necessary keywords and concepts that are needed for more complex examples. Chapter 3: This chapter introduces the reader to a banking domain that will be the basis for examples later in this book. The chapter then goes through an implementation of a decision service for validating this banking domain. A reporting model is designed that holds reports generated by this service. Chapter 4: This chapter shows how Drools can be used for carrying out complex data transformation tasks. It starts with writing some rules to load the data, continues with the implementation of various transformation rules, and finally puts together the results of this transformation. The chapter shows how we can work with a generic data structure such as a map in Drools. Chapter 5: The focus of this chapter is on rules that are easy to read and change. Starting with domain specific languages, the chapter shows how to create a data transformation specific language. Next, it focuses on decision tables as another more user-friendly way of representing business rules. An interest rate calculation example is shown. Finally, the chapter introduces the reader to Drools Flow module as a way of managing the rule execution order. Chapter 6: This chapter talks about executing the validation decision service in a stateful manner. The validation results are accumulated between service calls. This shows another way of interacting with a rule engine. Logical assertions are used to keep the report up-to-date. Various ways of serializing a stateful session are discussed. Chapter 7: This chapter talks about Drools Fusion—another cornerstone of the Drools platform is about writing rules that react to various events. The power of Drools Fusion is shown through a banking fraud detection system. The chapter goes through various features such as events, type declarations, temporal operators, sliding windows, and others.
  • 17. Preface [ ] Chapter 8: This chapter goes into more detail about the workflow aspect of the Drools platform. It is showed through a loan approval service that demonstrates the use of various nodes in a flow. Among other things, the chapter talks about implementing a custom work item, human task, or a sub-flow. Chapter 9: The purpose of this chapter is to show you how to integrate Drools in a real web application. We'll go through design and implementation of persistence, business logic, and presentation layers. All of the examples written so far will be integrated into this application. Chapter 10: The focus of this chapter is to give you an idea about the various ways of testing your business logic. Starting with unit testing, integration testing through acceptance testing that will be shown with the help of the Business Rules Management Server—Guvnor, this chapter provides useful advice on various troubleshooting techniques. Chapter 11: This chapter shows integration with the Spring Framework. It describes how we can make changes to rules and processes while the application runs. It shows how to use an external build tool such as Ant to compile rules and processes. It talks about the rule execution server that allows us to execute rules remotely. It briefly mentions support of various standards. Chapter 12: This chapter goes under the hood of the Drools rule engine. By understanding how the technology works, you'll be able to write more efficient rules and processes. It talks about the ReteOO algorithm, node sharing, node indexing, and rule partitioning for parallel execution. Appendix A: It lists various steps required to get you up and running with Drools. Appendix B: It shows an implementation of a custom operator that can be used to simplify our rules. Appendix C: It lists various dependencies used by the sample web application. What you need for this book In order to learn Drools and run the examples in this book, you'll need a computer with any Operating System (Windows, Mac, or Linux), Java Development Kit (JDK) version 1.5 or later, Drools binary distribution, some IDE—preferably Eclipse IDE for Java EE developers, Drools plugin for Eclipse, and some third-party libraries that will be specified per chapter. All of the mentioned software is freely available on the Internet under a business friendly license. You can download some additional support material from http://code.google.com/p/droolsbook/.
  • 18. Preface [ ] Who this book is for The book is for Java developers who want to create rules-based business logic using the Drools platform. Basic knowledge of Java is essential. Readers are requested to note that they should follow the text carefully. Some additions to the code are required in order to run the examples successfully. Conventions In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning. Code words in text are shown as follows: Drools keywords are rule, when, then, and end. A block of code will be set as follows: package droolsbook; rule basic rule when Account( balance 100 ) // condition then System.out.println(Account balance is + less than 100); // consequence end New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in our text like this: After it finishes execution, Action is executed, the flow continues to another ruleflow group called Group 2, and finally it finishes at an End node. Warnings or important notes appear in a box like this. Tips and tricks appear like this.
  • 19. Preface [ ] Reader feedback Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of. To send us general feedback, simply drop an email to [email protected], and mention the book title in the subject of your message. If there is a book that you need and would like to see us publish, please send us a note in the SUGGEST A TITLE form on www.packtpub.com or email [email protected]. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors. Customer support Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase. Downloading the example code for the book Visit http://www.packtpub.com/files/code/5647_Code.zip to directly download the example code. The downloadable files contain instructions on how to use them. Errata Although we have taken every care to ensure the accuracy of our contents, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in text or code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration, and help us to improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub. com/support, selecting your book, clicking on the let us know link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata added to any list of existing errata. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.
  • 20. Preface [ ] Piracy Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or web site name immediately so that we can pursue a remedy. Please contact us at [email protected] with a link to the suspected pirated material. We appreciate your help in protecting our authors, and our ability to bring you valuable content. Questions You can contact us at [email protected] if you are having a problem with any aspect of the book, and we will do our best to address it.
  • 21. Introduction The need to build more and more complex systems is increasing. We're trying to automate all kinds of business processes and implement complex business decisions. However, these processes and decisions are not very well represented using traditional programming languages such as Java or C#. Instead, we should use specialized technology such as the Drools platform. In this chapter, we'll look at why there is a need for the Drools platform, what advantages and disadvantages it brings, and when (not) to use it. We'll briefly look at its history and what modules it consists of. We'll also see some commercial and open source alternatives. Problems with traditional approaches Enterprise systems usually have multiple layers. From top to bottom they are: presentation layer, business logic layer, and persistence layer. The middle layer—business logic represents the core of the application where all of the business processes and decisions take place. The requirements for the business logic layer tend to change more often than the requirements for the rest of the application. We might be lucky when we get a complete specification, but that happens rarely. Even then, the requirements usually evolve over time and are often re-worked. As this happens, a standard solution using imperative style language (imperative programs are a sequence of commands for the computer to perform; for example, languages such as Java and C#) would quickly end up with so-called spaghetti code—lots of nested if-else statements.
  • 22. Introduction [ ] It is often a good idea to document the following separately: Business processes: Represent what the business does Business rules: Represent decisions that the business does Requirements: Represent how the system supports the business, defines goals These areas change at different schedules, have a different degree of business user involvement, and none the less they are implemented differently. I am referring to these three areas simply as requirements. • • • There is no well defined way of representing the business logic in Java or C#. What usually happens is that every application represents business logic differently. For example, consider the following code that does some checking on customer level, customer accounts, and account balance: if (customer.getLevel() == Level.Gold) { //do something for Gold customer } else if (customer.getLevel() == Level.Silver) { if (customer.getAccounts() == null) { //do something else for Silver customer with no accounts } else { for (Account account : customer.getAccounts()) { if (account.getBalance 0) { //do something for Silver Customer that has //account with negative balance } } } } Code listing 1: Code written in standard Java (or any imperative style language). Readers are requested to note that they should follow the text carefully. Some additions to the code are required in order to run the examples successfully. First, the code checks if the customer is a Gold level customer and does something, then it checks if the customer is a Silver level customer, and if so, it checks if this customer has no accounts and does something in this case. If the customer has accounts, the code performs some logic for each account that has negative balance.
  • 23. Chapter 1 [ ] The point of this Java 'spaghetti code' is to give you an idea what we are trying to prevent. You may think that it doesn't look that bad. However, after a couple of changes in requirements and developers that are maintaining the code, it can get much worse. It is usually the case that if you fix one bug, you are more likely to introduce five new bugs. A lot of requirements are literally packed into a few lines of code. This code is hard to maintain or change in order to accommodate new requirements. As more conditions are added, the performance of this system will degrade. Moreover, when we want to change the behavior of the application, we'll have to re-compile and re-deploy the whole application. It is not only difficult to represent business logic in a imperative programming style language, but also hard to differentiate between code that represents the business logic and the infrastructure code that supports it. For developers, it is hard to change the business logic. For domain experts, it is impossible to verify the business logic and even harder to change it. There is a need for a different paradigm for representing the business logic. The solution The problem is that with an imperative style language, we are implementing both, what needs to be done (business requirements) and how it needs to be done (algorithm). Let's look at declarative style programming, such as SQL, in relational databases (other declarative style languages include, for example, Prolog or XSLT). SQL describes what we want to search, it doesn't say anything about how the database should find the data. This is exactly what we need for our business requirements. A rule engine provides an alternative computational model. We declare rules in pretty much the same way as the business analyst does the requirements—as a group of if-then statements. The rule engine can then take these rules and execute them over our data in the most efficient way. Rules, which have all of their conditions true, have their then part evaluated. This is different from imperative style programming languages where the developer has to specify how it needs to be done explicitly (with a sequence of conditionals and loops). If we rewrite the code from code listing 1 in a declarative manner, it might look like the following: if Customer( level == Level.Gold ) then do something else for Gold customer if Customer( level == Level.Silver ) and no Account( )
  • 24. Introduction [ 10 ] then do something for Silver customer who has no accounts if Customer( level == Level.Silver) and Account( balance 0, customer.accounts contains account ) then do something for Silver Customer that has account with negative balance Code listing 2: Rules from code listing 1 written using declarative style. Each rule represents one requirement. This is more readable and maps to business requirements more naturally. Advantages The following is a summary of various advantages of a declarative style solution that Drools brings: Easier to understand: Rules are easier to understand for a business analyst or a new developer than a program written in Java or other imperative style languages. It is more likely for a technically skilled business analyst to verify or change rules than a Java program. Improved maintainability: As rules are easier to understand, a developer can spend more time solving the actual problem. We don't care about how to implement a solution. We only care about what needs to be done to solve a problem. Deals with evolving complexity: It is much easier to add new rules, modify or remove existing rules than to change, for example, a Java program. The impact this has on other rules is minimal in comparison with an imperative style implementation. Flexibility: It deals with changes to the requirements or changes to the data model in a much better way. Changing or rewriting an application is never an easy task. However, thanks to formalism that rules bring, it is much easier to change rules than to change a Java program. Reasonable performance: Thanks to the Rete algorithm that is behind Drools, in theory, the performance of the system doesn't depend on the number of rules. Because a rule engine is essentially a generic if-then statement executor, there are numerous performance optimizations that can be applied independently of the rules. With every release of Drools, the performance of the engine is getting better, by adding various optimizations such as Rete node sharing, node indexing, parallel execution. • • • • •
  • 25. Chapter 1 [ 11 ] Requirements can be naturally translated into rules: The representation of business rules is consistent. For example, let's take some business rule and implement it in Java. Developers, depending on their experience, tend to use different ways to solve a problem. We'll find out that the possible solutions will wary greatly. Whereas with rules, this diversification becomes less apparent. It is simply because we are expressing 'what' instead of 'how'. As a result, the code is much easier to read even by new developers. Ability to apply enterprise management to our rules: This builds on the previous advantage of consistent representation. If we have consistent representation, it is much easier to introduce new features that apply across all of our rules (for example, auditing, logging, reporting, or performance optimizations). Reusability: Rules are kept in one place (separation of business logic from the rest of the system), which means easier reusability (for example, imagine you've written some validation rules for your application and later on there is a need to do some batch imports of data; you could simply reuse the validation rules in you batch import application) Rules model the application invariants more closely: Imperative style solutions tend to impose arbitrary and often unnecessary ordering on operations depending on the algorithm chosen. This then hides the original invariants of the application. The Drools platform brings unification of rules and processes: It is easy to call rules from a process or vice-versa. Independent Lifecycle: Rules and processes tend to change far more often than anything else in the application. With Drools, the rules and processes can be authored, deployed, versioned, managed, and so on, independently from the rest of the application. Embedability: Drools can be easily embedded into existing applications in order to implement just a section of a system. • • • • • • •
  • 26. Discovering Diverse Content Through Random Scribd Documents
  • 27. had not been properly tested before being used again. Thus closed the third chapter in a day which illustrated the truth of the proverb that “misfortunes never come singly.” The following day, Tuesday, showed no signs of improvement in the weather. Thick mist on the tops, steady rain, and a wind, as usual, in the wrong direction. Stuart was obliged to drive some miles off to see a friend, but I determined once more to try the hill. This time I was sent out on the home beat. I started off with the stalker and an old gillie named Angus, who had had so much experience that he would have made an admirable stalker, and who is always very keen. I also had two ponies and a pony boy. The pony path goes straight up the mountain-side for two and a half miles. By the time we reached the point where the path stopped we were close to the edge of the mist, and the outlook seemed hopeless. We decided to cross over the opposite hill and go down on the other side, hoping that by that time the mist might have lifted. We left instructions with the pony boy to wait for two hours, and then if he heard nothing from us to go back right round to a point on the other side of the hill and wait there. On our way up the hill I found some beautiful little bastard pimpernel in flower, not very common in this part of the country. As we worked our way up the mountain-side the wind became stronger and the rain heavier. It was intensely cold, and very difficult to see what was in front of us. Having arrived at the ridge, nearly 3000 feet up, we tried to spy the corrie below. What with the tremendous wind and driving rain this was a matter of the greatest difficulty, and in conditions of this kind I always think there is a better chance of picking up deer with first-rate field-glasses than with a telescope. I managed, with my field-glasses, to discover two stags feeding in a sheltered part of the opposite side of the corrie, and, after shifting our position in order to get a better view of them, we found that there were some hinds feeding below them. We came to the conclusion that the only chance of obtaining a shot at the stags was by getting in between them and the hinds. After some trouble we succeeded in doing this, but old Angus, who knew the corrie well, said that the wind at this place was very uncertain, and
  • 28. that it was a question whether the stags would not get our wind. He had hardly uttered this warning before there was a fatal puff in the wrong direction, and away went the stags long before we were near them. We decided to go on and try the next corrie. It is difficult to imagine a greater contrast than the comparative warmth and peace which we were now enjoying as compared with the strife of the elements outside the corrie. The rain, too, had stopped, and I said to the stalker, “No wonder the deer came here; what a haven of rest!” THE FIVE SISTERS OF KINTAIL. By Finlay Mackinnon. We now worked our way across the ridge, and then spied the big corrie below. We discovered two lots of stags. Those in the first lot were moving on. The others were lying down in a place where they
  • 29. could be stalked without much difficulty; we therefore crawled some 400 or 500 yards, and, creeping cautiously up to the top of a little hill, saw the stags had got up and begun to feed. There was one quite clean about 90 yards below us, and another also clean about 130 yards from where we were lying. I fired at the near stag, who fell dead at once; I then covered the other stag and pulled the second trigger—result a missfire. I hastily reloaded and fired, killing the stag. We then went down to the stags which I had shot. The first was a six-pointer, whose horns and teeth showed him to be an old warrior. The second, a nine-pointer, was a younger beast, rather heavier. Both stags were in good condition, and weighed 13 st. 9 lb. and 14 st. 3 lb. clean. After gralloching the stags, we dragged them down the hill to a point from which we could signal to the pony boy. The ponies had long been used for carrying stags, and stood quietly whilst the stags were put on them. We soon reached the pony path, and after a walk of five miles reached the lodge. The following day, Wednesday, it rained and blew all day, and the mists hung low on the mountains, so that it was quite useless to attempt any stalking. The next day, Thursday, was the last day of my visit and that of Stuart. Stuart was particularly anxious to kill one more stag in the company of the second stalker, because he had killed his first stag in his company sixteen years ago in this forest, and had since then killed forty-eight stags in various forests. The day looked anything but propitious; there was mist and rain, and the wind was again in the wrong quarter. My host said he would go fishing up the glen; Stuart was sent to try one of the far beats in the company of his old friend the second stalker, whilst I was left to try the home beat again. As we went up the hill the mist gradually lifted, and we saw two huge golden eagles circling round and round. We saw no deer up to two o’clock; but whilst taking lunch we suddenly saw several stags coming round the side of a distant hill. We hastily finished our lunch and set out on what proved to be a long and exciting stalk. From time to time we had to remain lying perfectly flat, not daring to move a muscle. Once we thought every chance of success was
  • 30. gone, for an old cock-grouse rose with his “Go-back,” “Go-back,” as we were nearing the rock from which we hoped to get a shot. The sun, of which we had seen nothing for so long, kept coming out and going in again. On a long stalk of this kind it is extraordinary what one sees and how ineffaceable is the memory of these sights—the eagle circling over the high tops not far distant; the blue hare leisurely making off, then stopping, sitting up and looking back; the ptarmigan, so beautiful in its mottled plumage, running in front of us, stopping now and again and peering around; the old cock-grouse rising with his warning described above, which too often brings the stalk to an untimely end; the many insects, some of them so strange and weird, that we see as we lie flat gazing into a clump of grass and moss; the granite boulders sparkling in the sunlight as if studded with many diamonds—most, if not all, of these things I saw in this particular stalk. Everything, however, comes to an end, and so at last I succeeded in getting a shot at the heaviest of the stags, who was standing on the side of a very rocky and precipitous hill. He ran a few yards and fell down dead. It was, indeed, fortunate that he fell where he did, caught between two rocks, for immediately below these rocks nothing could have stopped him from rolling down a precipice of several hundred feet, and, as old Angus said, the venison would not have been worth taking home and the horns would have been smashed to atoms. The stag, an old one in good condition, was dragged down to a place where the pony could come up, and, leaving Angus to find and help the pony boy, the stalker and I started to work our way homewards across the hill. We had been moving slowly onwards, spying from time to time, when we discovered a large number of stags feeding below us. A circuitous stalk brought us up to them, but in a very awkward position. It was impossible to get a shot, except by coming up to a point at the top of the hill below which they were feeding, and we should then be much too close to them. There was, however, no choice, and after a cautious crawl we reached a point from which we could see the horns of stags moving away from us, at a distance of not more than 30 yards. Crawling as flat as possible to the top of the little hill, the stalker slowly raised his head, and as slowly lowered it. He then
  • 31. whispered to me, “There’s a fine stag there, but he won’t wait long, and you’d better shoot over my back.” I cautiously raised the rifle over the stalker’s back in the direction indicated, and, slowly raising my head, saw a fine stag, with a good head, standing broadside on, about 70 yards away, looking straight at me. As quickly as possible I covered the stag’s heart and pulled the trigger; there was the unmistakable thud as the bullet struck the stag, who instantly turned and disappeared. “He’ll be all right,” said the stalker; “you don’t often hear a bullet strike more distinctly than that one did,” and on reaching the point where the stag had been standing we saw him about 80 yards below, lying dead. He turned out to be a royal, with very regular points and a good head, although he was going back and had evidently been better. Like two of the four stags I had previously shot, he was an ancient warrior. The mist, which had temporarily lifted, now came down again thicker than ever, and the stalker said that we should have an awful job to get the stag down, as it was a heavy one, and the ground was very awkward. We gralloched the stag, and took out the heart and liver in order to make him as light as possible, and then set to work to get the stag down. This was a very heavy job, and I could not help thinking, as I had often thought before, what an excellent thing it would be if every one who is going to stalk, whether proprietor, tenant, or guest, were obliged some time or other to take part in dragging a stag to the place where he is to be put on the pony, and help in putting him on the pony. We succeeded at last in getting the stag down, and the stalker then arranged to wait on the pony path lower down, in order to meet old Angus and the pony boy, who would be bringing the first stag I had shot and the ponies. I took my rifle, the luncheon bag, and the sticks and glasses, and struck across the hill for the lodge. On my way down I began to speculate as to the age of the two old stags I had shot that day, and came to the conclusion that they were probably not less than fourteen or fifteen years old. The old Gaelic saying, which shows how little was formerly known as to the age of a stag, came into my mind:
  • 32. Tri aois coin, aois eich; Tri aois eich, aois duine; Tri aois duine, aois feidh; Tri aois feidh, aois firein; Tri aois firein, aois dbaraich, which may be translated: Thrice dog’s age, age of horse; Thrice horse’s age, age of man; Thrice man’s age, age of deer; Thrice deer’s age, age of eagle; Thrice eagle’s age, age of oak. It is probably true to say that a stag in its wild state rarely lives beyond sixteen or seventeen years of age. In those forests which are on islands, for example Jura, stalkers have unusual opportunities of observing and learning the history of particular stags, and I recollect when stalking in North Jura two years ago discussing this subject with John Mackay, the head stalker. He told me that he had several times been familiar with a stag all through its life, and in more than one instance had seen a stag with a fine head gradually lose its points, until at last it had only comparatively short upright narrow horns with two, short brow points, the stag itself losing steadily both in size and weight and becoming very light in colour.
  • 33. OLD ANGUS NEARING HOME. By V. R. Balfour-Browne. I reached the lodge about 6.30. The stags weighed very nearly the same weight—16 st. 2 lb. and 16 st. 5 lb. clean—the royal being slightly heavier than the other. Our host returned about eight o’clock, having waited an hour past the time at which he had arranged to meet Stuart. The car was sent back for Stuart, who, however, did not reach the lodge until half-past ten, after a very long and strenuous day. He had, however, secured his fiftieth stag after a most troublesome stalk. He was not able to get his shot till past seven o’clock, at which time he was about seven miles from the lodge. So ended a most delightful week’s sport, notwithstanding the awful weather which we had had.
  • 35. IX A SALMON LOCH IN SUTHERLAND Fishermen’s stories are said to be proverbially untrustworthy, and the great majority of people—at any rate of those who are not themselves fishermen—never seem to suppose that in the case of a fisherman, as in the case of every one else, truth may sometimes be stranger than fiction. I have been a fly-fisher since my earliest days, and have had many good days both with the salmon and the trout, but I have never had a day full of such surprising contrasts as the day which I had with a brother of mine many years ago in the early part of September, on a loch through which flows one of the best of the smaller salmon rivers in the North of Scotland. Strange as were the
  • 36. events of that day, I can vouch for the absolute veracity of the following story. The loch in question is not very large, and is not deep in any part. It contains a good many trout about three to the pound, and at certain periods of the year many salmon. We had a long drive from X., where we were staying, and reached the loch about 10 a.m. We had with us a gillie, a salmon-fisher of long experience and a typical Highlander, in height about 6 ft. 3 in., whose name, like his hair, was Sandy. We had not expected to have any salmon-fishing while we were at X., but fortunately I happened to have with me my salmon rod as well as a trout rod, and we arranged on this day that we would fish with the two rods alternately, and that as soon as one of us caught a salmon the other would take the salmon rod. When we arrived at the loch there was a good breeze blowing from the west, with no sun. We put a medium-sized “Jock Scott” on the salmon cast, while on the trout cast we put, as a tail fly, a queer, nondescript fly, which Sandy fancied, and, as a bob fly, a “March Brown.” These two latter flies were the ordinary medium-sized loch- trout flies, and we thought it wiser, as we knew that there were a lot of salmon in the loch, to put only two flies on the trout cast. My brother began fishing with the salmon rod in the stern of the boat, while I tried in the bow for trout. I very soon rose three or four trout, and managed to secure two, but my brother had no luck with the salmon. We had not been fishing for more than half an hour when the wind went down and the sun came out. The surface of the loch became absolutely calm, just like a sheet of glass, and fishing appeared to be hopeless. The salmon now began to jump in different parts of the loch, and, although Sandy said it was perfectly useless, we kept trying to cast over them. At length, however, we gave it up, and sat waiting for the breeze. Suddenly a salmon rose about twenty yards from the boat. I said, “Come on, Sandy, put me over that,” and, taking up the salmon rod, proceeded to cast over the place where the salmon had risen. With great difficulty I got the line out, as it was dead calm. I cast once, twice, and for a third time, and just as I was getting to the end of my cast on the third attempt,
  • 37. up came the salmon, rising apparently not with the intention of taking the fly, but with the intention of drowning it. I struck at him and hooked him, as we discovered later, by the tail, and a very lively time he gave me. He played for about twenty-five minutes, during which time he never showed himself, and we all thought he was much larger than he turned out to be. He was a nice clean fish about 9¼ lb. By the time we got him in the wind had risen, and we began to fish again, my brother taking the salmon rod, whilst I fished with the trout rod from the bow. I had not been fishing for more than a few minutes before I rose something which did not show itself. I struck, and exclaimed, “I’ve hooked him!” Away went the line off my reel for about thirty yards, and at the end of this run the fish, a salmon which looked considerably larger than the one we had already caught, jumped right out of the water, high into the air. Then began the longest and most exciting struggle I have ever had with any fish. The rod with which I was fishing was a light 11-feet trout rod; the cast was a medium-sized trout cast, and I had on my reel about forty to fifty yards of medium-sized trout-line. There is no doubt that I should have several times lost the fish had it not been for the extraordinary skill and speed with which Sandy followed him and managed the boat. Three times nearly all my line was taken out, and once I had only a few inches left on my reel. After his first rush the fish plunged deep down, and for a time adopted boring tactics. I was able to recover most of the line he had taken out, and then he made another run and a jump, and for some time after that we followed him over the loch. On two occasions he made the most determined efforts to get into some weeds, and it was only by keeping a very severe strain upon him that I managed to keep clear of them. I never played a fish which jumped so many times or sulked less. On one occasion, after taking a large amount of my line, he suddenly turned and headed straight back again for the boat, and although Sandy did all he could to keep out of his way, the fish startled us at the end of his mad run by jumping suddenly clean out of the water within three or four yards of the boat, and falling with a tremendous splash.
  • 38. Do what I could I did not seem to have any real effect on the fish, who seemed to do almost exactly as he liked with me, except on the two occasions when he tried to get into the weeds, when, expecting every minute that we might part company, I was determined, whatever happened, that he should come where I wished him to come. We saw that the fish had taken the bob fly, and this added to my apprehensions, as I was afraid, particularly as I knew the loch was not deep, that the tail fly would catch in something at the bottom of the loch, and there would then be a catastrophe. Time wore on, and my back and arms began to ache most prodigiously. Still the fish seemed as strong as ever. My brother said he must have some lunch, and whenever Sandy and I got the chance we managed to eat some sandwiches. I began to wonder how much longer the fly would hold, and whether this fish would prove to be one more of the many good fish lost through the fly working out at the end of a long fight. I could do nothing except hold on for all I was worth, keeping as tight a line as I could, and, of course, lowering the point of the rod whenever the fish jumped, as he frequently did. As time went on, however, the rushes made by the fish were not so long, and he seemed, at last, to have abandoned his leaping tactics, which had given me so much anxiety in the earlier stages of the struggle. The fish was gradually becoming exhausted, and the strain on the rod and line seemed to be much greater. “He’ll be turning soon, I’m thinking,” said Sandy. The end, one way or the other, could surely not be far off now, and we discussed the question whether or not we should try to land, but, on the whole, we thought we had better not run the risk of getting into very shallow water. At last the fish turned on his side, though he quickly righted himself and made another short run. Sandy had got the boat in about three feet of water, a few yards from the bank; he handed the oars to my brother, seized the gaff, and got out of the boat. I slowly reeled in my line; there was another short rush from the fish, and again I reeled him up. Nearer and nearer he came to the boat, and again turned on his
  • 39. side. Suddenly, in less time than it takes to tell, Sandy had the gaff into him, and was struggling to the shore. Safely landed, the fish was speedily given his coup de grâce. He was a very red male fish, weighing rather over 10¼ lb., and I had hooked him in the hard part of his upper jaw, which accounted partly for the fact that I had so little power over him, and also for the fact that the hook had kept its hold so well. “Now then, Sandy,” I said, as I got out my flask, “if any man ever deserved a drop of good whisky, you do.” “Shlàinte” (Gaelic for “Your good health”), said Sandy. “It was a grand fight, sir; I’ve never seen a better.” “How long do you think you were playing him?” said my brother. “Somewhere about an hour, I should think,” I replied. “Four hours and six minutes,” he said. “I looked at my watch when you hooked him, and it was then just a minute or two before half-past one; and I looked at my watch when Sandy gaffed him—it was then twenty-five minutes to six. I counted the number of times the fish jumped, and it was seventeen. I don’t suppose you noticed it,” he added, “but there was a cart going off with peats, near the loch, soon after you began to play the fish, and it came back again not long ago.” We heard afterwards that the men in the cart thought I was playing another fish when they passed us on their return journey. The light was going as we pushed the boat out again. I handed the salmon rod to my brother, and he began to fish from the stern of the boat, while I fished again from the bow with the trout rod. Sandy allowed the boat to drift slowly along the edge of some weeds. I do not think that I had more than three or four casts when, just as I was nearing the end of my cast, a salmon, which looked as bright as silver, and about the same size as the one we had just killed, rose at my tail fly, with a head and tail rise as if it meant business; and, as it turned to go down, I felt the hook go home. The fish did not run, but worked about near the surface of the water, close to the weeds, as if it did not realise that it was hooked at all. “Back the boat quickly, sir,” said Sandy, handing the oars to my brother, and seizing the gaff. My brother took the oars and backed the boat quickly in the direction of the fish. I reeled up my line;
  • 40. there was a momentary vision of about three-quarters of Sandy leaning out of the boat, a tremendously quick lightning-like movement of the gaff, and the salmon, gaffed with extraordinary skill behind the shoulder, was in the boat. I do not think that more than four minutes could possibly have elapsed from the time that I hooked the fish to the time it was in the boat. It was a beautiful, clean-run female fish, with a small head, and in perfect condition. It was very lightly hooked, and if it had run or jumped at all it would almost certainly have got off. It weighed within a few ounces of the weight of the fish which had given me such a tremendous battle, and yet, owing to the extraordinary skill of Sandy with the gaff, and the speed with which my brother had acted, this fish occupied us only as many minutes as the other one had hours! We continued to fish for a short time, but it became dark so rapidly that very soon we had to stop, and without a further rise of any kind.
  • 41. X THE HOMING INSTINCTS OF WOUNDED DEER In these days one hears so much of the homing instincts of animals and birds that the two following authentic instances of deer, whose habits are not so generally known as those of some other animals, may be of interest. Stalkers, and those who know the habits of the red-deer, know well that a stag when wounded will seek what he knows from experience to be a haven of safety. Thus, if he has come in the rutting season from his native forest and is wounded on other ground, he will assuredly make for the sanctuary in that forest. So,
  • 42. too, if he has been born and reared in a particular part of the forest and has come to regard that place as his home, he will struggle to reach it if wounded. One interesting illustration of this has come within my own experience, and another was related to me by the stalker who was with me on the occasion referred to. I was stalking in a forest upon part of which unusual conditions prevailed. That part which was nearest to the lodge was enclosed by a deer fence, but, owing to careful management, and the introduction from time to time of fresh stock, there are some very good heads in this part of the forest. I always prefer, however, when I have the chance, to stalk on the open ground outside the fence, although it means harder work, as it is the far beat and part of it is on very high and precipitous ground. It has, however, this great fascination—that one never knows what sort of stag one may find there. The forest itself is an exceptionally good one, and marches with several of the finest forests in the Highlands.
  • 43. THE SANCTUARY, KINLOCHEWE FOREST. By Finlay Mackinnon. On the day in question I was on the far beat and secured a good stag after an exciting stalk. After seeing the stag safely put on the pony in charge of the gillie, the stalker and I set off towards the farther end of the beat in the hope of getting a second stag. Not far from the march, on precipitous ground covered with rough boulders of rock, we spied a good stag with a large number of hinds. The deer were in an awkward position, and we found that it was impossible to get nearer to them than about 200 yards. The day was getting late, therefore this was probably our only chance. The stag was moving about and might very soon be over the march, so that there was no time to be lost. Getting quickly into the best position I
  • 44. could, I fired, and evidently hit the stag very hard. Directly I fired the deer disappeared as if by magic. The stalker said he was quite certain the stag could not go far. On reaching the spot on which the stag had been standing when I fired we found marks of blood, and had no difficulty in following these for some 50 yards, by which time we were close to the march, and in full view of a large corrie and other ground, all of which was in the neighbouring forest. We saw what were evidently some of the hinds making off across the march, but the stag and the rest of the hinds were nowhere to be seen. We moved a little farther on where we could get a view of other ground, when suddenly there was a tremendous clatter of loose stones, and we saw the stag and some twenty hinds about 120 yards from us. The deer stopped for a few seconds, the stag looking straight at us, and then away they went. We ran quickly to the point where they had disappeared, and saw the hinds we had last seen with the stag going in the direction which the other hinds had previously taken, but the stag was not with them. “He cannot go far,” said the stalker. The ground was very much broken up by large stones and boulders, and we both thought that the stag must be lying hidden not far from us. We were quite certain from the position we were in that we could not have failed to see him unless he had turned back below the hill and gone into the forest from which we had come. We noticed the hinds stopping every now and then and looking back, as they so often do when one of their number has been wounded and is behind them. By following the marks of blood on the stones we traced the course the stag had taken for about 200 yards, but after that we lost the tracks. We made the most careful search, and the stalker went some distance into the adjoining forest, but all in vain. The light was beginning to go, and at last we decided to give up the search, for that day at any rate. The stalker, who had had his glass on the stag when I had fired at him, said he was quite sure from what he saw then and from the way that the stag was bleeding that he had been mortally wounded and could not live long. I felt very much depressed, for if there is one thing that distresses me more than another it is to leave a wounded stag on the ground; and though I thought that the stalker with his experience was right in
  • 45. thinking that the stag could not live long, particularly as I knew my rifle and felt sure that I must have hit the stag somewhere not far from the heart, the fact remained that one could not be quite sure what had really happened. This was the last day of the season, and I was leaving on the following morning. The stalker promised me that he would search the ground on the following day, and that he would also tell the stalkers in the neighbouring forest, and that if he heard anything of the stag he would let me know. “I shall certainly know the head if it is ever found,” he said, “for when the stag looked straight at me I could see the space between his forks at the top. It was a ten-pointer, I think; the points were very regular, but as far as the head goes it is not much to grieve over, for it was on the narrow side.” “Still, it is a bad business,” I replied. “If we only had had a tracker we should certainly have got him without any trouble.” A really reliable tracker is indeed invaluable on an occasion of this kind, but it is only in a few forests that dogs are now used in following wounded stags. The noble deer-hounds which were the trusty allies of our fathers on the hill have during the last forty or fifty years been replaced in those forests where dogs are still used by the golden retriever, or more often by the collie, the two dogs last mentioned having been found more suitable for pursuing wounded deer. The deer-hound was so high-couraged that he would not bay the stag, but would pull him down or be killed by him. A further objection was that he would hunt by sight rather than by scent, it not being in his nature to put his nose to the ground, and it was therefore practically impossible to train him as a tracker.
  • 46. “THE TRUSTY ALLIES OF OUR FATHERS ON THE HILL.” From the Picture “After a Hard Day” by Philip Stretton. By permission of Messrs. Landeker Brown, Ltd. London, E.C.2, Publishers of the large engraving. I heard no more of the wounded stag until the following season, when I once more found myself in the same forest. I asked the stalker whether he had any news of the stag. He said: “That is a question. The stalkers in the other forest never found any stag, but a very curious thing has happened. About 20 yards inside the fence, at the nearest point in that part of the forest which is fenced in from where you shot the stag, that would be about a distance of three miles, the skeleton of a stag was found last April. The head stalker on that part of the forest tells me he is quite sure it was not a stag that was shot inside the fence. I have got the head here, and will
  • 47. show it to you.” I examined it carefully. It was a good regular head of ten points, with remarkably long forks at the top, and I thought it looked a better head than that of the stag I had shot, and said so to the stalker. He replied: “It is the same shape, and I well remember noticing the space between the forks at the top. Not only that, but in April when we found him there were no stags on that part of the ground and had not been for some time; also by the bleached condition of the horns, I am quite sure he must have died in October or early in November, and he could not have died a natural death after the winter was over. And as to his getting through the fence, at that season of the year stags have a wonderful way of getting through a fence if they want to do so. If he was mortally wounded after he got outside he would be sure to go back to the place where he was born and knew he was safe, and depend upon it he would find his way back through the fence where he got out. One can never be sure, but on the whole I think he is the stag you shot. You see the only way he could have gone that day without our seeing him was out of sight round that hill in the direction of the fenced-in part of the forest. I am sure he was mortally wounded, he had seen us; and after seeing us, being wounded, he would go straight on, as you know, so long as his strength would carry him and he would go straight to his old home. They’re wonderful in that way, deer are: I shall never forget how I was taught that years ago when I was out with the young chief at X.” I asked the stalker to tell me the story, which I give in his own words: “About twelve years ago, when I was a gillie at X, I was out one day with the chief’s son late on in the season, about the end of the first week in October. About 2 o’clock in the afternoon we saw a Royal stag and some hinds above the black shed, between the lodge and the second stalker’s house, and after a successful stalk, he fired but wounded the stag, just grazing him in the lower part of the body. The stag did not give the rifle another chance, but turned his head fair south, towards the top of the C——. We watched him crossing the top, then we made for where we saw him crossing, and we saw him about 300 yards away as he was going down the
  • 48. opposite side, and he was still going south, then getting out of view, into a hollow. The stalker did not lose his chance, but made a sprint to get up to him, which he managed to do, but the wily fellow was always keeping his back to his enemy, and making fast for some private corner, where he hoped he would be safe. The trigger was not pulled for him. Being in plain ground there, and the Royal stag fast on the move, we could do nothing but wait and watch where he would cross the next ridge, which was fully a mile away. Once the stalker saw him cross, we made at once for the spot he went out of our view, getting there as soon as our legs could carry us, and after spying that part of the ground very carefully, we failed to pick him up. That was in the centre of the Glashan, a piece of ground about 1½ miles square, very level, with shallow peat bags, and guarded on three sides with slightly rising ridges. The distance between where the stag was wounded and where we lost him was about seven miles. By this time the light was failing, so we had to make tracks for home. One evening, a few days later, when it was beginning to get dark, the head stalker was out about the larder, and noticing a stag with some hinds above the lodge, and putting his glass on him, at once knew the stag he had the run after a few days before. I was just after getting home from the hill, and he ordered me to go and shoot him. The rifle I never fired before, and the sight although marked for 100 yards I afterwards found to be a 70 yards sight. I got to about 100 yards from the stag, but having the evening light, and being among juniper bushes, I had to shoot off my hand, and missed him. There was no other chance that evening, as the light was getting bad. Two or three days after, about 10 o’clock in the morning, I was going along to the E—— Bothy, about a mile from the lodge, when I saw about twenty hinds and a stag amongst them, and after putting the glass on him, I knew it was the same stag. I at once went back to tell the head stalker, but finding him not at home, I took the rifle. I got to about 120 yards of the stag, but shooting too low, I grazed his foreleg below the heart; he did not give me another chance then, but left the hinds and turned to the south across the top. When I got to the top I noticed him about half a mile from me; keeping him in view he went for about two miles
  • 49. south, then turning south-west I kept him in view for three miles, then lost sight of him, but I could understand by the movements of some hinds the line he was taking. I made for the place where I lost sight of him, but having got there I could see nothing. I followed up the burn that rises at Cairn-an-S——, and after getting half-way up the burn, I came out to the open to spy. I was spying for some time, and was putting my glass in its case when I noticed a black object about half a mile away, about the size of a blackcock. I used my glass, and who was this but the Royal lying in the centre of the Glashan, on quite level ground. He was lying down licking the scratch where I wounded him earlier in the day. With great difficulty and after a long crawl I got to about 70 yards of him, and shot him through the neck. That was a lucky range, as the rifle was sighted for 70 yards. I was in an awful mess through crawling in burns and gutters after him, but I was very keen on getting him, and as an old chap once said to me, ‘When you have a difficult thing to do you must not be minding your clothes.’ Well, I was pleased I got him as I was sure he could not live very long. I considered what to do; my first idea was to put him in some safe place, and come for him next day, so I took him to a burnside into a hollow and hid him, but before doing so I put a small chack with my knife above his brow antler, to know him if ever I saw him again, as I did not know who might be looking at me. I was in doubt whether I would take his head off or leave it there all night. I at once changed my mind, as it was so good a head I did not like leaving him out there all night. I cut his head off, giving him a long neck for being stuffed. That finished, I shouldered the Royal head, took him back five miles to the E—— Bothy, left him there that night, and took it two miles further to the lodge the next day, and to-day it hangs in the chief’s mansion. The young chief was very glad to get it. The head was a very good Royal, thick horns, points equal and well-shaped. The distance between the place where I shot him through the neck and the place we lost him the day the young chief wounded him is hardly half a mile apart. That day the stag was first wounded, he went whatever a distance of six or seven miles to that quiet spot in the centre of the Glashan. The day I shot him through the neck I
  • 50. followed him for about eight miles from the place where I grazed his foreleg below the heart. He never saw me, he never stopped, always making for that private spot, the place in the centre of the Glashan. So this stag went two times to that same place, as he hoped he would be safe there, and possibly that stag might have been lying in the same bed both nights.” This shows the distance a stag will go for safety, and that he goes back to his old home, the spot where he thinks he is safe. And so I believe that my friend the stalker must have been right in thinking that the stag he had found in April was the stag I had shot in the early days of the preceding October. “I WAS SPYING FOR SOME TIME.” From a Photograph by the Author.
  • 51. XI THE METHOD BY WHICH EAGLES AND HAWKS SECURE THEIR PREY As is well known, the eagle lives largely on carrion such as dead deer and carcases of sheep, differing in this respect from the peregrine falcon, which lives exclusively on what it kills. Generally speaking, the eagle secures its prey by pouncing on it on the ground and carrying it away in its talons. He swoops down at a great pace in a slanting direction, and in this way not only captures hares and rabbits, but also grouse and ptarmigan on the ground and young ducks on the loch. It is very interesting to watch the great bird
  • 52. searching slowly along the side of a hill, about 50, 100, or 150 yards above the ground; then he suddenly pounces, and in a moment is up again and away with his prey in his talons. So regularly does the eagle adopt this method of capturing his prey on the ground, that I have met stalkers who have told me that they do not believe that an eagle can overtake any swift-winged bird such as grouse or black game. This is certainly wrong, for the eagle does sometimes, though comparatively rarely, adopt the other method of securing his prey— the method which I have already described (see p. 64, supra)—that of pursuing and catching his prey in the air, and in this way without doubt captures blackcock, grouse, and ptarmigan. I have already stated (see pp. 57-70, supra) that in my opinion the eagle in his downward flight is faster than the peregrine. Even in his horizontal flight, once he gets going he can fly very fast if he chooses, but of course is not nearly so agile and cannot turn and twist with the rapidity of the peregrine, and the result is that when he overtakes his quarry he frequently misses him. Nearly a hundred years ago one of the most acute observers amongst ornithologists wrote as follows: “In another part of the Western Highlands of Scotland we had an opportunity of witnessing the powers of flight of this bird in pursuit of its quarry. An old blackcock was sprung and was instantly pursued by the eagle (who must have been on a neighbouring rock unperceived) across the glen, the breadth of which was at least 2 miles. “The eagle made several unsuccessful pounces, but as there was no cover and the bird large, it probably fell a victim in the end.”[28] Lastly, as I have already said in the pages just mentioned where I have fully discussed the matter, the eagle on rare occasions swoops down at a terrific pace on his prey in the air, striking it to the ground but not clutching it or, to use the falconer’s phrase, binding on it. The eagle has a great partiality for hares, cats, young fox cubs, and young lambs. I remember James Macintosh, head stalker at Loch Rosque, telling me that on two occasions whilst waiting at a fox den he had shot an eagle. He added that, whilst the old foxes are
  • 53. away, the cubs, when they get hungry, sometimes make such a noise that they can be heard at a considerable distance, and that he believed this attracts the eagles, particularly if their eyrie in which they are rearing their young happens to be in the vicinity. He went on to say that he thought this accounted for his sometimes finding fox dens containing only one or two cubs instead of the usual number of three to seven. There is no doubt that eagles sometimes attack deer calves, fixing their talons in their victim’s neck or back and striking the calf with their wings. They frequently hunt in pairs, and have been seen to drive the calf over a precipice. On rare occasions eagles have been known to attack a full-grown stag. In certain parts of the Highlands they have lately increased in numbers, and perhaps as a consequence, their ordinary food not being so plentiful, have become bolder. Only last year I was stalking in a forest where a few days earlier a stalker had witnessed a most unusual incident. The following is his account of what he saw: “A gentleman and I were out stalking on the 25th of September, and while the gentleman was having lunch, I went off about 200 yards to have a spy. I got a stag lying at the foot of a rock. While I had the glass on him, an eagle suddenly swooped down and attacked him. The stag went headlong into a bog, but managed to get up. I then ran back for the gentleman thinking we would have a shot, but by the time we got back the stag and eagle were over the sky-line and the eagle still following while going over the sky-line, but after that we don’t know what happened, as both eagle and stag went out of sight.” Donald Matheson, who has had a lifelong experience in the forest and has only recently retired after having been for many years stalker at Glen Shieldaig to Mr. C. J. Murray of Loch Carron, told me that on one occasion, but on one occasion only, he saw an eagle attack an adult stag.
  • 54. “It would be, as far as I remember,” he said, “between the 6th and 10th of October in the year 1888 when I was spying one morning at the forest stables. I picked up a stag on the top of Glen Shieldaig, quietly feeding on the Glaschnoc side, and while having my glass still on the stag an eagle swooped down on his head. The stag fell on his hind-quarters, but was soon on his feet again and ran for his life while the eagle was fixed on him. The stag made for a thick clump of birch-trees, and immediately the stag got under cover the eagle could not keep its hold, owing to the thick branches of the trees, and left the stag. The eagle kept hovering for some time above the wood where the stag was concealed, but at last flew away.” Whilst stalking in the neighbouring forest of Applecross two years ago, Colonel the Hon. Claude Willoughby had a most interesting experience, a description of which he has kindly given me permission to reproduce here: “On 30th September, 1921,” he writes, “I was stalking with Alick Mackenzie on Applecross. We had come through Corrie Chaorachan into Corrie Na Na and spied a stag with hinds on the west face above the loch. The wind was west, and after a difficult and exceedingly good stalk across the Corrie and above these deer, avoiding hinds, also another stag with hinds, we arrived at a point within 150 yards of the stag we were after and found him lying down. Owing to the light and the distance, I determined to wait for him to rise before shooting. After waiting half an hour, hinds which we had seen beyond the place where he was lying came galloping past him. He rose and I shot him; he fell dead. We at once saw that the reason of these hinds galloping was that an eagle was after a calf which had separated from the herd. We saw the eagle land on the calf’s back twice, but the calf escaped. “The eagle then attacked a hind in the herd. A kestrel hawk now joined in, and mobbed the eagle. This attack lasted only a short time. The eagle then circled round my dead stag, the kestrel soon after disappearing. The eagle settled on a rock about five yards from
  • 55. the dead stag, and remained there until we showed ourselves. All this took place within 200 yards of us. “On the Tuesday following Lord Derwent was also stalking on Applecross, near Corrie Attadale. He and the head stalker Finlayson saw an eagle attack a calf, which it knocked down twice, but the calf escaped.” THE APPLECROSS HILLS, AND A HIGHLAND FISHING VILLAGE. By Finlay Mackinnon. There has been much difference of opinion, and from time to time considerable controversy as to how the peregrine kills its prey. Some stalkers and ornithologists believe that it is done with the edge of the wing, a smaller number with the beak, whilst others think it is done with the talons. The last-mentioned view is that which is, I believe, universally held by falconers, who after all have many more
  • 56. opportunities of seeing how it is done than any other class of men. I have frequently discussed this question with naturalists and stalkers, keepers and others interested in this subject, and have listened to all they could tell me. I have also had the great advantage of hearing at first hand from falconers of experience their views and their reasons for them. Further, I have myself been so fortunate as to see the wild peregrine pursue and stoop at its quarry. I have seen it strike and kill it and on occasion miss it. In addition to this, I have read everything I could find on this subject, both in the older and more modern books of authority. I am satisfied myself that the view held by the falconers is the true one, and I cannot state their conclusions better than, or indeed so well as, by quoting from three letters that I have received. The writers of these three letters have kindly given me permission to quote their Views. Major C. E. Radclyffe, who has had almost unrivalled experience as a falconer, writes as follows: “All forms of falcons and short-winged hawks, such as sparrow- hawks and goshawks, always strike their quarry with their feet, and never with anything else. The killers are those which ‘bind to’ their quarry in the air, that is, pick up a bird in their feet, and never let go of it until they come to the ground. A really experienced old trained falcon does this nine times out of ten. “Sometimes, however, when stooping from a great height, the impetus of the falcon is so terrific that she seems to know if she ‘binds to’ her quarry, the impact will be so great as nearly to tear her legs from her body. Thus, when stooping at a heavy bird like a grouse, or a pheasant, at great speed, the falcon slightly throws upwards on her impact with the quarry, and delivers a raking blow with her single long back talon. By this means (her back talon being sharp as a razor) I have seen a grouse ripped open from its tail to its neck. I have seen its wing broken and I have seen its head cut off.
  • 57. “All falcons are very careful not to risk touching anything with their wings, hence a falcon will never really stoop at a bird on the ground with an idea of catching it, but they will keep stooping just over a bird they can see on the ground in the hope of flushing it, and then they will catch it in a minute. “I have seen falcons and hawks break their wings by striking the smallest twig on the branch of a tree when misjudging a stoop at a bird. “Therefore, you can imagine how easily a hawk would smash its wing if it attempted this, to hit a heavy bird like a grouse or pheasant going at terrific speed. “If you threw a lawn-tennis ball against a falcon’s wing coming at you at the rate of over a hundred miles per hour, and hit its wing- bone, that hawk would never fly again. “I have many times in my life, when casting lightly with a very small trout rod, just touched the wing of a swift or swallow with the tip of the rod. I never broke a rod thus, but nearly always broke the bird’s wing. I think, when you come to consider these things, you will see that a hawk dare not strike the smallest bird with its wing. “It uses its beak only to finish off a bird on the ground, and this she does by breaking the bird’s neck with its beak. “I have lived amongst wild and trained hawks all my life, and I can assure you the above facts are true.” The reference in the above letter to the peregrine killing a grouse by striking it with its talon reminds me of the following interesting note in Birds of Great Britain (5 volumes), published by the author, John Gould, F.R.S., in 1873. “Evidence forwarded to Mr. James Burdett, keeper to the Earl of Craven.... On dissecting a coot I saw taken and dropped by a peregrine falcon, I found the neck dislocated at the third joint from
  • 58. the head and an appearance as if the sharp point of the hind claw had penetrated the brain at the occiput.” Captain C. F. A. Portal, D.S.O., writes as follows: “I have seen many dozens of game-birds struck down by trained peregrines within 50 yards of me, and I can definitely state that the hawk invariably aims a blow with the talons at his quarry.... “So true is a peregrine’s aim that he generally gets home with both his hind talons somewhere near the middle of the quarry’s back, but often he hits a wing and breaks it, and occasionally he breaks the neck in the same way. I have examined hundreds of birds (partridges) killed by hawks, and I have always found the mark of two hind talons or one of them. The decapitation is generally performed within a few seconds of the hawk’s alighting on the dazed or crippled victim. It is performed by one powerful wrench of the beak. No peregrine will eat or even pluck a living bird.... In my experience it is a rare thing for a peregrine to strike a bird dead in the air. It does occasionally happen that the blow falls on the head or neck, but what generally happens is that the bird is thrown violently to the ground with a wing broken or the back dislocated. The concussion with the ground dazes it, and the hawk quickly drops down upon it and kills it with its beak. “The merlin often kills comparatively large birds (e.g. the thrush, fieldfare, golden plover, etc.) by strangling them, as its beak is not strong enough to break their necks. It kills larks, etc., in the same way as the peregrine kills his quarry, that is, by sudden dislocation of the neck. “The sparrow-hawk kills its prey by gripping it with its feet and driving the claws into its body; this is a slow death sometimes, and the sparrow-hawk has none of the true falcon’s scruples about plucking (and even, I fear, beginning to devour) a living bird. “I do not like the sparrow-hawk for this reason, though, of course, the falconer can generally prevent cruelty by killing the quarry himself.”
  • 59. Captain G. S. Blaine, another falconer of great experience, also has no doubt on the matter. In a letter to me on this question he writes: “A peregrine strikes with its talons only. Of this I am certain, having seen the blow given to countless quarries at close quarters. How the other idea (that of striking with the wing) could possibly have originated I do not know. It is quite obviously impracticable.... If a peregrine administered the terrific blow which she delivers when striking a quarry with her wing, breast, or beak, she would be knocked out at once, and permanently injured. A peregrine can easily, after recovering from her stoop, turn over again and catch the quarry in the air. I have seen this often done, when the bird had been struck high up in the air. If near the ground, it would fall before the hawk could get hold of it. Many also often catch and hold a quarry without knocking it down. This is the way most successful game hawks catch grouse or partridges. When struck, the blow is delivered on any part of the body—it may be the head and it may be the back or the wing which may be broken.”
  • 60. Welcome to our website – the ideal destination for book lovers and knowledge seekers. With a mission to inspire endlessly, we offer a vast collection of books, ranging from classic literary works to specialized publications, self-development books, and children's literature. Each book is a new journey of discovery, expanding knowledge and enriching the soul of the reade Our website is not just a platform for buying books, but a bridge connecting readers to the timeless values of culture and wisdom. With an elegant, user-friendly interface and an intelligent search system, we are committed to providing a quick and convenient shopping experience. Additionally, our special promotions and home delivery services ensure that you save time and fully enjoy the joy of reading. Let us accompany you on the journey of exploring knowledge and personal growth! ebookfinal.com