How to fit a tight ellipse around nodes
after some effort to make your code more consistent and shorter and define new node style FIT
by which options you can define its inner sep according to your needs, i obtain the following result:
\documentclass[10pt,aspectratio=1610]{beamer}
\usepackage{tikz}
\usetikzlibrary{arrows,
backgrounds,
fit,
positioning,
quotes,
shapes}
\begin{document}
\begin{frame}[fragile]
\frametitle{Example}
\begin{center}
\begin{tikzpicture}[
scale = 0.95, transform shape,
node distance = 22mm and 11mm,
res/.style = {ellipse, draw, minimum height=0.5cm, minimum width=0.8cm,
font=\footnotesize },
literal/.style = {rectangle, draw, minimum height=0.5cm, text width=1.2 cm,
align=center, font=\footnotesize},
FIT/.style args = {#1/#2/#3}{ellipse, fill=#1, inner xsep=#2, fit=#3},
every edge quotes/.style = {fill=white, inner sep=1pt, font=\footnotesize},
]
\node[res] (obs1) {:obs1} ;
\node[res, left = 1cm of obs1] (shop1) {:shop1} ;
\node[literal, left = of shop1] (shopName1) {``Barnes \& Noble''} ;
\node[res, above of = shop1] (book1) {\footnotesize :book1} ;
\node[literal, left = of book1] (bookName1) {``Dune''} ;
\node[res, below of = obs1] (obs2) {:obs2} ;
\node[res, left = of obs2] (shop2) {:shop2} ;
\node[literal, left = of shop2] (shopName2) {``Amazon''} ;
\node[res, below of = shop2] (book2) {:book2} ;
\node[literal, left = of book2] (bookName2) {``Dracula''} ;
\node[literal, below of = obs2] (measure2) {12} ;
\node[literal, above of = obs1] (measure1) {7} ;
\node[literal, right = of obs1] (monthName) {``January''} ;
\node[literal, right = of measure1] (yearNum) {``2016''} ;
\node[res, right = of monthName] (month) {:january2016} ;
\node[res, above = of month] (year) {:2016} ;
\node[res, below = of month] (day) {\:date31012016} ;
\path[->,draw]
(obs1) edge [":shop"] (shop1)
(obs2) edge [":shop"] (shop2)
(obs1) edge [":book"] (book1)
(obs2) edge [":book"] (book2)
(book1) edge [":name"] (bookName1)
(book2) edge [":name"] (bookName2)
(shop1) edge [name=title1,":title"] (shopName1)
(shop2) edge [name=title2,":title"] (shopName2)
(obs1) edge [":price"] (measure1)
(obs2) edge [":price"] (measure2)
(obs1) edge [":date"] (day)
(obs2) edge [":date"] (day)
(day) edge ["skos:broader"] (month)
(month) edge ["skos:broader"] (year)
(month) edge [":month"] (monthName)
(year) edge [":year"] (yearNum)
;
\begin{pgfonlayer}{background}
\node[FIT=violet!30/-2mm/(shopName1)(shop1)] {};
\node[FIT=violet!30/-2mm/(shopName2)(shop2)] {};
\node[FIT=violet!30/-2mm/(bookName2)(book2)] {};
\node[FIT=violet!30/-2mm/(bookName1)(book1)] {};
\node[FIT=blue!30/1mm/(measure1)(obs1),inner ysep=0mm] {};
\node[FIT=blue!30/1mm/(measure2)(obs2),inner ysep=0mm] {};
\node[FIT=blue!30/-3mm/(year)(yearNum),rotate=10] {};
\node[FIT=blue!30/-3mm/(month)(monthName)] {};
\end{pgfonlayer}
\end{tikzpicture}
\end{center}
\end{frame}
\end{document}
If Jake's answer doesn't like or doesn't work for you, may be you could consider other shapes like rounded rectangle
or just a rectangle with rounded corners
.
Following code uses rounded rectangles
for horizontal associations. As I could not manage to build a vertical rounded rectangle and cylinders doesn't fit very well, two rectangles with rounded corners are used for vertical associations.
\documentclass[10pt,aspectratio=1610]{beamer}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,backgrounds,fit,positioning}
\begin{document}
\tikzset{res/.style={ellipse,draw,minimum height=0.5cm,minimum width=0.8cm}}
\tikzset{literal/.style={rectangle,draw,minimum height=0.5cm,minimum width=0.8cm,text width = 1.2 cm, align = center}}
\tikzset{hfit/.style={rounded rectangle, inner xsep=0pt, fill=#1!30},
vfit/.style={rounded corners, fill=#1!30}}
\begin{frame}[fragile]{Example}{}
\begin{tikzpicture}[node distance = 2 cm,auto, ]
\node[res,] (obs1) {\footnotesize :obs1} ;
\node[res, left = 1cm of obs1] (shop1) {\footnotesize :shop1} ;
\node[literal, left = 1cm of shop1] (shopName1) {\footnotesize ``Barnes \& Noble''} ;
\node[res, above of = shop1] (book1) {\footnotesize :book1} ;
\node[literal, left = 1cm of book1] (bookName1) {\footnotesize ``Dune''} ;
\node[res, below of = obs1] (obs2) {\footnotesize :obs2} ;
\node[res, left = 1cm of obs2] (shop2) {\footnotesize :shop2} ;
\node[literal, left = 1cm of shop2] (shopName2) {\footnotesize ``Amazon''} ;
\node[res, below of = shop2] (book2) {\footnotesize :book2} ;
\node[literal, left = 1cm of book2] (bookName2) {\footnotesize ``Dracula''} ;
\node[literal, below of = obs2] (measure2) {\footnotesize 12} ;
\node[literal, above of = obs1] (measure1) {\footnotesize 7} ;
\node[literal, right = 1cm of obs1] (monthName) {\footnotesize ``January''} ;
\node[literal, right = 1cm of measure1] (yearNum) {\footnotesize ``2016''} ;
\node[res, right = 1cm of monthName] (month) {\footnotesize :january2016} ;
\node[res, above of = month] (year) {\footnotesize :2016} ;
\node[res, below of = month] (day) {\footnotesize :date31012016} ;
\path[->,draw]
(obs1) edge node[midway,above=-6pt,fill=white,inner sep=0pt] {\footnotesize :shop} (shop1)
(obs2) edge node[midway,above=-6pt,fill=white,inner sep=0pt] {\footnotesize :shop} (shop2)
(obs1) edge node[midway,above=-6pt,fill=white] {\footnotesize :book} (book1)
(obs2) edge node[midway,above=-6pt,fill=white] {\footnotesize :book} (book2)
(book1) edge node[midway,above=-6pt,fill=white,inner sep=0pt] {\footnotesize :name} (bookName1)
(book2) edge node[midway,above=-6pt,fill=white,inner sep=0pt] {\footnotesize :name} (bookName2)
(shop1) edge node[midway,above=-6pt,fill=white] (title1) {\footnotesize :title} (shopName1)
(shop2) edge node[midway,above=-6pt,fill=white] (title2) {\footnotesize :title} (shopName2)
(obs1) edge node[midway,above=-6pt,fill=white] {\footnotesize :price} (measure1)
(obs2) edge node[midway,above=-6pt,fill=white] {\footnotesize :price} (measure2)
(obs1) edge node[midway,above=-6pt,fill=white] {\footnotesize :date} (day)
(obs2) edge node[midway,above=-6pt,fill=white] {\footnotesize :date} (day)
(day) edge node[midway,above=-6pt,fill=white] {\footnotesize skos:broader} (month)
(month) edge node[midway,above=-6pt,fill=white] {\footnotesize skos:broader} (year)
(month) edge node[midway,above=-6pt,fill=white,inner sep=0pt] {\footnotesize :month} (monthName)
(year) edge node[midway,above=-6pt,fill=white] {\footnotesize :year} (yearNum)
;
\begin{pgfonlayer}{background}
\node[fit=(shopName1)(shop1), hfit=violet] {};
\node[fit=(shopName2)(shop2), hfit=violet] {};
\node[fit=(bookName2)(book2), hfit=violet] {};
\node[fit=(bookName1)(book1), hfit=violet] {};
\node[fit=(measure1)(obs1), vfit=blue] {};
\node[fit=(measure2)(obs2), vfit=blue] {};
\node[fit=(year)(yearNum), hfit=green] {};
\node[fit=(month)(monthName), hfit=green] {};
\end{pgfonlayer}
\end{tikzpicture}
\end{frame}
\end{document}