from IPython.display import YouTubeVideo
YouTubeVideo('F4rFuIb1Ie4')

## PDF output using pandoc

import os


### Export this notebook as markdown
commandLineSyntax = 'ipython nbconvert --to markdown 20150916_OGC_Reuse_under_licence.ipynb'
print (commandLineSyntax)

os.system(commandLineSyntax)

### Export this notebook and the document header as PDF using Pandoc

commandLineSyntax = 'pandoc  -f markdown -t latex -N -V geometry:margin=1in DocumentHeader.md 20150916_OGC_Reuse_under_licence.md --filter pandoc-citeproc  --latex-engine=xelatex --toc -o 20150916_OGC_Reuse_under_licence.pdf '

os.system(commandLineSyntax)

### Remove cruft from the pdf

commandLineSyntax = 'pdftk 20150916_OGC_Reuse_under_licence.pdf cat 1-4 15-end output outfile_p12-15.pdf'

os.system(commandLineSyntax)



"""
Explanation: Go down for licence and other metadata about this presentation
\newpage
Preamble
Licence
Unless stated otherwise all content is released under a [CC0]+BY licence. I'd appreciate it if you reference this but it is not necessary.

\newpage
Using Ipython for presentations
A short video showing how to use Ipython for presentations
End of explanation
"""


%install_ext https://raw.githubusercontent.com/rasbt/python_reference/master/ipython_magic/watermark.py
%load_ext watermark


%watermark -a "Anthony Beck"  -d -v -m -g

#List of installed conda packages
!conda list

#List of installed pip packages
!pip list

"""
Explanation: The environment
In order to replicate my environment you need to know what I have installed!
Set up watermark
This describes the versions of software used during the creation. 
Please note that critical libraries can also be watermarked as follows:
python
%watermark -v -m -p numpy,scipy
End of explanation
"""


!ipython nbconvert 20150916_OGC_Reuse_under_licence.ipynb --to slides --post serve

"""
Explanation: Running dynamic presentations
You need to install the RISE Ipython Library from Damián Avila for dynamic presentations
To convert and run this as a static presentation run the following command:
End of explanation
"""


#Future proof python 2
from __future__ import print_function #For python3 print syntax
from __future__ import division

# def
import IPython.core.display

# A function to collect user input - ipynb_input(varname='username', prompt='What is your username')

def ipynb_input(varname, prompt=''):
        """Prompt user for input and assign string val to given variable name."""
        js_code = ("""
            var value = prompt("{prompt}","");
            var py_code = "{varname} = '" + value + "'";
            IPython.notebook.kernel.execute(py_code);
        """).format(prompt=prompt, varname=varname)
        return IPython.core.display.Javascript(js_code)
    
# inline

%pylab inline

"""
Explanation: To close this instances press control 'c' in the ipython notebook terminal console
Static presentations allow the presenter to see speakers notes (use the 's' key)
If running dynamically run the scripts below
Pre load some useful libraries
End of explanation
"""


from IPython.display import YouTubeVideo
YouTubeVideo('jUzGF401vLc')

"""
Explanation: About me


Research Fellow, University of Nottingham: orcid
Director, Geolytics Limited - A spatial data analytics consultancy

About this presentation

Available on GitHub - https://github.com/AntArch/Presentations_Github/
Fully referenced PDF

\newpage
A potted history of mapping
In the beginning was the geoword
and the word was cartography

\newpage

Cartography was king. Static representations of spatial knowledge with the cartographer deciding what to represent.
\newpage
And then there was data .........

\newpage

Restrictive data
\newpage

Making data interoperable and open
\newpage
Technical interoperability - levelling the field

\newpage
Facilitating data driven visualization

From Map to Model The changing paradigm of map creation from cartography to data driven visualization
\newpage

\newpage

\newpage

\newpage
What about non-technical interoperability issues?

Issues surrounding non-technical interoperability include:

Policy interoperabilty
Licence interoperability
Legal interoperability
Social interoperability

We will focus on licence interoperability
\newpage

There is a multitude of formal and informal data. 
\newpage

Each of these data objects can be licenced in a different way. This shows some of the licences described by the RDFLicence ontology
\newpage
What is a licence?
Wikipedia state:

A license may be granted by a party ("licensor") to another party ("licensee") as an element of an agreement between those parties. 
A shorthand definition of a license is "an authorization (by the licensor) to use the licensed material (by the licensee)."


Concepts (derived from Formal Concept Analysis) surrounding licences
\newpage
Two lead organisations have developed legal frameworks for content licensing:

Creative Commons (CC) and 
Open Data Commons (ODC). 

Until the release of CC version 4, published in November 2013, the CC licence did not cover data. Between them, CC and ODC licences can cover all forms of digital work.

There are many other licence types
Many are bespoke
Bespoke licences are difficult to manage
Many legacy datasets have bespoke licences




I'll describe CC in more detail
\newpage
Creative Commons Zero
Creative Commons Zero (CC0) is essentially public domain which allows:

Reproduction
Distribution
Derivations

Constraints on CC0
The following clauses constrain CC0:

Permissions
ND – No derivatives: the licensee can not derive new content from the resource.


Requirements
BY – By attribution: the licensee must attribute the source.
SA – Share-alike: if the licensee adapts the resource, it must be released under the same licence.


Prohibitions
NC – Non commercial: the licensee must not use the work commercially without prior approval.



CC license combinations
License|Reproduction|Distribution|Derivation|ND|BY|SA|NC
----|----|----|----|----|----|----|----
CC0|X|X|X||||
CC-BY-ND|X|X||X|X||
CC-BY-NC-ND|X|X||X|X||X
CC-BY|X|X|X||X||
CC-BY-SA|X|X|X||X|X|
CC-BY-NC|X|X|X||X||X
CC-BY-NC-SA|X|X|X||X|X|X
Table: Creative Commons license combinations
\newpage
Why are licenses important?

They tell you what you can and can't do with 'stuff'
Very significant when multiple datasets are combined
It then becomes an issue of license compatibility




\newpage
Which is important when we mash up data
Certain licences when combined:

Are incompatible
Creating data islands


Inhibit commercial exploitation (NC)
Force the adoption of certain licences
If you want people to commercially exploit your stuff don't incorporate CC-BY-NC-SA data!


Stops the derivation of new works


A conceptual licence processing workflow. The licence processing service analyses the incoming licence metadata and determines if the data can be legally integrated and any resulting licence implications for the derived product.
\newpage
A rudimentry logic example
```text
Data1 hasDerivedContentIn NewThing.
Data1 hasLicence a cc-by-sa.
What hasLicence a cc-by-sa? #reason here
If X hasDerivedContentIn Y and hasLicence Z then Y hasLicence Z. #reason here
Data2 hasDerivedContentIn NewThing.
Data2 hasLicence a cc-by-nc-sa.
What hasLicence a cc-by-nc-sa? #reason here
Nothing hasLicence a cc-by-nc-sa and hasLicence a cc-by-sa. #reason here
```
And processing this within the Protege reasoning environment
End of explanation
"""


from IPython.display import YouTubeVideo
YouTubeVideo('tkRB5Rp1_W4')


"""
Explanation: \newpage
Here's something I prepared earlier
A live presentation (for those who weren't at the event).....
End of explanation
"""


