0% found this document useful (0 votes)
4 views

Clojure Data Analysis Cookbook 2nd Edition Eric Rochester download

The 'Clojure Data Analysis Cookbook, 2nd Edition' by Eric Rochester provides over 100 practical recipes for data analysis using Clojure, covering various stages of data collection and processing. The book includes chapters on importing, cleaning, and analyzing data, as well as advanced topics like concurrent programming and distributed data processing. It is published by Packt Publishing and is available in multiple digital formats.

Uploaded by

tomahkarshvb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Clojure Data Analysis Cookbook 2nd Edition Eric Rochester download

The 'Clojure Data Analysis Cookbook, 2nd Edition' by Eric Rochester provides over 100 practical recipes for data analysis using Clojure, covering various stages of data collection and processing. The book includes chapters on importing, cleaning, and analyzing data, as well as advanced topics like concurrent programming and distributed data processing. It is published by Packt Publishing and is available in multiple digital formats.

Uploaded by

tomahkarshvb
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 58

Clojure Data Analysis Cookbook 2nd Edition Eric

Rochester pdf download

https://ebookname.com/product/clojure-data-analysis-cookbook-2nd-
edition-eric-rochester/

Get Instant Ebook Downloads – Browse at https://ebookname.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Clojure Data Analysis Cookbook 1st Edition Eric


Rochester

https://ebookname.com/product/clojure-data-analysis-cookbook-1st-
edition-eric-rochester/

Clojure Data Structures and Algorithms Cookbook 25


recipes to deeply understand and implement advanced
algorithms in Clojure 1st Edition Rafik Naccache

https://ebookname.com/product/clojure-data-structures-and-
algorithms-cookbook-25-recipes-to-deeply-understand-and-
implement-advanced-algorithms-in-clojure-1st-edition-rafik-
naccache/

Haskell Data Analysis Cookbook 1st Edition Nishant


Shukla

https://ebookname.com/product/haskell-data-analysis-cookbook-1st-
edition-nishant-shukla/

Oral Microbiology and Immunology 2nd Edition Richard J.


Lamont

https://ebookname.com/product/oral-microbiology-and-
immunology-2nd-edition-richard-j-lamont/
Alcohol No Ordinary Commodity Research and Public
Policy 2nd Edition Thomas F. Babor

https://ebookname.com/product/alcohol-no-ordinary-commodity-
research-and-public-policy-2nd-edition-thomas-f-babor/

Tresch and Aronow s Cardiovascular Disease in the


Elderly 5th Edition Wilbert S. Aronow (Editor)

https://ebookname.com/product/tresch-and-aronow-s-cardiovascular-
disease-in-the-elderly-5th-edition-wilbert-s-aronow-editor/

The Norton Anthology of English Literature The Romantic


Period Vol D 10th Edition Stephen Greenblatt

https://ebookname.com/product/the-norton-anthology-of-english-
literature-the-romantic-period-vol-d-10th-edition-stephen-
greenblatt/

The Bomb A Life 48940th Edition Gerard J. De Groot

https://ebookname.com/product/the-bomb-a-life-48940th-edition-
gerard-j-de-groot/

Fundamentals of project management developing core


competencies to help outperform the competition 2nd ed
Edition James P. Lewis

https://ebookname.com/product/fundamentals-of-project-management-
developing-core-competencies-to-help-outperform-the-
competition-2nd-ed-edition-james-p-lewis/
Air Plants Epiphytes and Aerial Gardens 1st Edition
David H. Benzing

https://ebookname.com/product/air-plants-epiphytes-and-aerial-
gardens-1st-edition-david-h-benzing/
Clojure Data Analysis
Cookbook
Second Edition

Dive into data analysis with Clojure through over 100


practical recipes for every stage of the analysis and
collection process

Eric Rochester

BIRMINGHAM - MUMBAI
Clojure Data Analysis Cookbook
Second Edition

Copyright © 2015 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, nor Packt Publishing, and its dealers
and 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 of 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: March 2013

Second edition: January 2015

Production reference: 1220115

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham B3 2PB, UK.

ISBN 978-1-78439-029-7

www.packtpub.com
Credits

Author Project Coordinator


Eric Rochester Neha Thakur

Reviewers Proofreaders
Vitomir Kovanovic Ameesha Green
Muktabh Mayank Srivastava Joel T. Johnson
Federico Tomassetti Samantha Lyon

Commissioning Editor Indexer


Ashwin Nair Priya Sane

Acquisition Editor Graphics


Sam Wood Sheetal Aute
Disha Haria
Content Development Editor
Parita Khedekar Production Coordinator
Nitesh Thakur
Technical Editor
Ryan Kochery Cover Work
Nitesh Thakur
Copy Editors
Dipti Kapadia
Puja Lalwani
Vikrant Phadke
About the Author

Eric Rochester enjoys reading, writing, and spending time with his wife and kids. When
he’s not doing these things, he programs in a variety of languages and platforms, including
websites and systems in Python, and libraries for linguistics and statistics in C#. Currently,
he is exploring functional programming languages, including Clojure and Haskell. He works
at Scholars’ Lab in the library at the University of Virginia, helping humanities professors and
graduate students realize their digitally informed research agendas. He is also the author of
Mastering Clojure Data Analysis, Packt Publishing.

I’d like to thank everyone. My technical reviewers proved invaluable.


Also, thank you to the editorial staff at Packt Publishing. This book is
much stronger because of all of their feedback, and any remaining
deficiencies are mine alone.

A special thanks to Jackie, Melina, and Micah. They’ve been patient and
supportive while I worked on this project. It is, in every way, for them.
About the Reviewers

Vitomir Kovanovic is a PhD student at the School of Informatics, University of Edinburgh,


Edinburgh, UK. He received an MSc degree in computer science and software engineering
in 2011, and BSc in information systems and business administration in 2009 from the
University of Belgrade, Serbia. His research interests include learning analytics, educational
data mining, and online education. He is a member of the Society for Learning Analytics
Research and a member of program committees of several conferences and journals in
technology-enhanced learning. In his PhD research, he focuses on the use of trace data for
understanding the effects of technology use on the quality of the social learning process and
learning outcomes. For more information, visit http://vitomir.kovanovic.info/

Muktabh Mayank Srivastava is a data scientist and the cofounder of ParallelDots.com.


Previously, he helped in solving many complex data analysis and machine learning problems
for clients from different domains such as healthcare, retail, procurement, automation,
Bitcoin, social recommendation engines, geolocation fact-finding, customer profiling,
and so on.

His new venture is ParallelDots. It is a tool that allows any content archive to be presented
in a story using advanced techniques of NLP and machine learning. For publishers and
bloggers, it automatically creates a timeline of any event using their archive and presents
it in an interactive, intuitive, and easy-to-navigate interface on their webpage. You can find
him on LinkedIn at http://in.linkedin.com/in/muktabh/ and on Twitter at
@muktabh / @ParallelDots.
Federico Tomassetti has been programming since he was a child and has a PhD
in software engineering. He works as a consultant on model-driven development and
domain-specific languages, writes technical articles, teaches programming, and works as
a full-stack software engineer.

He has experience working in Italy, Germany, and Ireland, and he is currently working
at Groupon International.

You can read about his projects on http://federico-tomassetti.it/ or


https://github.com/ftomassetti/.
www.PacktPub.com

Support files, eBooks, discount offers, and more


For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub
files available? You can upgrade to the eBook version at www.PacktPub.com and as a print
book customer, you are entitled to a discount on the eBook copy. Get in touch with us at
service@packtpub.com for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up
for a range of free newsletters and receive exclusive discounts and offers on Packt books
and eBooks.
TM

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt’s online digital book
library. Here, you can search, access, and read Packt’s entire library of books.

Why subscribe?
f Fully searchable across every book published by Packt
f Copy and paste, print, and bookmark content
f On demand and accessible via a web browser

Free access for Packt account holders


If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view 9 entirely free books. Simply use your login credentials for
immediate access.
Table of Contents
Preface 1
Chapter 1: Importing Data for Analysis 7
Introduction 7
Creating a new project 8
Reading CSV data into Incanter datasets 9
Reading JSON data into Incanter datasets 12
Reading data from Excel with Incanter 14
Reading data from JDBC databases 15
Reading XML data into Incanter datasets 18
Scraping data from tables in web pages 21
Scraping textual data from web pages 25
Reading RDF data 29
Querying RDF data with SPARQL 33
Aggregating data from different formats 38
Chapter 2: Cleaning and Validating Data 45
Introduction 45
Cleaning data with regular expressions 46
Maintaining consistency with synonym maps 48
Identifying and removing duplicate data 50
Regularizing numbers 53
Calculating relative values 55
Parsing dates and times 57
Lazily processing very large data sets 59
Sampling from very large data sets 61
Fixing spelling errors 64
Parsing custom data formats 68
Validating data with Valip 70
Table of Contents

Chapter 3: Managing Complexity with Concurrent Programming 73


Introduction 74
Managing program complexity with STM 75
Managing program complexity with agents 79
Getting better performance with commute 82
Combining agents and STM 83
Maintaining consistency with ensure 85
Introducing safe side effects into the STM 88
Maintaining data consistency with validators 91
Monitoring processing with watchers 94
Debugging concurrent programs with watchers 96
Recovering from errors in agents 98
Managing large inputs with sized queues 100
Chapter 4: Improving Performance with Parallel Programming 101
Introduction 102
Parallelizing processing with pmap 102
Parallelizing processing with Incanter 106
Partitioning Monte Carlo simulations for better pmap performance 107
Finding the optimal partition size with simulated annealing 112
Combining function calls with reducers 116
Parallelizing with reducers 118
Generating online summary statistics for data streams with reducers 121
Using type hints 124
Benchmarking with Criterium 127
Chapter 5: Distributed Data Processing with Cascalog 131
Introduction 131
Initializing Cascalog and Hadoop for distributed processing 133
Querying data with Cascalog 137
Distributing data with Apache HDFS 138
Parsing CSV files with Cascalog 141
Executing complex queries with Cascalog 143
Aggregating data with Cascalog 146
Defining new Cascalog operators 148
Composing Cascalog queries 151
Transforming data with Cascalog 153

ii
Table of Contents

Chapter 6: Working with Incanter Datasets 155


Introduction 156
Loading Incanter's sample datasets 156
Loading Clojure data structures into datasets 157
Viewing datasets interactively with view 159
Converting datasets to matrices 161
Using infix formulas in Incanter 163
Selecting columns with $ 165
Selecting rows with $ 167
Filtering datasets with $where 169
Grouping data with $group-by 170
Saving datasets to CSV and JSON 172
Projecting from multiple datasets with $join 173
Chapter 7: Statistical Data Analysis with Incanter 177
Introduction 177
Generating summary statistics with $rollup 178
Working with changes in values 180
Scaling variables to simplify variable relationships 182
Working with time series data with Incanter Zoo 184
Smoothing variables to decrease variation 186
Validating sample statistics with bootstrapping 189
Modeling linear relationships 192
Modeling non-linear relationships 195
Modeling multinomial Bayesian distributions 199
Finding data errors with Benford's law 202
Chapter 8: Working with Mathematica and R 207
Introduction 207
Setting up Mathematica to talk to Clojuratica for Mac OS X and Linux 208
Setting up Mathematica to talk to Clojuratica for Windows 212
Calling Mathematica functions from Clojuratica 214
Sending matrixes to Mathematica from Clojuratica 215
Evaluating Mathematica scripts from Clojuratica 217
Creating functions from Mathematica 218
Setting up R to talk to Clojure 219
Calling R functions from Clojure 221
Passing vectors into R 222
Evaluating R files from Clojure 224
Plotting in R from Clojure 226

iii
Table of Contents

Chapter 9: Clustering, Classifying, and Working with Weka 229


Introduction 229
Loading CSV and ARFF files into Weka 230
Filtering, renaming, and deleting columns in Weka datasets 232
Discovering groups of data using K-Means clustering 235
Finding hierarchical clusters in Weka 241
Clustering with SOMs in Incanter 244
Classifying data with decision trees 246
Classifying data with the Naive Bayesian classifier 249
Classifying data with support vector machines 251
Finding associations in data with the Apriori algorithm 254
Chapter 10: Working with Unstructured and Textual Data 257
Introduction 258
Tokenizing text 258
Finding sentences 259
Focusing on content words with stoplists 260
Getting document frequencies 262
Scaling document frequencies by document size 264
Scaling document frequencies with TF-IDF 266
Finding people, places, and things with Named Entity Recognition 270
Mapping documents to a sparse vector space representation 272
Performing topic modeling with MALLET 274
Performing naïve Bayesian classification with MALLET 277
Chapter 11: Graphing in Incanter 281
Introduction 281
Creating scatter plots with Incanter 282
Graphing non-numeric data in bar charts 284
Creating histograms with Incanter 287
Creating function plots with Incanter 288
Adding equations to Incanter charts 290
Adding lines to scatter charts 292
Customizing charts with JFreeChart 293
Customizing chart colors and styles 296
Saving Incanter graphs to PNG 298
Using PCA to graph multi-dimensional data 299
Creating dynamic charts with Incanter 302

iv
Table of Contents

Chapter 12: Creating Charts for the Web 305


Introduction 305
Serving data with Ring and Compojure 306
Creating HTML with Hiccup 311
Setting up to use ClojureScript 313
Creating scatter plots with NVD3 317
Creating bar charts with NVD3 323
Creating histograms with NVD3 326
Creating time series charts with D3 329
Visualizing graphs with force-directed layouts 334
Creating interactive visualizations with D3 339
Index 345

v
Preface
Welcome to the second edition of Clojure Data Analysis Cookbook! It seems that books
become obsolete almost as quickly as software does, so here we have the opportunity to
keep things up-to-date and useful.

Moreover, the state of the art of data analysis is also still evolving and changing. The
techniques and technologies are being refined and improved. Hopefully, this book will capture
some of that. I've also added a new chapter on how to work with unstructured textual data.

In spite of these changes, some things have stayed the same. Clojure has further proven
itself to be an excellent environment to work with data. As a member of the lisp family of
languages, it inherits a flexibility and power that is hard to match. The concurrency and
parallelization features have further proven themselves as great tools for developing
software and analyzing data.

Clojure's usefulness for data analysis is further improved by a number of strong libraries.
Incanter provides a practical environment to work with data and perform statistical analysis.
Cascalog is an easy-to-use wrapper over Hadoop and Cascading. Finally, when you're ready
to publish your results, ClojureScript, an implementation of Clojure that generates JavaScript,
can help you to visualize your data in an effective and persuasive way.

Moreover, Clojure runs on the Java Virtual Machine (JVM), so any libraries written for Java are
available too. This gives Clojure an incredible amount of breadth and power.

I hope that this book will give you the tools and techniques you need to get answers from
your data.
Preface

What this book covers


Chapter 1, Importing Data for Analysis, covers how to read data from a variety of sources,
including CSV files, web pages, and linked semantic web data.

Chapter 2, Cleaning and Validating Data, presents strategies and implementations to


normalize dates, fix spelling, and work with large datasets. Getting data into a useable shape
is an important, but often overlooked, stage of data analysis.

Chapter 3, Managing Complexity with Concurrent Programming, covers Clojure's concurrency


features and how you can use them to simplify your programs.

Chapter 4, Improving Performance with Parallel Programming, covers how to use Clojure's
parallel processing capabilities to speed up the processing of data.

Chapter 5, Distributed Data Processing with Cascalog, covers how to use Cascalog as a
wrapper over Hadoop and the Cascading library to process large amounts of data distributed
over multiple computers.

Chapter 6, Working with Incanter Datasets, covers the basics of working with Incanter
datasets. Datasets are the core data structures used by Incanter, and understanding them is
necessary in order to use Incanter effectively.

Chapter 7, Statistical Data Analysis with Incanter, covers a variety of statistical processes and
tests used in data analysis. Some of these are quite simple, such as generating summary
statistics. Others are more complex, such as performing linear regressions and auditing data
with Benford's Law.

Chapter 8, Working with Mathematica and R, talks about how to set up Clojure in order to talk
to Mathematica or R. These are powerful data analysis systems, and we might want to use
them sometimes. This chapter will show you how to get these systems to work together, as
well as some tasks that you can perform once they are communicating.

Chapter 9, Clustering, Classifying, and Working with Weka, covers more advanced machine
learning techniques. In this chapter, we'll primarily use the Weka machine learning library.
Some recipes will discuss how to use it and the data structures its built on, while other recipes
will demonstrate machine learning algorithms.

Chapter 10, Working with Unstructured and Textual Data, looks at tools and techniques used
to extract information from the reams of unstructured, textual data.

Chapter 11, Graphing in Incanter, shows you how to generate graphs and other visualizations
in Incanter. These can be important for exploring and learning about your data and also for
publishing and presenting your results.

Chapter 12, Creating Charts for the Web, shows you how to set up a simple web application in
order to present findings from data analysis. It will include a number of recipes that leverage
the powerful D3 visualization library.
2
Preface

What you need for this book


One piece of software required for this book is the Java Development Kit (JDK), which you
can obtain from http://www.oracle.com/technetwork/java/javase/downloads/
index.html. JDK is necessary to run and develop on the Java platform.

The other major piece of software that you'll need is Leiningen 2, which you can download
and install from http://leiningen.org/. Leiningen 2 is a tool used to manage Clojure
projects and their dependencies. It has become the de facto standard project tool in the
Clojure community.

Throughout this book, we'll use a number of other Clojure and Java libraries, including Clojure
itself. Leiningen will take care of downloading these for us as we need them.

You'll also need a text editor or Integrated Development Environment (IDE). If you already have
a text editor of your choice, you can probably use it. See http://clojure.org/getting_
started for tips and plugins for using your particular favorite environment. If you don't have a
preference, I'd suggest that you take a look at using Eclipse with Counterclockwise. There are
instructions to this set up at https://code.google.com/p/counterclockwise/.

That is all that's required. However, at various places throughout the book, some recipes will
access other software. The recipes in Chapter 8, Working with Mathematica and R, that are
related to Mathematica will require Mathematica, obviously, and those that are related to R
will require that. However, these programs won't be used in the rest of the book, and whether
you're interested in those recipes might depend on whether you already have this software.

Who this book is for


This book is for programmers or data scientists who are familiar with Clojure and want to use
it in their data analysis processes. This isn't a tutorial on Clojure—there are already a number
of excellent introductory books out there—so you'll need to be familiar with the language,
but you don't need to be an expert.

Likewise, you don't have to be an expert on data analysis, although you should probably be
familiar with its tasks, processes, and techniques. While you might be able to glean enough
from these recipes to get started with, for it to be truly effective, you'll want to get a more
thorough introduction to this field.

3
Preface

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, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Now, there
will be a new subdirectory named getting-data.

A block of code is set as follows:


(defproject getting-data "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]])

When we wish to draw your attention to a particular part of a code block, the relevant lines or
items are set in bold:
(defn watch-debugging
[input-file]
(let [reader (agent
(seque
(mapcat
lazy-read-csv
input-files)))
caster (agent nil)
sink (agent [])
counter (ref 0)
done (ref false)]
(add-watch caster :counter
(partial watch-caster counter))
(add-watch caster :debug debug-watch)
(send reader read-row caster sink done)
(wait-for-it 250 done)
{:results @sink
:count-watcher @counter}))

Any command-line input or output is written as follows:


$ lein new getting-data
Generating a project called getting-data based on the default template.
To see other templates (app, lein plugin, etc), try lein help new.

4
Preface

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 the text like this: "Take a look at the
Hadoop website for the Getting Started documentation of your version. Get a single
node setup working".

Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

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 send an e-mail to feedback@packtpub.com, and


mention the book title via the subject of your message.

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


You can download the example code files for all Packt books you have purchased from
your account at http://www.packtpub.com. If you purchased this book elsewhere,
you can visit http://www.packtpub.com/support and register to have the files
e-mailed directly to you.

5
Preface

Downloading the color images of this book


We also provide you a PDF file that has color images of the screenshots/diagrams used in
this book. The color images will help you better understand the changes in the output. You
can download this file from: https://www.packtpub.com/sites/default/files/
downloads/B03480_coloredimages.pdf.

Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen.
If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be
grateful if you could report this to us. By doing so, you can save other readers from frustration
and help us improve subsequent versions of this book. If you find any errata, please report them
by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on
the Errata Submission Form link, and entering the details of your errata. Once your errata are
verified, your submission will be accepted and the errata will be uploaded to our website or
added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/


content/support and enter the name of the book in the search field. The required
information will appear under the Errata section.

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 website 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.

6
Importing Data for
1
Analysis
In this chapter, we will cover the following recipes:

f Creating a new project


f Reading CSV data into Incanter datasets
f Reading JSON data into Incanter datasets
f Reading data from Excel with Incanter
f Reading data from JDBC databases
f Reading XML data into Incanter datasets
f Scraping data from tables in web pages
f Scraping textual data from web pages
f Reading RDF data
f Querying RDF data with SPARQL
f Aggregating data from different formats

Introduction
There's not much data analysis that can be done without data, so the first step in any project
is to evaluate the data we have and the data that we need. Once we have some idea of what
we'll need, we have to figure out how to get it.
Importing Data for Analysis

Many of the recipes in this chapter and in this book use Incanter (http://incanter.org/)
to import the data and target Incanter datasets. Incanter is a library that is used for statistical
analysis and graphics in Clojure (similar to R) an open source language for statistical
computing (http://www.r-project.org/). Incanter might not be suitable for every task
(for example, we'll use the Weka library for machine learning later) but it is still an important
part of our toolkit for doing data analysis in Clojure. This chapter has a collection of recipes
that can be used to gather data and make it accessible to Clojure.

For the very first recipe, we'll take a look at how to start a new project. We'll start with very
simple formats such as comma-separated values (CSV) and move into reading data from
relational databases using JDBC. We'll examine more complicated data sources, such as
web scraping and linked data (RDF).

Creating a new project


Over the course of this book, we're going to use a number of third-party libraries and external
dependencies. We will need a tool to download them and track them. We also need a tool to
set up the environment and start a REPL (read-eval-print-loop or interactive interpreter) that
can access our code or to execute our program. REPLs allow you to program interactively. It's a
great environment for exploratory programming, irrespective of whether that means exploring
library APIs or exploring data.

We'll use Leiningen for this (http://leiningen.org/). This has become a standard
package automation and management system.

Getting ready
Visit the Leiningen site and download the lein script. This will download the Leiningen JAR
file when it's needed. The instructions are clear, and it's a simple process.

How to do it...
To generate a new project, use the lein new command, passing the name of the project
to it:
$ lein new getting-data
Generating a project called getting-data based on the default template.
To see other templates (app, lein plugin, etc), try lein help new.

There will be a new subdirectory named getting-data. It will contain files with stubs for the
getting-data.core namespace and for tests.

8
Chapter 1

How it works...
The new project directory also contains a file named project.clj. This file contains
metadata about the project, such as its name, version, license, and more. It also contains
a list of the dependencies that our code will use, as shown in the following snippet. The
specifications that this file uses allow it to search Maven repositories and directories of
Clojure libraries (Clojars, https://clojars.org/) in order to download the project's
dependencies. Thus, it integrates well with Java's own packaging system as developed with
Maven (http://maven.apache.org/).
(defproject getting-data "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]])

In the Getting ready section of each recipe, we'll see the libraries that we need to list in the
:dependencies section of this file. Then, when you run any lein command, it will download
the dependencies first.

Reading CSV data into Incanter datasets


One of the simplest data formats is comma-separated values (CSV), and you'll find that
it's everywhere. Excel reads and writes CSV directly, as do most databases. Also, because
it's really just plain text, it's easy to generate CSV files or to access them from any
programming language.

Getting ready
First, let's make sure that we have the correct libraries loaded. Here's how the project
Leiningen (https://github.com/technomancy/leiningen) project.clj file should
look (although you might be able to use more up-to-date versions of the dependencies):
(defproject getting-data "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.6.0"]
[incanter "1.5.5"]])

Downloading the example code


You can download the example code files for all Packt books you have
purchased from your account at http://www.packtpub.com. If you
purchased this book elsewhere, you can visit http://www.packtpub.
com/support and register to have the files e-mailed directly to you.

9
Importing Data for Analysis

Also, in your REPL or your file, include these lines:


(use 'incanter.core
'incanter.io)

Finally, downloaded a list of rest area locations from POI Factory at http://www.poi-
factory.com/node/6643. The data is in a file named data/RestAreasCombined(Ver.
BN).csv. The version designation might be different though, as the file is updated. You'll also
need to register on the site in order to download the data. The file contains this data, which is
the location and description of the rest stops along the highway:
-67.834062,46.141129,"REST AREA-FOLLOW SIGNS SB I-95 MM305","RR, PT,
Pets, HF"
-67.845906,46.138084,"REST AREA-FOLLOW SIGNS NB I-95 MM305","RR, PT,
Pets, HF"
-68.498471,45.659781,"TURNOUT NB I-95 MM249","Scenic Vista-NO
FACILITIES"
-68.534061,45.598464,"REST AREA SB I-95 MM240","RR, PT, Pets, HF"

In the project directory, we have to create a subdirectory named data and place the file in
this subdirectory.

I also created a copy of this file with a row listing the names of the columns and named it
RestAreasCombined(Ver.BN)-headers.csv.

How to do it…
1. Now, use the incanter.io/read-dataset function in your REPL:
user=> (read-dataset "data/RestAreasCombined(Ver.BJ).csv")

| :col0 | :col1 | :col2


| :col3 |
|------------+-----------+--------------------------------------+-
---------------------------|
| -67.834062 | 46.141129 | REST AREA-FOLLOW SIGNS SB I-95 MM305 |
RR, PT, Pets, HF |
| -67.845906 | 46.138084 | REST AREA-FOLLOW SIGNS NB I-95 MM305 |
RR, PT, Pets, HF |
| -68.498471 | 45.659781 | TURNOUT NB I-95 MM249 |
Scenic Vista-NO FACILITIES |
| -68.534061 | 45.598464 | REST AREA SB I-95 MM240 |
RR, PT, Pets, HF |
| -68.539034 | 45.594001 | REST AREA NB I-95 MM240 |
RR, PT, Pets, HF |

10
Exploring the Variety of Random
Documents with Different Content
take part in the fighting, they may not directly be attacked and killed
or wounded, although they are exposed to all injury indirectly
resulting from an attack on or by their vessel. If they are mere
private individuals, they may as an exception only and under the
same circumstances as private individuals on occupied territory be
made prisoners of war.[411] But they are nevertheless, for the time
they are on board the captured vessel, under the discipline of the
captor. All restrictive measures against them which are necessary are
therefore lawful, as are also punishments, in case they do not
comply with lawful orders of the commanding officer. If they are
enemy officials in important positions,[412] they may be made
prisoners of war.
[411] See U.S. Naval War Code, article 11, and above, § 116.
[412] See above, § 117.

V
TREATMENT OF WOUNDED AND SHIPWRECKED

Perels, § 37—Pillet, pp. 188-191—Westlake, II. pp. 275-280—Moore, VII. § 1178—


Bernsten, § 12—Bonfils, Nos. 1280-12809—Pradier-Fodéré, VIII. No. 3209—U.S.
Naval War Code, articles 21-29—Ferguson, The Red Cross Alliance at Sea (1871)—
Houette, De l'extension des principes de la Convention de Genève aux victimes des
guerres maritimes (1892)—Cauwès, L'extension des principes de la Convention de
Genève aux guerres maritimes (1899)—Holls, The Peace Conference at the Hague
(1900), pp. 120-132—Boidin, pp. 248-262—Dupuis, Guerre, Nos. 82-105—Meurer,
II. §§ 74-87—Higgins, pp. 382-394—Lémonon, pp. 526-554—Nippold, II. § 33—
Scott, Conferences, pp. 599-614—Takahashi, pp. 375-385—Fauchille in R.G. VI.
(1899), pp. 291-302—Bayer, in R.G. VIII. (1901), pp. 225-230—Renault in A.J. II.
pp. 295-306—Higgins, War and the Private Citizen (1912), pp. 73-90, and in The
Law Quarterly Review, XXVI (1910), pp. 408-414. See also the literature quoted
above at the commencement of § 118.

Adaptation of Geneva Convention to Sea Warfare.


§ 204. Soon after the ratification of the Geneva Convention the
necessity of adapting its principles to naval warfare was generally
recognised, and among the non-ratified Additional articles to the
Geneva Convention of 1868 were nine which aimed at such an
adaptation. But it was not until the Hague Peace Conference in 1899
that an adaptation came into legal existence. This adaptation was
contained in the "Convention[413] for the Adaptation to Maritime
Warfare of the Principles of the Geneva Convention of August 22,
1864," which comprised fourteen articles. It has, however, been
replaced by the "Convention (X.) for the Adaptation of the Principles
of the Geneva Convention to Maritime War," of the Second Hague
Peace Conference. This new convention comprises twenty-eight
articles and was signed, although with some reservations, by all the
Powers represented at the Conference, except Nicaragua which
acceded later, and it has already been ratified by most of the
signatory Powers. It provides rules concerning the wounded, sick,
shipwrecked, and dead; hospital ships; sickbays on men-of-war; the
distinctive colour and emblem of hospital ships; neutral vessels
taking on board belligerent wounded, sick, or shipwrecked; the
religious, medical, and hospital staff of captured ships; the carrying
out of the convention, and the prevention of abuses and infractions.
[413] Martens, N.R.G. 2nd Ser. XXVI. p. 979.

The Wounded, Sick, and Shipwrecked.


§ 205. Soldiers, sailors, and other persons officially attached to
fleets or armies, whatever their nationality, who are taken on board
when sick or wounded, must be respected and tended by the
captors (article 11). All enemy shipwrecked, sick, or wounded who
fall into the power of a belligerent are prisoners of war. It is left to
the captor to determine whether they are to be kept on board, or to
be sent to a port of his own country, or a neutral port, or even a
hostile port; and in the last case such repatriated prisoners must be
prevented by their Government from again serving in the war (article
14). The shipwrecked, wounded, or sick, who are landed at a neutral
port with the consent of the local authorities, must, unless there is
an arrangement to the contrary between the neutral State
concerned and the belligerent States, be guarded by the neutral
State so as to prevent them from again taking part in the war;[414]
the expenses of tending and interning them must be borne by the
State to whom they belong (article 15). After each engagement,
both belligerents must, so far as military interests permit, take
measures to search for the shipwrecked, wounded, and sick, and to
ensure them protection against pillage and maltreatment (article
16). Each belligerent must, as early as possible, send to the
authorities of their country, navy, or army, a list of the names of the
sick and wounded picked up by him; and the belligerents must keep
each other informed as to internments and transfers as well as to
admissions into hospital and deaths which have occurred amongst
the sick and wounded in their hands. And they must collect all
objects of personal use, valuables, letters, &c., that are found in the
captured ships in order to have them forwarded to the persons
concerned by the authorities of their own country (article 17).
[414] See below, § 348a.

Treatment of the Dead.


§ 205a. After each engagement both belligerents must, so far as
military interests permit, take measures to ensure the dead
protection against pillage and maltreatment, and they must see that
the burial, whether by land or sea, or cremation of the dead is
preceded by a careful examination of the corpses in order to
determine that life is really extinct (article 16). Each belligerent
must, as early as possible, send to the authorities of their country,
navy, or army, the military identification marks or tokens found on
the dead; they must also collect all the objects of personal use,
valuables, letters, &c., which have been left by the wounded and sick
who die in hospital, in order that they may be forwarded to the
persons concerned by the authorities of their own country (article
17).

Hospital Ships.
§ 206. Three different kinds of hospital ships must be
distinguished—namely, military hospital ships, hospital ships
equipped by private individuals or relief societies of the belligerents,
and hospital ships equipped by private neutral individuals and
neutral relief societies.
(1) Military hospital ships (article 1) are ships constructed or
assigned by States specially and solely for the purpose of assisting
the wounded, sick, and shipwrecked. Their names must be
communicated to the belligerents at the commencement of or during
hostilities, and in any case before they are employed. They must be
respected by the belligerents, they may not be captured while
hostilities last, and they are not on the same footing as men-of-war
during their stay in a neutral port.
(2) Hospital ships equipped wholly or in part at the cost of private
individuals or officially recognised relief societies of the belligerents
must be respected by either belligerent (article 2), and are exempt
from capture, provided their home State has given them an official
commission and has notified their names to the other belligerent at
the commencement of or during hostilities, and in any case before
they are employed. They must, further, be furnished with a
certificate from the competent authorities declaring that they had
been under the latter's control while fitting out and on final
departure.
(3) Hospital ships, equipped wholly or in part at the cost of private
individuals or officially recognised relief societies of neutral States
(article 3), must likewise be respected, and are exempt from
capture, provided that they are placed under the control of one of
the belligerents, with the previous consent of their own Government
and with the authorisation of the belligerent himself, and that the
latter has notified their names to his adversary at the
commencement of, or during, hostilities, and in any case before they
are employed.
According to article 4 all military and other hospital ships must
afford relief and assistance to the wounded, sick, and shipwrecked
of either belligerent. The respective Governments are prohibited
from using these ships for any military purpose. The commanders of
these vessels must not in any way hamper the movements of the
combatants, and during and after an engagement they act at their
own risk and peril. Both belligerents have a right to control and visit
all military and other hospital ships, to refuse their assistance, to
order them off, to make them take a certain course, to put a
commissioner on board, and, lastly, to detain them temporarily, if
important circumstances require this. In case a hospital ship receives
orders from a belligerent, these orders must, as far as possible, be
inscribed in the ship papers.
The protection to which hospital ships are entitled ceases if they
are made use of to commit acts harmful to the enemy[415] (article 8).
But the fact of the staff being armed for the purpose of maintaining
order and defending the wounded and sick, and the fact of the
presence of wireless telegraphic apparatus on board, are not
sufficient reasons for withdrawing protection.
[415] An interesting case of this kind occurred during the Russo-Japanese war. The Aryol
(also called the Orel), a hospital ship of the Russian Red Cross Society, was captured,
and afterwards condemned by the Prize Court on the following grounds:—(a) For having
communicated the orders of the commander-in-chief of the Russian squadron with which
she was sailing to other Russian vessels; (b) for carrying, by order of the commander-in-
chief of the squadron, in order to take them to Vladivostock, the master and some
members of the crew of the British steamship Oldhamia, which had been captured by the
Russians; (c) for having been instructed to purchase in Cape Town, or its neighbourhood,
11,000 ft. of conducting wire of good insulation; (d) for having navigated at the head of
the squadron in the position usually occupied by reconnoitring vessels.—See Takahashi,
pp. 620-625, and Higgins, op. cit. p. 74, and in The Law Quarterly Review, XXVI. (1910),
p. 408.
It must be specially observed that any man-of-war of either
belligerent may, according to article 12, demand the surrender of the
wounded, sick, or shipwrecked who are on board hospital ships of
any kind. According to a reservation by Great Britain, article 12 is
understood "to apply only to the case of combatants rescued during
or after a naval engagement in which they have taken part."

Hospital Ships in Neutral Ports.


§ 206a. For the purpose of defining the status of hospital ships
when entering neutral ports an International Conference met at the
Hague in 1904, where Germany, Austria-Hungary, Belgium, China,
Korea, Denmark, Spain, the United States of America, France,
Greece, Guatemala, Italy, Japan, Luxemburg, Mexico, Holland,
Persia, Portugal, Roumania, Russia, Servia, and Siam, were
represented. Great Britain, however, did not take part. The following
is the text of the six articles of the Convention signed by all the
representatives:—
Article 1.—Hospital ships fulfilling the conditions prescribed in
articles 1, 2, and 3 of the Convention concluded at the Hague
on July 27, 1899, for the adaptation of the principles of the
Geneva Convention of August 22, 1864, to naval warfare shall
in time of war be exempt in the ports of the contracting
parties from all dues and taxes imposed on vessels for the
benefit of the State.
Article 2.—The provision contained in the preceding article
shall not prevent the exercise of the right of search and other
formalities demanded by the fiscal and other laws in force in
the said ports.
Article 3.—The regulation laid down in article 1 is binding only
upon the contracting Powers in case of war between two or
more of themselves. The said rule shall cease to be obligatory
as soon as in a war between any of the contracting Powers a
non-contracting Power shall join one of the belligerents.
Article 4.—The present Convention, which bears date of this
day and may be signed up to October 1, 1905, by any Power
which shall have expressed a wish to do so, shall be ratified
as speedily as possible. The ratifications shall be deposited at
the Hague. On the deposit of the ratifications, a procès-verbal
shall be drawn up, of which a certified copy shall be conveyed
by diplomatic channels, after the deposit of each ratification,
to all the contracting Powers.
Article 5.—Non-signatory Powers will be allowed to adhere to
the present convention after October 1, 1905. For that
purpose they will have to make known the fact of their
adhesion to the contracting Powers by means of a written
notification addressed to the Government of the Netherlands,
which will be communicated by that Government to all the
other contracting Powers.
Article 6.—In the event of any of the high contracting parties
denouncing the present Convention, the denunciation shall
only take effect after notification has been made in writing to
the Government of the Netherlands and communicated by
that Government at once to all the other contracting Powers.
Such denunciation shall be effective only in respect of the
Power which shall have given notice of it.

Sick-Bays.
§ 206b. According to article 7, in case of a fight on board a man-
of-war, the sick-bays must, as far as possible, be respected and
spared. These sick-bays, and the material belonging to them, remain
subject to the laws of war; they may not, however, be used for any
purpose other than that for which they were originally intended so
long as they are required for the wounded and sick. But should the
military situation require it, a commander into whose power they
have fallen may nevertheless apply them to other purposes, under
the condition that he previously makes arrangements for proper
accommodation for the wounded and sick on board. The protection
to which sick-bays are entitled ceases if they are made use of to
commit acts harmful to the enemy (article 8). But the fact that the
staff of sick-bays is armed in order to defend the wounded and sick
is not sufficient reason for withdrawing protection.
Distinctive Colour and Emblem of Hospital Ships.
§ 207. All military hospital ships must be painted white outside
with a horizontal band of green about one metre and a half in
breadth. Other hospital ships must also be painted white outside,
but with a horizontal band of red. The boats and small craft of
hospital ships used for hospital work must likewise be painted white.
And besides being painted in this distinguishing colour, all military
and other hospital ships (article 5) must hoist, together with their
national flag, the white flag with a red cross stipulated by the
Geneva Convention. If they belong to a neutral State, they must also
fly at the main mast the national flag of the belligerent under whose
control they are placed. Hospital ships which, under the terms of
article 4, are detained by the enemy, must haul down the national
flag of the belligerent to whom they belong. All hospital ships which
wish to ensure by night the freedom from interference to which they
are entitled, must, subject to the assent of the belligerent they are
accompanying, take the necessary measures to render their special
painting sufficiently plain. According to article 6 the distinguishing
signs mentioned in article 5 may only be used, whether in time of
peace or war, for protecting or indicating the ships therein
mentioned.
Although in this connection the red cross is especially stipulated as
the distinctive emblem, there is no objection to the use by non-
Christian States, who object to the cross on religious grounds, of
another emblem. Thus Turkey reserved the right to use a red
crescent, and Persia to use a red sun.
Neutral Vessels assisting the Wounded, Sick, or Shipwrecked.
§ 208. A distinction must be made between neutral men-of-war
and private vessels assisting the sick, wounded, and shipwrecked.
(1) If men-of-war take on board wounded, sick, or shipwrecked
persons, precaution must be taken, so far as possible, that they do
not again take part in the operations of war (article 13). Such
individuals must not, however, be handed over to the adversary but
must be detained till the end of the war.[416]
(2) Neutral merchantmen,[417] yachts, or boats which have of their
own accord rescued sick, wounded, or shipwrecked men, or who
have taken such men on board at the appeal of the belligerent,
must, according to article 9, enjoy special protection and certain
immunities. In no case may they be captured for the sole reason of
having such persons on board. But, subject to any undertaking that
may have been given to them, they remain liable to capture for any
violation of neutrality they may have committed.
[416] See below, § 348.
[417] See below, § 348a.

It must be specially observed that, according to article 12, any


man-of-war of either belligerent may demand from merchant ships,
yachts, and boats, whatever the nationality of such vessels, the
surrender of the wounded, sick, or shipwrecked who are on board.
According to the reservation of Great Britain, mentioned above in
§ 206, article 12 is understood "to apply only to the case of
combatants rescued during or after a naval engagement in which
they have taken part."

The Religious, Medical, and Hospital Staff.


§ 209. The religious, medical, and hospital staff of any captured
vessel is inviolable, and the members may not be made prisoners of
war, but they must continue to discharge their duties while
necessary. If they do this, the belligerent into whose hands they
have fallen has to give them the same allowances and the same pay
as are granted to persons holding the same rank in his own navy.
They may leave the ship, when the commander-in-chief considers it
possible, and on leaving they are allowed to take with them all
surgical articles and instruments which are their private property
(article 10).
Application of Convention X., and Prevention of Abuses.
§ 209a. The provisions of Convention X. are only binding in the
case of war between contracting Powers, they cease to be binding
the moment a non-contracting Power becomes one of the
belligerents (article 18). In the case of operations of war between
land and sea forces of belligerents, the provisions of Convention X.
only apply to forces on board ship (article 22). The commanders-in-
chief of the belligerent fleets must, in accordance with the
instructions of their Governments and in conformity with the general
principles of the Convention, arrange the details for carrying out the
articles of Convention X., as well as for cases not provided for in
these articles (article 19). The contracting parties must take the
necessary measures to instruct their naval forces, especially the
personnel protected by Convention X., in the provisions of the
Convention, and to bring these provisions to the notice of the public
(article 20). The contracting Powers must, in case their criminal laws
are inadequate, enact measures necessary for checking, in time of
war, individual acts of pillage or maltreatment of the wounded and
sick in the fleet, as well as for punishing, as unjustifiable adoption of
military or naval marks, the unauthorised use of the distinctive signs
mentioned in article 5 on the part of vessels not protected by the
present Convention; they must communicate to each other, through
the Dutch Government, the enactments for preventing such acts at
the latest within five years of the ratification of Convention X.[418]
(article 21).
[418]
Great Britain has entered a reservation against articles 6 and 21, but see above, §
124b, p. 164, note 1.
General Provisions of Convention X.
§ 209b. Convention X. comes into force sixty days after ratification
or accession on the part of each Power concerned (article 26). It
replaces the Convention of 1899 for the adaptation to naval warfare
of the principles of the Geneva Convention, but this latter
Convention remains in force between such of its contracting parties
as do not become parties to Convention X. (article 25). Such non-
signatory Powers of Convention X. as are parties to the Geneva
Convention of 1906 are free to accede at any time, and a Power
desiring to accede must notify its intention in writing to the Dutch
Government which must communicate the accession to all the
contracting Powers (article 24). Each of the contracting Powers is at
any time at liberty to denounce Convention X. by a written
notification to the Dutch Government which must immediately
communicate the notification to all the other contracting Powers; the
denunciation, however, does not take effect until one year after the
notification has reached the Dutch Government, and a denunciation
only affects the Power making the notification (article 27). A register
kept by the Dutch Minister of Foreign Affairs must record the dates
of the deposit of ratifications, as well as the dates of accessions or of
denunciations; each contracting Power is entitled to have access to
this register and to be supplied with duly certified extracts from it
(article 28).

VI
ESPIONAGE, TREASON, RUSES

See, besides the literature quoted above at the commencement of §§ 159 and 163,
Pradier-Fodéré, VIII. No. 3157, and Bentwich in The Journal of the Society of
Comparative Legislation, New Series, X. (1909), pp. 243-249.

Espionage and Treason.


§ 210. Espionage[419] and treason do not play as large a part in
sea warfare as in land warfare;[420] still they may be made use of by
belligerents. But it must be specially observed that, since the Hague
Regulations deal only with land warfare, the legal necessity of trying
a spy by court-martial according to article 30 of these Regulations
does not exist for sea warfare, although such trial by court-martial is
advisable.
[419] As regards the case of the Haimun, see below, § 356.
[420] See above, §§ 159-162.

Ruses.
§ 211. Ruses are customarily allowed in sea warfare within the
same limits as in land warfare, perfidy being excluded. As regards
the use of a false flag, it is by most publicists considered perfectly
lawful for a man-of-war to use a neutral's or the enemy's flag (1)
when chasing an enemy vessel, (2) when trying to escape, and (3)
for the purpose of drawing an enemy vessel into action.[421] On the
other hand, it is universally agreed that immediately before an attack
a vessel must fly her national flag. Halleck (I. p. 568) relates the
following instance: In 1783 the Sybille, a French frigate of thirty-
eight guns, enticed the British man-of-war Hussar by displaying the
British flag and intimating herself to be a distressed prize of a British
captor. The Hussar approached to succour her, but the latter at once
attacked the Hussar without showing the French flag. She was,
however, overpowered and captured, and the commander of the
Hussar publicly broke the sword of the commander of the Sybille,
whom he justly accused of perfidy, although the French commander
was acquitted when subsequently brought to trial by the French
Government. Again, Halleck (I. p. 568) relates: In 1813 two
merchants of New York carried out a plan for destroying the British
man-of-war Ramillies in the following way. A schooner with some
casks of flour on deck was expressly laden with several casks of
gunpowder having trains leading from a species of gunlock, which,
by the action of clockwork, went off at a given time after it had been
set. To entice the Ramillies to seize her, the schooner came up, and
the Ramillies then sent a boat with thirteen men and a lieutenant to
cut her off. Subsequently the crew of the schooner abandoned her
and she blew up with the lieutenant and his men on board.
[421]The use of a false flag on the part of a belligerent man-of-war is analogous to the
use of the enemy flag and the like in land warfare; see above, § 164. British practice—
see Holland, Prize Law, § 200—permits the use of false colours. U.S. Naval War Code,
article 7, forbids it altogether, whereas as late as 1898, during the war with Spain in
consequence of the Cuban insurrection, two American men-of-war made use of the
Spanish flag (see Perels, p. 183). And during the war between Turkey and Russia, in
1877, Russian men-of-war in the Black Sea made use of the Italian flag (see Martens, II.
§ 103, p. 566). The question of the permissibility of the use of a neutral or enemy flag is
answered in the affirmative, among others, by Ortolan, II. p. 29; Fiore, III. No. 1340;
Perels, § 35, p. 183; Pillet, p. 116; Bonfils, No. 1274; Calvo, IV. 2106; Hall, § 187. See
also Pillet in R.G. V. (1898), pp. 444-451. But see the arguments against the use of a
false flag in Pradier-Fodéré, VI. No. 2760.
Vattel (III. § 178) relates the following case of perfidy: In 1755,
during war between Great Britain and France, a British man-of-war
appeared off Calais, made signals of distress for the purpose of
soliciting French vessels to approach to her succour, and seized a
sloop and some sailors who came to bring her help. Vattel is himself
not certain whether this case is a fact or fiction. But be that as it
may, there is no doubt that, if the case be true, it is an example of
perfidy, which is not allowed.

VII
REQUISITIONS, CONTRIBUTIONS, BOMBARDMENT

Hall, § 140*—Lawrence, § 204—Westlake, II. pp. 315-318—Moore, VII. §§ 1166-


1174—Taylor, § 499—Bonfils, Nos. 1277-12771—Despagnet, Nos. 618-618 bis—
Fiore, Code, Nos. 1633-1642—Pradier-Fodéré, VIII. Nos. 3153-3154—Nys, III. pp.
430-432—Pillet, p. 117—Perels, § 35, p. 181—Holland, Studies, pp. 96-111—
Dupuis, Nos. 67-73, and Guerre, Nos. 42-47—Barclay, Problems, p. 51—Higgins,
pp. 352-357—Lémonon, pp. 503-525—Bernsten, § 7, III.—Boidin, pp. 201-215—
Nippold, II. § 28—Scott, Conferences, pp. 587-598, and in A.J. II. (1908), pp. 285-
294.

Requisitions and Contributions upon Coast Towns.


§ 212. No case has to my knowledge occurred in Europe[422] of
requisitions or contributions imposed by naval forces upon enemy
coast towns. The question whether or not such requisitions and
contributions would be lawful became of interest through an article
on naval warfare of the future, published in 1882 by the French
Admiral Aube in the Revue des Deux Mondes (vol. 50, p. 331). Aube
pointed out that one of the tasks of the fleet in sea warfare of the
future would be to attack and destroy by bombardment fortified and
unfortified military and commercial enemy coast towns, or at least to
compel them mercilessly to requisitions and contributions. As during
the British naval manœuvres of 1888 and 1889 imaginary
contributions were imposed upon several coast towns, Hall (§ 140*)
took into consideration the question under what conditions
requisitions and contributions would be lawful in sea warfare. He
concluded, after careful consideration and starting from the
principles regarding requisitions and contributions in land warfare,
that such requisitions and contributions may be levied, provided a
force is landed which actually takes possession of the respective
coast town and establishes itself there, although only temporarily,
until the imposed requisitions and contributions have been complied
with; that, however, no requisitions or contributions could be
demanded by a single message sent on shore under threatened
penalty of bombardment in case of refusal. There is no doubt that
Hall's arguments are, logically, correct; but it was not at all certain
that the naval Powers would adopt them, since neither the Institute
of International Law nor the U.S. Naval War Code had done so.[423]
The Second Hague Peace Conference has now settled the matter
through the Convention (IX.) concerning bombardment by naval
forces in time of war which amongst its thirteen articles includes two
—3 and 4—dealing with requisitions and contributions. This
Convention has been signed, although with some reservations, by all
the Powers represented at the Conference except Spain, China, and
Nicaragua, but China and Nicaragua acceded later. Many States have
already ratified.
[422]Holland, Studies, p. 101, mentions a case which occurred in South America in 1871.
[423]The Institute of International Law has touched upon the question of requisitions
and contributions in sea warfare in article 4, No. 1, of its rules regarding the
bombardment of open towns by naval forces; see below, § 213, p. 267. U.S. Naval War
Code, article 4, allows "reasonable" requisitions, but no contributions since "ransom" is
not allowed.
According to article 3 undefended ports, towns, villages, dwellings,
or other buildings may be bombarded by a naval force, if the local
authorities, on a formal summons being made to them, decline to
comply with requisitions for provisions or supplies necessary for the
immediate use of the naval force concerned. These requisitions must
be proportional to the resources of the place; they can only be
demanded by the commander of the naval force concerned; they
must be paid for in cash, and, if this is not possible for want of
sufficient ready money, their receipt must be acknowledged.
As regards contributions, Convention IX. does not directly forbid
the demand for them, but article 4 expressly forbids bombardment
of undefended places by a naval force on account of non-payment of
money contributions; in practice, therefore, the demand for
contributions will not occur in naval warfare.
Bombardment of the Enemy Coast.
§ 213. There is no doubt whatever that enemy coast towns which
are defended may be bombarded by naval forces, acting either
independently or in co-operation with a besieging army. But before
the Second Peace Conference of 1907 the question was not settled
as to whether or not open and undefended coast places might be
bombarded by naval forces. The Institute of International Law in
1895, at its meeting at Cambridge, appointed a committee to
investigate the matter. The report[424] of this committee, drafted by
Professor Holland with the approval of the Dutch General Den Beer
Portugael, and presented in 1896 at the meeting at Venice,[425] is of
such interest that it is advisable to reproduce here a translation of
the following chief parts:—
When the Prince de Joinville recommended in 1844, in case of
war, the devastation of the great commercial towns of
England, the Duke of Wellington wrote:—"What but the
inordinate desire of popularity could have induced a man in
his station to write and publish such a production, an
invitation and provocation to war, to be carried on in a
manner such as has been disclaimed by the civilised portions
of mankind?" (Raikes, Correspondence, p. 367). The opinion
of the Prince de Joinville has been taken up by Admiral Aube
in an article which appeared in the Revue des Deux Mondes
in 1882. After having remarked that the ultimate object of
war is to inflict the greatest possible damage to the enemy
and that "La richesse est le nerf de la guerre," he goes on as
follows:—"Tout ce qui frappe l'ennemi dans sa richesse
devient non seulement légitime, mais s'impose comme
obligatoire. Il faut donc s'attendre à voir les flottes cuirassées,
maîtresses de la mer, tourner leur puissance d'attaque et
déstruction, à défaut d'adversaires se dérobant à leurs coups,
contre toutes les villes du littoral, fortifiées ou non, pacifiques
ou guerrières, les incendier, les ruiner, et tout au moins les
rançonner sans merci. Cela s'est fait autrefois; cela ne se fait
plus; cela se fera encore: Strasbourg et Péronne en sont
garants...."
[424] See Annuaire, XV. (1896), pp. 148-150.
[425] See Annuaire, XV. (1896), p. 313.
The discussion was opened again in 1888, on the occasion of
manœuvres executed by the British Fleet, the enemy part of which
feigned to hold to ransom, under the threat of bombardment, great
commercial towns, such as Liverpool, and to cause unnecessary
devastation to pleasure towns and bathing-places, such as
Folkestone, through throwing bombs. One of your reporters
observed in a series of letters addressed to the Times that such acts
are contrary to the rules of International Law as well as to the
practice of the present century. He maintained that bombardment of
an open town ought to be allowed only for the purpose of obtaining
requisitions in kind necessary for the enemy fleet and contributions
instead of requisitions, further by the way of reprisal, and in case the
town defends itself against occupation by enemy troops approaching
on land.... Most of the admirals and naval officers of England who
took part in the lively correspondence which arose in the Times and
other journals during the months of August and September 1880
took up a contrary attitude....
On the basis of this report the Institute, at the same meeting,
adopted a body of rules regarding the bombardment of open towns
by naval forces, declaring that the rules of the law of war concerning
bombardment are the same in the case of land warfare and sea
warfare. Of special interest are articles 4 and 5 of these rules, which
run as follows:—
Article 4. In virtue of the general principles above, the
bombardment by a naval force of an open town, that is to say
one which is not defended by fortifications or by other means
of attack or of resistance for immediate defence, or by
detached forts situated in proximity, for example of the
maximum distance of from four to ten kilometres, is
inadmissible except in the following cases:—
(1) For the purpose of obtaining by requisitions or
contributions what is necessary for the fleet. These
requisitions or contributions must in every case remain within
the limits prescribed by articles 56 and 58 of the Manual of
the Institute.
(2) For the purpose of destroying sheds, military erections,
depôts of war munitions, or of war vessels in a port. Further,
an open town which defends itself against the entrance of
troops or of disembarked marines can be bombarded for the
purpose of protecting the disembarkation of the soldiers and
of the marines, if the open town attempts to prevent it, and
as an auxiliary measure of war to facilitate the result made by
the troops and the disembarked marines, if the town defends
itself. Bombardments of which the object is only to exact a
ransom are specially forbidden, and, with the stronger
reason, those which are intended only to bring about the
submission of the country by the destruction, for which there
is no other motive, of the peaceful inhabitants or of their
property.
Article 5. An open town cannot be exposed to a
bombardment for the only reasons:—
(a) That it is the capital of the State or the seat of the
Government (but naturally these circumstances do not
guarantee it in any way against a bombardment).
(b) That it is actually occupied by troops, or that it is
ordinarily the garrison of troops of different arms intended to
join the army in time of war.
The First Peace Conference did not settle the matter, but
expressed the desire "that the proposal to settle the question of
bombardment of ports, towns, and villages by a naval force may be
referred to a subsequent Conference for consideration." The Second
Peace Conference, however, by Convention IX.—see above, § 212, p.
265—has provided detailed rules concerning all the points in
question, and the following is now the law concerning bombardment
by naval forces:—
(1) The bombardment of undefended ports, towns, villages,
dwellings, or other buildings is under all circumstances and
conditions prohibited (article 1). To define the term
"undefended," article 1 expressly enacts that "a place cannot
be bombarded solely because automatic submarine contact
mines are anchored off the harbour," but Great Britain,
France, Germany, and Japan entered a reservation against
this, since they correctly consider such a place to be
"defended."
(2) Although undefended places themselves are exempt,
nevertheless military works, military or naval establishments,
depôts of arms or war material, workshops or plant which
could be utilised for the needs of the hostile fleet or army,
and men-of-war in the harbour of undefended places may be
bombarded. And no responsibility is incurred for any
unavoidable damage caused thereby to the undefended place
or its inhabitants. As a rule, however, the commander must,
before resorting to bombardment of these works, ships, and
the like, give warning to the local authorities so that they can
destroy the works and vessels themselves. Only if, for military
reasons, immediate action is necessary and no delay can be
allowed to the enemy, may bombardment be resorted to
without previous warning, the commander being compelled to
take all due measures in order that the undefended place
itself may suffer as little harm as possible (article 2).
The first case in which naval forces acted according to these rules
occurred during the Turco-Italian war. On February 25, 1912, Admiral
Faravelli, the commander of an Italian squadron, surprised, at dawn,
the Turkish gunboat Awni-Illa and a torpedo-boat in the port of
Beirut. These vessels were called upon to surrender, they were given
until nine o'clock a.m. to comply with the demand, and the demand
was communicated to the Governor and the Consular authorities. At
nine o'clock the Turkish vessels were again, by signal, summoned to
surrender, and as no reply was received, they were fired at and
destroyed, but not without first having vigorously answered the fire
of the Italians. Shells missing the vessels and bursting on the quay
killed and wounded a number of individuals and damaged several
buildings. The Turkish Government protested against this procedure
as a violation of Convention IX. of the Second Peace Conference,
but, provided the official report of Admiral Faravelli corresponds with
the facts, the Turkish protest is unfounded.
(3) In case undefended places do not comply with legitimate
requisitions, they likewise may be bombarded; see details above, §
212.
(4) In case of bombardments, all necessary steps must be taken
to spare buildings devoted to public worship, art, science, or
charitable purposes; historical monuments; hospitals, and places
where the sick or wounded are collected, provided they are not at
the time used for military purposes. To enable the attacking force to
carry out this injunction, the privileged buildings, monuments, and
places must be indicated by visible signs, which shall consist of large
stiff rectangular panels, divided diagonally into two coloured
triangular portions, the upper portion black, the lower portion white
(article 5). Unless military exigencies render it impossible the
commander of an attacking naval force must, before commencing
the bombardment, do all in his power to warn the authorities (article
6).
(5) The giving over to pillage of a town or place, even when taken
by assault, is forbidden (article 7).

VIII
INTERFERENCE WITH SUBMARINE TELEGRAPH CABLES

Moore, VII. § 1176—Westlake, II. pp. 280-283—Liszt, § 41, III.—Bonfils, No. 1278—
Pradier-Fodéré, VI. No. 2772—Fiore, III. No. 1387, and Code, Nos. 1650-1655—
Perels, § 35, p. 185—Perdrix, Les câbles sousmarines et leur protection
internationale (1902)—Kraemer, Die unterseeischen Telegraphenkabel in
Kriegszeiten (1903)—Scholz, Krieg und Seekabel (1904)—Zuculin, I cavi
sottomarini e il telegrafo senza fili nel diritto di guerra (1907)—Holland, in Journal
de Droit International Privé et de la Jurisprudence comparée (Clunet), XXV. (1898),
pp. 648-652, and War, No. 114—Goffin, in The Law Quarterly Review, XV. (1899),
pp. 145-154—Bar, in the Archiv für Oeffentliches Recht, XV. (1900), pp. 414-421—
Rey, in R.G. VIII. (1901), pp. 681-762—Dupuis, in R.G. X. (1903), pp. 532-547—
Nordon in The Law Magazine and Review, XXXII. (1907), pp. 166-188. See also the
literature quoted above, vol. I., at the commencement of § 286.

Uncertainty of Rules concerning Interference with Submarine Telegraph Cables.


§ 214. As the "International Convention[426] for the Protection of
Submarine Telegraph Cables" of 1884 expressly stipulates by article
15 that freedom of action is reserved to belligerents, the question is
not settled how far belligerents are entitled to interfere with
submarine telegraph cables. The only conventional rule concerning
this question is article 54 of the Hague Regulations, inserted by the
Second Peace Conference, which enacts that submarine cables
connecting occupied enemy territory with a neutral territory shall not
be seized or destroyed, and that, if a case of absolute necessity has
compelled the occupant to seize or destroy such cable, it must be
restored after the conclusion of peace and indemnities paid. There is
no rule in existence which deals with other possible cases of seizure
and destruction.
[426] See above, vol. I. §§ 286 and 287.
The Institute of International Law has studied the matter and
adopted,[427] at its meeting at Brussels in 1902, the following five
rules:—
(1) Le câble sousmarin reliant deux territoires neutres est
inviolable.
(2) Le câble reliant les territoires de deux belligérants ou deux
parties du territoire d'un des belligérants peut être coupé
partout, excepté dans la mer territoriale et dans les eaux
neutralisées dépendant d'un territoire neutre.
(3) Le câble reliant un territoire neutre au territoire d'un des
belligérants ne peut en aucun cas être coupé dans la mer
territoriale ou dans les eaux neutralisées dépendant d'un
territoire neutre. En haute mer, ce câble ne peut être coupé
que s'il y a blocus effectif et dans les limites de la ligne du
blocus, sauf rétablissement du câble dans le plus bref délai
possible. Le câble peut toujours être coupé sur le territoire et
dans la mer territoriale dépendant d'un territoire ennemi
jusqu'à d'une distance de trois milles marins de la laisse de
basse-marée.
(4) Il est entendu que la liberté de l'État neutre de
transmettre des dépêches n'implique pas la faculté d'en user
ou d'en permettre l'usage manifestement pour prêter
assistance à l'un des belligérants.
(5) En ce qui concerne l'application des règles précédentes, il
n'y a de différence à établir ni entre les câbles d'État et les
câbles appartenant à des particuliers, ni entre les câbles de
propriété ennemie et ceux qui sont de propriété neutre.
[427] See Annuaire, XIX. (1902), p. 331.
The U.S. Naval War Code, article 5, laid down the following rules:

(1) Submarine telegraphic cables between points in the
territory of an enemy, or between the territory of the United
States and that of an enemy, are subject to such treatment as
the necessities of war may require.
(2) Submarine telegraphic cables between the territory of an
enemy and neutral territory may be interrupted within the
territorial jurisdiction of the enemy.
(3) Submarine telegraphic cables between two neutral
territories shall be held inviolable and free from interruption.
[428]

[428]It is impossible for a treatise to discuss the details of the absolutely unsettled
question as to how far belligerents may interfere with submarine telegraph cables.
Readers who take a particular interest in it may be referred to the excellent monograph
of Scholz, Krieg und Seekabel (1904), which discusses the matter thoroughly and ably.

CHAPTER V
NON-HOSTILE RELATIONS OF BELLIGERENTS

I
ON NON-HOSTILE RELATIONS IN GENERAL BETWEEN BELLIGERENTS

Grotius, III. c. 19—Pufendorf, VIII. c. 7, §§ 1-2—Bynkershoek, Quaest. jur. publ. I. c.


1—Vattel, III. §§ 174-175—Hall, § 189—Lawrence, § 210—Phillimore, III. § 97—
Halleck, I. pp. 310-311—Taylor, § 508—Wheaton, § 399—Bluntschli, § 679—Heffter,
§ 141—Lueder in Holtzendorff, IV. pp. 525-527—Ullmann, § 185—Bonfils, Nos.
1237-1238—Despagnet, No. 555—Pradier-Fodéré, VII. Nos. 2882-2887—Rivier, II.
p. 367—Calvo, IV. §§ 2411-2412—Fiore, III. No. 1482, and Code, Nos. 1721-1723
—Martens, II. § 127—Longuet, §§ 134-135—Mérignhac, pp. 218-220—Pillet, pp.
355-356—Kriegsbrauch, p. 38—Land Warfare, §§ 221-223—Emanuel, Les
conventions militaires dans la guerre continentale (1904).

Fides etiam hosti servanda.


§ 215. Although the outbreak of war between States as a rule
brings non-hostile intercourse to an end, necessity of circumstances,
convenience, humanity, and other factors call, or may call, some
kinds of non-hostile relations of belligerents into existence. And it is
a universally recognised principle of International Law that, where
such relations arise, belligerents must carry them out in good faith.
Fides etiam hosti servanda is a rule which was adhered to in
antiquity, when no International Law in the modern sense of the
term existed. But it had then a religious and moral sanction only.
Since in modern times war is not a condition of anarchy and
lawlessness between belligerents, but a contention in many respects
regulated, restricted, and modified by law, it is obvious that, where
non-hostile relations between belligerents occur, they are protected
by law. Fides etiam hosti servanda is, therefore, a principle which
nowadays enjoys as well a legal as a religious and moral sanction.
Different kinds of Non-hostile Relations.
§ 216. As through the outbreak of war all diplomatic intercourse
and other non-hostile relations come to an end, it is obvious that
non-hostile relations between belligerents must originate either from
special rules of International Law or from special agreements
between the belligerents.
No special rules of International Law which demanded non-hostile
relations between belligerents existed in former times, but of late a
few rules of this kind have arisen. Thus, for instance, release on
parole[429] of prisoners of war creates an obligation on the part of the
enemy not to re-admit the individuals concerned into the forces
while the war lasts. And, to give another example, by article 4 of the
Geneva Convention of 1906, and article 14 of the Hague Regulations
—see also article 17 of Convention X. of the Second Peace
Conference—it is the duty of either belligerent to return to the
enemy, by his prisoner-of-war bureau, all objects of personal use,
letters, jewellery, and the like found on the battlefield or left by
those who died in hospital.[430] Non-hostile relations of this kind,
however, need not be considered in this chapter, since they have
already been discussed on several previous pages.
[429] See above, § 129.
[430] See above, § 144.
Non-hostile relations originating from special agreements of
belligerents, so-called commercia belli, may either be concluded in
time of peace for the purpose of creating certain non-hostile
relations between the parties in case war breaks out, or they may be
concluded during the actual time of war. Such non-hostile relations
are created through passports, safe-conducts, safeguards, flags of
truce, cartels, capitulations, and armistices. Non-hostile relations can
also be created by peace negotiations.[431] Each of these non-hostile
relations must be discussed separately.
[431] See below, § 267.

Licences to Trade.
§ 217. Several writers[432] speak of non-hostile relations between
belligerents created by licences to trade granted by a belligerent to
enemy subjects either within certain limits or generally. It has been
explained above, in § 101, that it is for Municipal Law to determine
whether or not through the outbreak of war all trade and the like is
prohibited between the subjects of belligerents. If the Municipal Law
of one or both belligerents does contain such a prohibition, it is of
course within the discretion of one or both of them to grant
exceptional licences to trade to their own or the other belligerent's
subjects, and such licences naturally include certain privileges. Thus,
for instance, if a belligerent allows enemy subjects to trade with his
own subjects, enemy merchantmen engaged in such trade are
exempt from capture and appropriation by the grantor. Yet it is not
International Law which creates this exemption, but the very licence
to trade granted by the belligerent and revocable at any moment;
and no non-hostile international relations between the belligerents
themselves originate from such licences. The matter would be
different if, either in time of peace for the time of war, or, during war,
the belligerents agreed to allow certain trade between their subjects;
but non-hostile relations originating from such an agreement would
not be relations arising from a licence to trade, but from a cartel.[433]
[432]See, for instance, Hall, § 196; Halleck, II. pp. 343-363; Lawrence, § 214; Manning,
p. 168; Taylor, § 512; Wheaton, §§ 409-410; Fiore, III. No. 1500; Pradier-Fodéré, VII.
No. 2938.
[433] See below, § 224.

II
PASSPORTS, SAFE-CONDUCTS, SAFEGUARDS
Grotius, III. c. 21, §§ 14-22—Vattel, III. §§ 265-277—Hall, §§ 191 and 195—
Lawrence, § 213—Phillimore, III. §§ 98-102—Halleck, II. pp. 323-328—Taylor, §
511—Wheaton, § 408—Moore, VII. §§ 1158-1159—Bluntschli, §§ 675-678—Heffter,
§ 142—Lueder in Holtzendorff, IV. pp. 525-527—Ullmann, § 185—Bonfils, Nos.
1246-1247—Despagnet, Nos. 558-561—Pradier-Fodéré, VII. Nos. 2884, 2932-2938
—Nys, III. pp. 504-505—Calvo, IV. §§ 2413-2418—Fiore, III. No. 1499, and Code,
Nos. 1742-1749—Longuet, §§ 142-143—Mérignhac, pp. 239-240—Pillet, pp. 359-
360—Kriegsbrauch, p. 41—Holland, War, No. 101—Land Warfare, §§ 326-337.

Passports and Safe-conducts.


§ 218. Belligerents on occasions arrange between themselves that
passports and safe-conducts shall be given to certain of each other's
subjects. Passports are written permissions given by a belligerent to
enemy subjects, or others, allowing them to travel within that
belligerent's territory or enemy territory occupied by him. Safe-
conducts are written permissions given by a belligerent to enemy
subjects, or others, allowing them to proceed to a particular place
for a defined object, for instance, to a besieged town for conducting
certain negotiations; but safe-conducts may also be given for goods,
and they then comprise permission to carry such goods without
molestation to a certain place. Passports as well as safe-conducts
make the grantee inviolable so long and in so far as he complies
with the conditions specially imposed upon him or made necessary
by the circumstances of the special case. Passports and safe-
conducts are not transferable, and they may be granted to enemy
subjects for a limited or an unlimited period; in the former case their
validity ceases with the expiration of the period. Both may be
withdrawn, not only when the grantee abuses the protection, but
also for military expediency. It must, however, be specially observed
that passports and safe-conducts are only a matter of International
Law when the granting of them has been arranged between the
belligerents or their responsible commanders, or between
belligerents and neutral Powers. If they are granted without such an
arrangement, unilaterally on the part of one of the belligerents, they
fall outside the scope of International Law.[434]
[434]The distinction between passports and the like arranged between the belligerents to
be granted, on the one hand, and, on the other, such as are granted unilaterally, would
seem to be necessary, although it is not generally made.
Safeguards.
§ 219. Belligerents on occasions arrange between themselves that
they shall grant protection to certain of each other's subjects or
property against their own forces in the form of safeguards, of which
there are two kinds. One consists in a written order given to an
enemy subject or left with enemy property and addressed to the
commander of armed forces of the grantor, in which the former is
charged with the protection of the respective individual or property,
and by which both become inviolable. The other kind of safeguard is
given by detailing one or more soldiers to accompany enemy
subjects or to guard the spot where certain enemy property is, for
the purpose of protection. Soldiers on this duty are inviolable on the
part of the other belligerent; they must neither be attacked nor
made prisoners, and they must, on falling into the hands of the
enemy, be fed, well kept, and eventually safely sent back to their
corps. As in the case of passports and safe-conducts, it must be
specially observed that safeguards are only a matter of International
Law when the granting of them has been arranged by the
belligerents, and not otherwise; except in the case of the safeguards
mentioned by article 8, No. 2, of the Geneva Convention of 1906,
who, according to articles 9 and 12 of that Convention, are
inviolable.

III
FLAGS OF TRUCE

Hall, § 190—Lawrence, § 211—Westlake, II. p. 81—Moore, VII. § 1157—Phillimore,


III. § 115—Halleck, II. pp. 333, 334—Taylor, § 510—Bluntschli, §§ 681-684—
Heffter, § 126—Lueder in Holtzendorff, IV. pp. 421-423—Ullmann, § 180—Bonfils,
Nos. 1239-1245—Despagnet, Nos. 556-557—Pradier-Fodéré, VII. Nos. 2927-2931
—Rivier, II. pp. 279-280—Calvo, IV. §§ 2430-2432—Fiore, III. No. 1378, and Code,
Nos. 1495-1500—Martens, II. § 127—Longuet, §§ 136-138—Mérignhac, pp. 220-
225—Pillet, pp. 356-358—Zorn, pp. 195-199—Meurer, II. §§ 39-40—Bordwell, p.
293—Spaight, pp. 216-231—Kriegsbrauch, pp. 26-29—Holland, War, Nos. 88-91—
Land Warfare, §§ 224-255.

Meaning of Flags of Truce.


§ 220. Although the outbreak of war brings all negotiations
between belligerents to an end, and although no negotiations are as
a rule conducted during war, certain circumstances and conditions
make it necessary or convenient for the armed forces of belligerents
to enter into negotiations with each other for various purposes.
Since time immemorial a white flag has been used as a symbol by an
armed force wishing to negotiate with the enemy, and always and
everywhere it has been considered a duty of the enemy to respect
this symbol. In land warfare the flag of truce is made use of in the
following manner.[435] An individual—soldier or civilian—charged by
his force with the task of negotiating with the enemy, approaches
the latter either carrying the flag himself, or accompanied by a flag-
bearer and, often, also by a drummer, a bugler, or a trumpeter, and
an interpreter. In sea warfare the individual charged with the task of
negotiating approaches the enemy in a boat flying the white flag.
The Hague Regulations have now by articles 32 to 34 enacted most
of the customary rules of International Law regarding flags of truce
without adding any new rule. These rules are the same for land
warfare as for sea warfare, although their validity for land warfare is
now grounded on the Hague Regulations, whereas their validity for
sea warfare is still based on custom only.
[435] See Hague Regulations, article 32.

Treatment of Unadmitted Flag-bearers.


§ 221. As a commander of an armed force is not, according to
article 33 of the Hague Regulations, compelled to receive a bearer of
a flag of truce, a flag-bearer who makes his appearance may at once
be signalled to withdraw. Yet even then he is inviolable from the
time he displays the flag to the end of the time necessary for
withdrawal. During this time he may neither be intentionally attacked
nor made prisoner. However, an armed force in battle is not obliged
to stop its military operations on account of the approach of an
enemy flag-bearer who has been signalled to withdraw. Although the
latter may not be fired upon intentionally, should he be wounded or
killed accidentally, during the battle, no responsibility or moral blame
would rest upon the belligerent concerned. In former times the
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!

ebookname.com

You might also like