summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/latex/tkz-orm/Makefile24
-rw-r--r--Master/texmf-dist/doc/latex/tkz-orm/README22
-rw-r--r--Master/texmf-dist/doc/latex/tkz-orm/tkz-orm.pdfbin276228 -> 417488 bytes
-rw-r--r--Master/texmf-dist/doc/latex/tkz-orm/tkz-orm.tex325
-rw-r--r--Master/texmf-dist/tex/latex/tkz-orm/tkz-orm.sty809
5 files changed, 880 insertions, 300 deletions
diff --git a/Master/texmf-dist/doc/latex/tkz-orm/Makefile b/Master/texmf-dist/doc/latex/tkz-orm/Makefile
index a208f6babd7..c85dea39b6e 100644
--- a/Master/texmf-dist/doc/latex/tkz-orm/Makefile
+++ b/Master/texmf-dist/doc/latex/tkz-orm/Makefile
@@ -4,11 +4,12 @@
help:
@echo ""
- @echo " make clean - clean out directory"
- @echo " make tidy - clean out directory some more"
- @echo " make ctan - create a CTAN-ready archive"
- @echo " make doc - typeset documentation"
- @echo " make install - install files in local texmf tree"
+ @echo " make clean - clean out directory"
+ @echo " make tidy - clean out directory some more"
+ @echo " make examples - create examples as PDF and PNG"
+ @echo " make ctan - create a CTAN-ready archive"
+ @echo " make doc - typeset documentation"
+ @echo " make install - install files in local texmf tree"
@echo ""
################################################################
@@ -91,6 +92,17 @@ $(PACKAGE).blg $(PACKAGE).bbl: $(PACKAGE).tex $(PACKAGE).bib $(PACKAGE).aux
rm -f $$NAME.$$I ; \
done
+%.png: %.tex
+ @sed 's/^\\begin{document}/\
+\\pgfrealjobname{dummy}\\begin{document}\\beginpgfgraphicnamed{example}/' $< | \
+sed 's/^\\end{document}/\\endpgfgraphicnamed\\end{document}/' > example.tex ; \
+ pdflatex --jobname=example example.tex ; \
+ gs -dNOPAUSE -r120 -dGraphicsAlphaBits=4 -dTextAlphaBits=4 -sDEVICE=png16m \
+-sOutputFile=$@ -dBATCH example.pdf ; \
+ convert -thumbnail 200 $@ $(addsuffix .thumb.png, $(basename $@)) ; \
+ mv example.pdf $(addsuffix .pdf, $(basename $<)) ; rm example.*
+
+
################################################################
# User make options #
################################################################
@@ -123,6 +135,8 @@ ctan: doc
doc: $(foreach FILE,$(INCLUDEPDF),$(FILE).pdf)
+examples: $(foreach FILE,$(wildcard examples/*.tex),$(basename $(FILE)).png)
+
install:
echo Installing $(PACKAGE).sty
TEXMFHOME=`kpsewhich --var-value=TEXMFHOME` ; \
diff --git a/Master/texmf-dist/doc/latex/tkz-orm/README b/Master/texmf-dist/doc/latex/tkz-orm/README
index 443ec499c30..c38f5ba5e4b 100644
--- a/Master/texmf-dist/doc/latex/tkz-orm/README
+++ b/Master/texmf-dist/doc/latex/tkz-orm/README
@@ -1,21 +1,23 @@
================================================================
tkz-orm -- Object-Role Modeling diagrams in TeX
- version 0.1, January 25th, 2010
+ version 0.1.4, January 15th, 2016
== ABOUT =======================================================
See the file tkz-orm.pdf for a manual.
The permanent URL of this package is:
-
http://purl.org/net/tkz-orm
+Source code repository and issue tracker are located at:
+ http://github.com/nichtich/tkz-orm
+
== INSTALLATION =================================================
-The current version of tkz-orm requires a developer version of
-TikZ which you can get from http://www.texample.net/tikz/builds/
-Put the content of the zip (pgfCVSYYYY-MM-DD_TDS.zip) in your
-local texmf directory, for instance ~/texmf or /usr/share/texmf/.
+The current version of tkz-orm requires at least TikZ 2.1. You
+can get it from http://www.texample.net/tikz/builds/. Put the
+content of the zip (pgfCVSYYYY-MM-DD_TDS.zip) in your local
+texmf directory, for instance ~/texmf or /usr/share/texmf/.
To install tkz-orm you can use the Makefile and run
@@ -40,8 +42,16 @@ See the file LICENSE for details.
tkz-orm.sty - code of this package (LaTeX style file)
tkz-orm.pdf - manual in PDF format
tkz-orm.tex - LaTeX source of the manual
+ tkz-orm.bib - BibTeX source of the manual
+ ormcheatsheet.tex - ORM2 cheat sheet (sources)
+ ormcheatsheet.pdf - ORM2 cheat sheet in PDF format
pgfmanualstyle.sty - Style file to build the manual
LICENSE - information about licenses of this package
Makefile - makefile for various tasks
README - this file
+== FEEDBACK =====================================================
+
+Please report bug reports and feature requests at
+ http://github.com/nichtich/tkz-orm/issues
+
diff --git a/Master/texmf-dist/doc/latex/tkz-orm/tkz-orm.pdf b/Master/texmf-dist/doc/latex/tkz-orm/tkz-orm.pdf
index 3f206ce08c8..3f240bdb799 100644
--- a/Master/texmf-dist/doc/latex/tkz-orm/tkz-orm.pdf
+++ b/Master/texmf-dist/doc/latex/tkz-orm/tkz-orm.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/tkz-orm/tkz-orm.tex b/Master/texmf-dist/doc/latex/tkz-orm/tkz-orm.tex
index e0b4b4f708a..dd540d79a6e 100644
--- a/Master/texmf-dist/doc/latex/tkz-orm/tkz-orm.tex
+++ b/Master/texmf-dist/doc/latex/tkz-orm/tkz-orm.tex
@@ -7,14 +7,14 @@
\usetikzlibrary{positioning} % for left/right=of ...
\usepackage[colorlinks=false,pdfborder={0 0 0}]{hyperref}
-% [pagebackref=true, backref=true, pdfborder={0 0 0}
+% [pagebackref=true, backref=true
\usepackage{multirow}
\usepackage{makeidx}
\makeindex
-\def\ormVersion{0.1}
-\def\ormDate{January 25th, 2010}
+\def\ormVersion{0.1.4}
+\def\ormDate{January 15, 2016}
\newif\ifappendix
\appendixfalse
\appendixtrue
@@ -22,16 +22,16 @@
% --------------------------------------------------------------
%% Beginning of the documentation
% --------------------------------------------------------------
-\title{The \textsf{tkz-orm} package\\Object-Role Model Drawing Library}
-\author{Jakob Vo\ss\\{\footnotesize jakob.voss@gbv.de}}
+\title{The \tkzorm\ package\\Object-Role Model Drawing Library}
+\author{Jakob Vo\ss\footnote{jakob.voss@gbv.de}, Camil Staps\footnote{info@camilstaps.nl}}
\date{Version \ormVersion\\\ormDate\\[5mm]\url{http://purl.org/net/tkz-orm}}
\begin{document}
\maketitle
-\begin{abstract}
-This package provides styles for drawing Object-Role Model (ORM)
-diagrams in \TeX{} based on the \textsc{pgf} and \tikzname\ picture environment.
+\begin{abstract}\noindent
+This package provides styles for drawing Object-Role Model (ORM2) diagrams
+in \TeX\ based on the \textsc{pgf} and \tikzname\ picture environment.
\end{abstract}
\tableofcontents
@@ -40,20 +40,21 @@ diagrams in \TeX{} based on the \textsc{pgf} and \tikzname\ picture environment.
\section{Introduction}
\label{sec:introduction}
-\textsf{tkz-orm} is intended to help you creating Object-Role Model (ORM) diagrams. It is based on the \textsc{pgf} and \tikzname\footnote{\url{http://sourceforge.net/projects/pgf/}} picture macro package for \TeX. and provides additional styles and commands to typeset ORM~2 diagrams.\footnote{This version is tested with \tikzname{} version 2.00-cvs 2009-09-04. It will either be backported to \tikzname{} version 2.00 or work with a yet to published new release of \tikzname{}} With \textsf{tkz-orm} you can ``program'' ORM diagrams just as you ``program'' your document when you use \LaTeX\ -- including the inherental lack of \textsc{wysiwyg}. Unless multi-touch e-paper interfaces become usable, \textsf{tkz-orm} can best be combined with a whiteboard or paper and pencil --- but you may also find ways to automatically create ORM diagrams with \textsf{tkz-orm}.
+\tkzorm\ is intended to help you creating Object-Role Model (ORM) diagrams. It is based on the \textsc{pgf} and \tikzname\footnote{Available at \url{http://sourceforge.net/projects/pgf/}.\\This document was created with \tikzname\ version \pgftypesetversion} picture macro package for \TeX. and provides additional styles and commands to typeset ORM2 diagrams. With \tkzorm\ you can ``program'' ORM diagrams just as you ``program'' your document when you use \LaTeX\ -- including the inherental lack of \textsc{wysiwyg}. Unless multi-touch e-paper interfaces become usable, \tkzorm\ can best be combined with a whiteboard or paper and pencil --- but you may also find ways to automatically create ORM diagrams with \tkzorm.
\subsection*{Status of this package}
-This is the first public version of \textsf{tkz-orm}. Please send your comments to the author so the package can be improved. All parts of the package are available at least under the \LaTeX{} Project Public License\cite{LPPL} and the GNU Public license\cite{GPL2}. For details have a look at the file |LICENSE| that is part of this package. The permament URL of \textsf{tkz-orm} is \url{http://purl.org/net/tkz-orm} which redirects you to its current location.
+This is the developer version of \tkzorm. Please send your comments to the author so the package can be improved. All parts of the package are available at least under the \LaTeX{} Project Public License\cite{LPPL} and the GNU Public license\cite{GPL2}. For details have a look at the file |LICENSE| that is part of this package. The permament URL of \tkzorm is \url{http://purl.org/net/tkz-orm} which redirects you to its current location and a collection of examples.
\subsection*{ORM in a nutshell}
-Object-Role Modeling (ORM)\footnote{\url{http://www.orm.net/}} is a fact-oriented modeling language that evolved from the \textit{Natural-language Information Analysis Method} (NIAM) by G.M. Nijssen. The current version (ORM~2) is mainly based on works of Terry Halpin. Like ERM, UML, and other data modeling languages ORM helps to identify and abstract information objects, relationships, and rules in a Universe of Discourse to be formalized and implemented on another level. ORM includes a graphical notation and a defined verbalization in natural language. Models can further be validated by populating fact tables with sample data. An overview of the ORM~2 Graphical Notation is given in \cite{Halpin2005} and more details in \cite{Halpin2008}. An ORM model consists of object types (section~\ref{sec:objecttypes}), $n$-ary predicates (section~\ref{sec:predicates}). Each of the $n$ roles of an $n$-ary predicate is connected to an object type that plays the specific role in this predicate. Furthermore a model can contain constraints (section~\ref{sec:constraints}) and additional features (section~\ref{sec:additionalfeatures}). \textsf{tkz-orm} also allows you to change the appearance of ORM diagrams (section~\ref{sec:generalstyles}).
+Object-Role Modeling (ORM)\footnote{See \url{http://www.orm.net/}.} is a fact-oriented modeling language that evolved from the \textit{Natural-language Information Analysis Method} (NIAM) by G.M. Nijssen. The current version (ORM2) is mainly based on works of Terry Halpin. Like ERM, UML, and other data modeling languages ORM helps to identify and abstract information objects, relationships, and rules of a Universe of Discourse to be formalized and implemented on another level. ORM includes a graphical notation and a precise verbalization in natural language. Models can further be validated by populating fact tables with sample data. An overview of the ORM2 graphical notation is given in \cite{Halpin2005} and more details in \cite{Halpin2008}. An ORM model consists of object types (section~\ref{sec:objecttypes}) and predicates (section~\ref{sec:predicates}). Each of the $n$ roles of an $n$-ary predicate is connected to an object type that plays the specific role in this predicate. Furthermore a model can contain constraints (section~\ref{sec:constraints}), subtypes (section~\ref{sec:subtyping}), and other features (section~\ref{sec:additionalfeatures}). \tkzorm also allows you to change the appearance of ORM diagrams (section~\ref{sec:generalstyles}).
\begin{figure}[ht]
+ \centering
\begin{tikzpicture}
\entity (A) at (0,0) {A};
\entity[right=of A] (blank) {};
\value[right=of blank] (value) {Value type};
- \entity[right=of value,text width=1.75cm] (fixedwidth) {Person with red hair};
+ \entity[right=of value] (fixedwidth) {Person};
\entity[right=of fixedwidth] (tabular) {Activity\\(Code)};
\entity[right=of tabular] (typenamelabel) {Type name\\(.reference)};
\entity[right=of typenamelabel,zoomed] () {Zoomed};
@@ -64,7 +65,7 @@ Object-Role Modeling (ORM)\footnote{\url{http://www.orm.net/}} is a fact-oriente
\pagebreak
\section{Object Types}
\label{sec:objecttypes}\index{Object types}\index{Entities}\index{Values}
-Object types are drawn as rectangles with rounded corners. The object's type name is written as node text inside. \emph{Entity types} use solid border lines and \emph{value types} use dashed border lines. The minimal size of an object is set to 6mm$\times$6mm. This package provides the following styles for entities and values:
+Object types are drawn as rectangles with rounded borders. The object's type name is written as node text inside. \emph{Entity types} use solid border lines and \emph{value types} use dashed border lines. The minimal size of an object is set to 6mm$\times$6mm. This package provides the following styles for entities and values:
\begin{stylekey}{entity}
This style is to be used with nodes that represent entity types.
@@ -72,7 +73,7 @@ This style is to be used with nodes that represent entity types.
\begin{tikzpicture}
\node[entity] at (0,0) {Foo};
\node[entity] (unnamed) at (1.2,0) {};
- \node[entity] at (2.5,0) {Person\\(.Id)};
+ \node[entity] at (2.5,0) {Person\\(.name)};
\end{tikzpicture}
\end{codeexample}
\end{stylekey}
@@ -86,24 +87,46 @@ This style is to be used with nodes that represent value types.
\end{codeexample}
\end{stylekey}
+\begin{stylekey}{power}
+This style is to be used with nodes that represent power types.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[entity,power=below:As] {A};
+ \node[entity,power=Bs] at (1.1,0) {B};
+ \node[entity,power] at (2.2,0) {C};
+\end{tikzpicture}
+\end{codeexample}
+\end{stylekey}
+
+\begin{stylekey}{sequence}
+This style is to be used with nodes that represent sequence types.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[entity,sequence=below:As] {A};
+ \node[entity,sequence=Bs] at (1.1,0) {B};
+ \node[entity,sequence] at (2.2,0) {C};
+\end{tikzpicture}
+\end{codeexample}
+\end{stylekey}
+
\begin{stylekey}{every entity}
-\stylekeyheadline{every value}
-Each of this styles is envoked by the styles |entity| or |value|. Change one of this styles to change the appearance of entity or value types.
+\stylekeyheadline[]{every value}
+Each of this styles is envoked by the styles \sty{entity} or \sty{value}. Change one of this styles to change the appearance of entity or value types.
\begin{codeexample}[width=3cm]
\begin{tikzpicture}[
every entity/.style={draw=blue!50,fill=blue!20},
every value/.style={draw=green!50,fill=green!20}]
\node[entity] (P) at (0,0) {Person};
- \node[value] (N) at (0,-1) {Name};
+ \node[value] (N) at (1.5,0) {Name};
\end{tikzpicture}
\end{codeexample}
\end{stylekey}
-\begin{stylekey}{every object type}
- This style is envoked by the styles |entity| and |value|. Change this style to change the common appearance of entity and value types.
+\begin{stylekey}{every object}
+ This style is envoked by the styles \sty{entity} and \sty{value}. Change this style to change the common appearance of entity and value types.
\begin{codeexample}[width=3cm]
\begin{tikzpicture}[
- every object type/.style={shape=circle}]
+ every object/.style={shape=rectangle,draw=red}]
\node[entity] (P) at (0,0) {Person};
\node[value] (N) at (1.5,0) {Name};
\end{tikzpicture}
@@ -122,52 +145,53 @@ Inside |{tikzpicture}| this is an abbreviation for |\node[value]|.
\end{command}
-
\section{Predicates and Roles}
\label{sec:predicates}\index{predicates}\index{roles}
-The relationship parts (\emph{roles}) played by objects are shown as boxes of fixed size (4mm$\times$2.5mm). A \emph{predicate} is a sequence of one or more concatenated role boxes. Predicates can be created with the following styles:
+Relationship parts (\emph{roles}) played by objects are shown as boxes of fixed size (4mm$\times$2.5mm). A \emph{predicate} is a sequence of one or more concatenated role boxes. Predicates can be created with the following styles:
\begin{stylekey}[\opt{\meta{number of roles}}]{roles}
-\stylekeyheadline[ (alias for \texttt{roles=1})]{role}
+\stylekeyheadline[\opt{1}]{role}
Shapes the current node as predicate with a given number of role boxes. Numbers from 1 to 20 are supported. The default value is 2 (binary).
\begin{codeexample}[]
\begin{tikzpicture}[orm]
- \entity (A) {A};
- \entity (B) at (2.8,0) {B}
+ \entity (A) at (0,1) {A};
+ \entity (B) at (2.8,1) {B}
edge node[roles=3] (p) {} (A);
- \entity (C) at (1.4,-1) {C}
- edge (p.south);
- \node[role] at (2.2,-1){} edge (C);
+ \entity (C) at (1.4,0) {C} edge (p.south);
+ \node[role] at (2.2,0){} edge (C);
\draw (A) |- node[roles,xshift=2mm]{} (C);
\end{tikzpicture}
\end{codeexample}
\end{stylekey} % roles
\begin{stylekey}[\opt{\meta{number of roles}}]{vroles}
-\stylekeyheadline[ (alias for \texttt{vroles=1})]{vrole}
+\stylekeyheadline[\opt{1}]{vrole}
Shapes the current node as predicate rotated by 90 degree (vertical).
\end{stylekey} % vroles
\begin{stylekey}{relation}
- \stylekeyheadline[]{relationship}
- This styles are to be used with connection lines between objects and roles. By default it just sets the line width to 0.25mm by including the style |every orm line|. Alternatively of using this style you can enable the general style |orm| (see section~\ref{sec:generalstyles}) and just draw a normal line.
+\stylekeyheadline[]{relationship}
+\stylekeyheadline[]{plays}
+ This equivalent styles are to be used with connection lines between objects and roles. By default it just includes the style \sty{every orm line} which results in a solid, black line of 0.25mm width.
+% Alternatively of using this style you can enable the general style \sty{orm}
+% (see section~\ref{sec:generalstyles}) and just draw a normal line.
\begin{codeexample}[width=3cm]
\begin{tikzpicture}
- \node[entity] (A) {A};
+ \node[entity,power] (A) {A};
\node[roles] (r) at (1,0) {};
- \draw[relation] (A) -- (r);
+ \draw[relation] (A-power) -- (r);
\node[vrole] at (0,-.8){} edge[relation] (A);
\end{tikzpicture}
\end{codeexample}
\end{stylekey}
\noindent
-Table~\ref{tab:roleabbr} lists abbreviations that can be used for creating predicate nodes and relationship lines inside |{tikzpicture}|.
+The following table lists abbreviations that can be used for creating predicate nodes and relationship lines inside |{tikzpicture}|:
-\begin{table}[h]
+\begin{table}[ht]
\begin{tabular}{lll}
-\textbf{Command(s)} & \textbf{Abbreviation for} & \\
+\textbf{command(s)} & \textbf{abbreviation for} & \\
\commandentry{unary} or \commandentry{role} & |\node[role]| &
\colorbox{graphicbackground}{\tikz \unary{};} \\
\commandentry{binary} or \commandentry{roles} & |\node[roles]| &
@@ -187,14 +211,12 @@ Table~\ref{tab:roleabbr} lists abbreviations that can be used for creating predi
\commandentry{plays} & |\draw[relationship]| &
\colorbox{graphicbackground}{\tikz \plays (0,0) -- (1,0);} \\
\end{tabular}
-\caption{Abbreviations to create predicates, roles, and relationship lines}
-\label{tab:roleabbr}
\end{table}
\noindent The general style of predicates and roles can be modified by the following keys:
\begin{stylekey}{every predicate}
-By changing this style you can modify the common appearance of predicates.
+Changing this style to modify the common appearance of predicates.
\begin{codeexample}[width=3cm]
\begin{tikzpicture}[
every predicate/.style={draw=blue,fill=green!20}]
@@ -206,21 +228,19 @@ By changing this style you can modify the common appearance of predicates.
\end{stylekey}
\begin{stylekey}{every relationship}
- This style is envoked by the style |relationship|. To change the appearance of explicit relationship lines you can change this style. Please keep in mind that nodes placed on a line by |node| in one operation inherit properties from the line they refer to, so you should create relationship lines with |plays|.
+ This style is envoked by the style \sty{relationship}. To change the appearance of explicit relationship lines you can change this style. Please keep in mind that nodes placed on a line by |node| in one operation inherit properties from the line they refer to, so you should create relationship lines with \cmd{plays}.
\begin{codeexample}[width=3cm]
\begin{tikzpicture}[orm,
every relationship/.style={draw=blue,dotted}]
- \entity (A) {A};
- \binary (r) at (1,0) {};
- \entity (B) at (2,0) {B};
- \plays (A) -- (r) -- (B);
+ \entity (A) {A};
+ \plays (A) to node[roles]{} (2,0) node(B){B};
\vunary at (0,-0.8) (r) {} edge[relation] (A);
\end{tikzpicture}
\end{codeexample}
\end{stylekey}
\noindent
-Predicates are drawn either horizontally (|roles|) or vertically (|vroles|) as nodes with one or more parts. Figure~\ref{fig:hanchors} shows some of the anchors. Vertical predicates are rotated by 90 degree so |north| is at the left, |west| is at the bottom etc.
+Predicates are drawn either horizontally (\sty{roles}) or vertically (\sty{vroles}) as nodes with one or more parts. Figure~\ref{fig:hanchors} shows some of the anchors. Vertical predicates are rotated by 90 degree so |north| is at the left, |west| is at the bottom etc.
% TODO: define better anchors or anchor aliases (start=west, end=east, top=north, bottom=south, role 1=one north)
\begin{figure}[h]
@@ -240,22 +260,27 @@ Predicates are drawn either horizontally (|roles|) or vertically (|vroles|) as n
node[\placement] {\scriptsize\texttt{s.\anchor}};
\end{tikzpicture}
\end{codeexample}
-\label{fig:hanchors}
\caption{Node anchors of an ORM predicate}
+\label{fig:hanchors}
\end{figure}
\noindent
-The verbalization of a predicate can be given as |label| next to a predicate. For binary relationships forward and inverse readings can be seperated by a slash. To show the inverse reading, add an arrow tip with the commands |\ormleft| or |\ormup| (see section~\ref{sec:ormtext}). Labels for predicates with more then two roles must contain three dots (|\ldots|) for each inner role. Role names and indices can be added by different styles.
-% TODO: Show how to change label distance
+The verbalization of a predicate can be given as |label| next to a predicate. For binary relationships forward and inverse readings can be seperated by a slash. To show the inverse reading, add an arrow tip with the commands \cmd{ormleft} or \cmd{ormup}. Labels for predicates with more then two roles must contain three dots (|\ldots|) for each inner role. Role names and indices can be added by different styles.
+% TODO: Show how to change label distance with style |label distance| :
+% \begin{tikzgraphic}[orm] % needed - there is no "every label/.style={orm}"
+% \node[role,label={R}] (r1) {}; % put the label above
+% \node[role,right=of r1,label={below:R}] (r2) {}; % put the label below
+% \node[role,right=of r2,label={[label distance=1.5mm]above:{R}},unique] (r3) {};
+% \end{tikzgraphic}
\begin{figure}[h]
\centering
\begin{codeexample}[]
\begin{tikzpicture}[orm]
- \entity at (0,2) (P) {Person};
- \entity at (3,2) (C) {Car};
+ \entity at (0,3) (P) {Person};
+ \entity at (3,3) (C) {Car};
\entity at (0,0) (L) {License};
- \entity at (6.6,2) (M) {Maker};
+ \entity at (6.6,3) (M) {Maker};
\unary[label=valid] at (1.2,0) (V) {} edge (L);
\draw (P) to node[roles,
label=below:drives,label=\ormleft{is driven by}]{} (C);
@@ -297,13 +322,18 @@ Adds a role index as small label at the $n$th role box (default: $n$).
\section{Constraints}
\label{sec:constraints}\index{Constraints}
-ORM provides a rich set of constraints: Mandatory constraints (section~\ref{sec:mandatoryconstraints}) and uniqueness constraints (section~\ref{sec:uniquenessconstraints}) limit the way objects can be combined in predicates. External constraints (section~\ref{sec:externalconstraints}) and subtype constraints (section~\ref{sec:subtyping}) involve multiple roles or object types. All constraints are displayed in violet color and either drawn directly at an object type or role, or linked to one or more object types or role with dotted or dashed lines or arrows (see the styles |limits| and |limits to|). ORM~2 defines a set of symbols for external (section~\ref{sec:externalconstraints}), ring (section~\ref{sec:ringconstraints}) and other types of constraints. The general \textsc{tkz-orm} constraint key |constraint| only sets the font to violet. An optional key value can be used to add a predefined constraint symbol at the current position.
+ORM provides a rich set of constraints: Mandatory constraints (section~\ref{sec:mandatoryconstraints}) and uniqueness constraints (section~\ref{sec:uniquenessconstraints}) limit the way objects can be combined in predicates. External constraints (section~\ref{sec:externalconstraints}) and subtype constraints (section~\ref{sec:subtyping}) involve multiple roles or object types. All constraints are displayed in magenta and either drawn directly at an object type or role, or linked to one or more object types or role with dotted or dashed lines or arrows (see the styles \sty{limits} and \sty{limits to}). ORM2 defines a set of symbols for external (section~\ref{sec:externalconstraints}), ring (section~\ref{sec:ringconstraints}) and other types of constraints. The general \textsc{tkz-orm} constraint key \sty{constraint} only sets the font to violet. An optional key value can be used to add a predefined constraint symbol at the current position.
+\begin{stylekey}[\meta{color}]{constraintcolor}
+Changes the constraint color (default: |magenta!100|).
+\end{stylekey}
\subsection{Uniqueness Constraints}
\label{sec:uniquenessconstraints}
By default every row in a fact table is unique. To express additional uniqueness constraints on one or more roles of a fact table or to explicitly express the uniqueness on the full predicate, a \emph{uniqueness bar} is drawn above or below the fact roles. If the bar spans two or more non-adjacent roles, it is drawn as dotted line above or below the excluded roles. Bars can be stacked in multiple levels. To draw uniqueness bars you can use the following styles at predicate nodes:
+% TODO: add preferred unique (double line)
+
\begin{stylekey}[\opt{\meta{from}\texttt{-}\meta{to}\texttt{:}\meta{level}}]{unique}
Draws a uniqueness constraint bar above one or more roles. All parts of the key value are optional. As default a simple uniqueness bar above (\meta{level}|=1|) the first role (\meta{from}|=1|) is drawn. To make a bar span multiple roles, use the \meta{from}|-|\meta{to} syntax. Negative levels drawn the bar below the roles.
\begin{codeexample}[]
@@ -317,7 +347,7 @@ Draws a uniqueness constraint bar above one or more roles. All parts of the key
\end{stylekey}
\begin{stylekey}[\opt{\meta{from}\texttt{-}\meta{to}\texttt{:}\meta{level}}]{skip unique}
-Draws a dotted uniqueness constraint bar. The syntax is the same as at the |unique| key.
+Draws a dotted uniqueness constraint bar. The syntax is the same as at the \sty{unique} key.
The bar includes background color in the gaps between dots, so it can be drawn on top of
another bar.
\begin{codeexample}[]
@@ -365,7 +395,7 @@ Please note that elementary $n$-ary predicates should only have uniqueness const
\subsection{Mandatory Role Constraints}
\label{sec:mandatoryconstraints}
-To indicate explicitly that a role is mandatory, a mandatory role dot is added to either end of the line that connects the role to its object. Usually it is placed at the object type end. This package defines the style key |constraint dot| (alias |cdot|) and the following keys which can be used to add mandatory role dots to lines drawn with the |to| operation.
+To indicate explicitly that a role is mandatory, a mandatory role dot is added to either end of the line that connects the role to its object. Usually it is placed at the object type end. This package defines the style key \sty{constraint dot} (alias \sty{cdot}) and the following keys which can be used to add mandatory role dots to lines drawn with the |to| operation.
\begin{stylekey}{constraint dot}
\stylekeyheadline[]{cdot}
@@ -377,7 +407,7 @@ Draws the current node as mandatory role dot.
\begin{stylekey}{mandatory}
\stylekeyheadline[]{required}
-This styles enables the |relationship| style and add a mandatory role dot at the start of a straight line.
+This styles enables the \sty{relationship} style and adds a mandatory role dot at the start of a straight line.
\begin{codeexample}[]
\begin{tikzpicture}
\entity (A) {A};
@@ -388,7 +418,7 @@ This styles enables the |relationship| style and add a mandatory role dot at the
\end{stylekey}
\begin{stylekey}{required by}
-This styles enables the |relationship| style and add a mandatory role dot at the end of a straight line.
+This styles enables the \sty{relationship} style and adds a mandatory role dot at the end of a straight line.
\begin{codeexample}[]
\begin{tikzpicture}
\entity (A) {A};
@@ -400,7 +430,7 @@ This styles enables the |relationship| style and add a mandatory role dot at the
\begin{stylekey}{both required}
\stylekeyheadline[]{both mandatory}
-This styles enables the |relationship| style and adds mandatory role dots at both ends of a straight line.
+This styles enables the \sty{relationship} style and adds mandatory role dots at both ends of a straight line.
\begin{codeexample}[]
\begin{tikzpicture}
\entity (A) {A};
@@ -416,10 +446,11 @@ This styles enables the |relationship| style and adds mandatory role dots at bot
\subsection{External constraints}
\label{sec:externalconstraints}
-External constraints span multiple roles that may come from different predicates. They are draw with circled symbol next to the roles, possibly linked to them with a dotted or dashed line (style |limits| and |limits to|).
+External constraints span multiple roles that may come from different predicates. They are depicted by several circle symbols next the roles they limit, possibly linked to them with a dotted or dashed line (style \sty{limits} and \sty{limits to}). \tkzorm\ implements external constraint symbols as node shapes.
\begin{stylekey}[\opt{\meta{constraint type}}]{constraint}
- This style sets the font to ORM style on constraint color (violet). If you provide a constraint type as key value, the current node is shaped as constraint circle and the symbol of the specified constraint type is drawn. The most common constraint types are |exclusive| (alias |x|) to indicate that populations of two or more role-sequences must be mutually exclusive, |mandatory| (alias |required|, |total|, and |or|) to indicate that each at least on of two more roles must be played by an object type, and |xor| (alias |partition|) to indicates that exactely one of two or more roles must be played by an object type. These constraints can also be used in subtyping (section~\ref{sec:subtyping}). The constraint type |unique| and |preferred unique| enforces combinations of object types that play a given set of roles to always be the same. The types |equal|, |subset|, and |supset| indicate that tuples of roles have to be equal, subset or superset compared to each other (|supset| is not included in standard ORM~2). The constraint type is |misc| only draws the circle and can be used for custom constraints.
+ This style sets the font to ORM style on constraint color (violet). If you provide a constraint type as key value, the current node is shaped as constraint circle and the symbol of the specified constraint type is drawn. The most common constraint types are |exclusive| (alias |x|) to indicate that populations of two or more role-sequences must be mutually exclusive, |mandatory| (alias |required|, |total|, and |or|) to indicate that each at least on of two more roles must be played by an object type, and |xor| (alias |partition|) to indicates that exactely one of two or more roles must be played by an object type. These constraints can also be used in subtyping (section~\ref{sec:subtyping}). The constraint type |unique| and |preferred unique| enforces combinations of object types that play a given set of roles to always be the same. The types |equal|, |subset|, and |supset| indicate that tuples of roles have to be equal, subset or superset compared to each other (|supset| is not included in standard ORM2). The constraint type is |external| only draws the circle and can be used for custom constraints.
+ % TODO: see more about rings and collections ...
\begin{codeexample}[]
\begin{tikzpicture}[orm]
\matrix[column sep=2mm, row sep=2mm]{
@@ -429,7 +460,7 @@ External constraints span multiple roles that may come from different predicates
\node[constraint=xor]{}; & \node[right]{xor / partition}; \\
\node[constraint=unique] {}; & \node[right]{unique}; &
\node[constraint=preferred unique]{};&\node[right]{preferred unique};&
- \node[constraint=misc]{}; & \node[right]{misc}; \\
+ \node[constraint=external]{}; & \node[right]{external}; \\
\node[constraint=equal] {}; & \node[right]{equal}; &
\node[constraint=subset] {}; & \node[right]{subset}; &
\node[constraint=supset] {}; & \node[right]{supset}; \\
@@ -464,30 +495,40 @@ External constraints span multiple roles that may come from different predicates
% TODO: example of subtyping constraints
\end{stylekey}
-\begin{command}[]{limits}
-This command is an abbreviation for |\draw[limits]| inside |{tikzpicture}|.
-\end{command}
-
\begin{stylekey}{limits to} % TODO: add optional parameter
-This style is to be used with directed lines that connect constraint circles and roles. The line is drawn in the same style as |limits| but dashed and with an arrow tip of style \arrowtip{orm arrow} at the head.
+This style is to be used with directed lines that connect constraint circles and roles. The line is drawn in the same style as \sty{limits} but dashed and with an arrow tip of style \arrowtip{orm arrow} at the head.
\begin{codeexample}[width=3.4cm]
\begin{tikzpicture}[orm]
\unary[index=2] (a) at (0,0) {};
\unary[index=1] (b) at (0,-1.4) {};
- \draw[limits to] (b) -- (a) node[pos=.4,name=s]{};
- \node[constraint=subset] at (s) {};
+ \draw[limits to] (b) -- (a)
+ node[pos=.4,constraint=subset,name=s]{};
\node[right=2mm of s,text width=2.3cm]
{Each object that plays role 1 also plays role 2};
\end{tikzpicture}
\end{codeexample}
\end{stylekey}
+\begin{command}[]{limits}
+\end{command}
+\begin{command}[]{limitsto}
+%\stylekeyheadline[]{limits to}
+Inside |{tikzpicture}| these commands can be used as abbreviations for
+|\draw[limits]| and |\draw[limits to]|.
+\begin{codeexample}[width=3.4cm]
+\begin{tikzpicture}[orm]
+\limits (0,.4) to (1,.4); \limitsto (0,0) to (1,0);
+\end{tikzpicture}
+\end{codeexample}
+\end{command}
+
\begin{command}[\marg{constraint type name}\marg{path code}]{constraintdeclare}
- This command declares a new constraint type. The \marg{path code} is passed to the |append after command| key to be drawn after the constraint circle. Unless you want to extend ORM you do not need to declare new constraint types.
+ This command declares a new constraint type. The \marg{path code} is passed to the |append after command| key to be drawn after the constraint circle. Unless you want to extend ORM you do not need to declare new constraint types. This command is for internal use only!
\end{command}
\begin{command}[\marg{alias name}\marg{existing constraint type name}]{constraintdeclarealias}
This command can be used to create an alias (another name) for an existing constraint type.
+ This command is for internal use only!
\end{command}
\begin{stylekey}{every constraint}
@@ -498,15 +539,27 @@ This style is to be used with directed lines that connect constraint circles and
\subsection{Ring Constraints}
\label{sec:ringconstraints}
-A ring constraint can be applied to any two roles of a predicate that are played by the same object type (or the same supertype). Such constraints can also be viewed as properties of a binary relation or as properties of a directed graph. This package provides the following symbols to depict ring constraints. The graphical syntax of some symbols is slightly changed compared to the official ORM~2 syntax and the two symbols for `asymmetric and intransitive', and for `symmetric and intransitive' have been omitted because of complexity.
+A ring constraint can be applied to any two roles of a predicate that are
+played by the same object type (or the same supertype). Such constraints can
+also be viewed as properties of a binary relation or as properties of a
+directed graph. There are 10 ring constraints that combined can be used in 26
+forms. The graphical syntax of `irreflexive' and `antisymmetric' provided by
+this package are slightly changed compared to the official ORM2 syntax and
+some combinations are omitted or changed.
+
+%and the two symbols for `asymmetric and
+%intransitive', and for `symmetric and intransitive' have been omitted because
+%of complexity.
-% TODO: additional: transitive, tree
+% TODO: additional: tree, otree
+% combined: acyclic intransitive, symmetric irreflexive etc.
\begin{codeexample}[]
\centering
\begin{tikzpicture}[orm]
- \foreach \n/\s in {0/irreflexive,1/asymmetric,2/intransitive,
+ \foreach \n/\s in {0/irreflexive,1/asymmetric,2/strongly intransitive,
3/antisymmetric,4/acyclic,5/acyclic intransitive,
- 6/symmetric,7/purely reflexive,8/symmetric irreflexive}{
+ 6/symmetric,7/purely reflexive,8/symmetric irreflexive,
+ 9/intransitive,10/reflexive,11/transitive}{
\path ($mod(\n,3)*(3.4,0)-int(\n/3)*(0,0.8)$) node [constraint=\s] {}
+(4mm,0) node[anchor=west] {\s}; };
\end{tikzpicture}
@@ -522,7 +575,7 @@ A ring constraint can be applied to any two roles of a predicate that are played
\end{codeexample}
-\subsection{Numberand Value Constraints}
+\subsection{Number and Value Constraints}
Value constraints, cardinality constraints, and occurrence frequencies can simply be drawn beside the object type or role they refer to, optionally linked to with a dotted or dashed limitation line.
\noindent\textbf{Frequency Constraints} specify the number of times an object can play a role. Usually it is connected to the roles with a limtation line. % TODO: better syntax as pin
@@ -534,7 +587,7 @@ Value constraints, cardinality constraints, and occurrence frequencies can simpl
\end{tikzpicture}
\end{codeexample}
-\noindent A \textbf{Value constraint} indicates which values are allowed in an object type or role. It can be defined by declaring the set of possible values enclosed in curly brackets next to an object or role type. The command |\ormbraces| is a handy abbreviation to create curly brackets.
+\noindent A \textbf{Value constraint} indicates which values are allowed in an object type or role. It can be defined by declaring the set of possible values enclosed in curly brackets next to an object or role type. The commands \cmd{ormbraces} and \cmd{ormvalues} are handy abbreviations to create curly brackets.
\index{value constraints}\index{constraints!values}
\begin{codeexample}[]
@@ -594,7 +647,7 @@ Matrices are useful to draw multiple textual rules below each other.
\begin{figure}[h]
\centering
\begin{codeexample}[]
-\begin{tikzpicture}[orm]
+\begin{tikzpicture}
\entity (E) {Employee\ormind{1}\\(.nr)};
\binary[left=of E.north west,unique=2,label=\ormleft{has}] (h) {};
\binary[left=of E.south west,unique=1-2,
@@ -626,18 +679,15 @@ Matrices are useful to draw multiple textual rules below each other.
\end{figure}
\end{command}
-\section{Additional Features}
-\label{sec:additionalfeatures}
-%\ldots partly no standard ORM~2 \ldots
-
-\subsection{Subtyping}
+\section{Subtyping}
\label{sec:subtyping}
-%See 6.5, page 238: Euer diagrams \ldots\footnote{qtree}
To draw type hierarchies you can use the tree syntax of \tikzname.
+Euler diagrams are a less used alternative for simple type hierarchies.
+% TODO: add Euler diagram example
\begin{stylekey}{subtype}
-Draws a subtype relationships from the supertype to the subtype.
+Draws a subtype relationship arrow from the supertype to the subtype.
\begin{figure}[h]
\centering
\begin{codeexample}[]
@@ -655,7 +705,7 @@ Draws a subtype relationships from the supertype to the subtype.
\end{stylekey}
\begin{stylekey}{suptype}
-Works in the same way as |subtype| but with reverse direction.
+Works in the same way as \sty{subtype} but with reverse direction.
\begin{codeexample}[]
\begin{tikzpicture}
\node[entity] (A) {Animal};
@@ -665,6 +715,23 @@ Works in the same way as |subtype| but with reverse direction.
\end{codeexample}
\end{stylekey}
+\noindent Multiple inheritance may require to select one path as primary.
+You can distinguish primary and secondary subtypes by drawing the latter
+with a dashed arrow (\sty{subinterface} or \sty{supinterface}).
+
+\begin{stylekey}{subinterface}
+\stylekeyheadline[]{supinterface}
+Draw secondary subtype/supertype relationship arrows.
+\begin{codeexample}[]
+\begin{tikzpicture}
+ \node[entity] (A) {Animal};
+ \node[entity] (P) [right=8mm of A] {Person};
+ \draw[supinterface] (P) to (A);
+\end{tikzpicture}
+\end{codeexample}
+\end{stylekey}
+
+
\noindent
Subtype constraints can be shown linked to the subtype arrrows:
@@ -683,13 +750,16 @@ Subtype constraints can be shown linked to the subtype arrrows:
\end{figure}
+\section{Additional Features}
+\label{sec:additionalfeatures}
+%\ldots partly no standard ORM2 \ldots
\subsection{Duplicated and implied parts of a model}
\label{sec:duplicatedandimplied}
-Sometimes an object type or predicate is referred to without describing all its details because it is defined in an external model or because it is shown duplicated at some other place in the same model. To indicate such an external or duplicated object type or a predicate, a shadow is added to its shape. Alternatively ORM~2 allows to add a circumflex ``\^{}'' to an object type's name. A different kind of redundancy are roles and constraints that deduce from other parts of the model. ORM~2 includes the possibility to shade redundant roles. This is useful for instance to show conceptual pathes or join fact types that are normally excluded. Moreover ORM allows a \emph{zooming} on object types. This means that only objects and roles connected to a given object type are shown.
+Sometimes an object type or predicate is referred to without describing all its details because it is defined in an external model or because it is shown duplicated at some other place in the same model. To indicate such an external or duplicated object type or a predicate, a shadow is added to its shape. Alternatively ORM2 allows to add a circumflex ``\^{}'' to an object type's name. A different kind of redundancy are roles and constraints that deduce from other parts of the model. ORM2 includes the possibility to shade redundant roles. This is useful for instance to show conceptual pathes or join fact types that are normally excluded. Moreover ORM allows a \emph{zooming} on object types. This means that only objects and roles connected to a given object type are shown.
\begin{stylekey}{duplicated model}
-This style modifies the styles |every orm object| and |every predicate| so all object types and predicates in the current scope get a shadow.
+This style modifies the styles \sty{every object} and \sty{every predicate} so all object types and predicates in the current scope get a shadow.
\begin{codeexample}[]
\begin{tikzpicture}[orm]
\begin{scope}[duplicated model]
@@ -699,13 +769,14 @@ This style modifies the styles |every orm object| and |every predicate| so all o
\draw[relationship] (A) -- (r1);
\end{scope}
\entity (B) [right=of r2] {B\^{}};
- \draw[orm] (r2) -- (B);
+ \plays (r2) -- (B);
\end{tikzpicture}
\end{codeexample}
\end{stylekey} % duplicated model
\begin{stylekey}{implied model}
- This style modifies the styles |every orm line| and |every orm object| in the current scope to draw all lines thin and all objects filled gray.
+ This style modifies the styles \sty{every orm line} and \sty{every object} in the current scope to draw all lines thin and all objects filled gray.
+ The style is currently broken.
\begin{figure}[h]
\centering
\begin{codeexample}[]
@@ -725,7 +796,20 @@ This style modifies the styles |every orm object| and |every predicate| so all o
\end{figure}
\end{stylekey}
-% TODO command \implied{ ... } and \duplicated{ ... } ?
+\begin{stylekey}{duplicated}
+\stylekeyheadline[]{implied}
+This styles work like \sty{duplicated model} and \sty{implied model} but only affect the current element.
+The style are currently broken.
+\begin{codeexample}[]
+\begin{tikzpicture}
+\entity[duplicated] (P) {Person};
+\value[implied,right=1.6 of P] (V) {PersonName};
+\draw[implied,both required] (P) to
+ node[roles,unique=1,unique=2]{} (V);
+\end{tikzpicture}
+\end{codeexample}
+\end{stylekey}
+
\begin{stylekey}{zoomed}
This styles visualizes an object type as {\emph zoomed} by using a thicker line.
@@ -737,6 +821,30 @@ This styles visualizes an object type as {\emph zoomed} by using a thicker line.
\end{codeexample}
\end{stylekey}
+
+\subsection{Arrow heads}
+\label{sec:arrowheads}
+Constraint dots are implemented as arrow heads. The normal constraint
+dot is drawn with arrow head |mdot| for mandatory. Furthemore there is an
+implicit mandatory constraint dot (|idot|), a deontic mandatory constraint
+dot (|odot|), and a implied deontic mandatory constraint dot (|iodot|). You
+\emph{should not} directly use this arrow heads but the mandatory role
+constraints |cdot|, |required| etc. (\ref{sec:mandatoryconstraints}) which
+can be modified by other styles. This feature is not fully tested yet.
+
+\begin{codeexample}[]
+\begin{tikzpicture}[orm]
+\matrix [row sep=2mm,column sep=3mm,every entity/.style={minimum width=10mm}]{
+ \entity[label=left:strict,label=above:explicit,right] (m) {mdot}; &
+ \entity[label=above:implicit] (i) {idot}; \\
+ \entity[label=left:deontic,right] (o) {odot}; &
+ \entity (io) {iodot}; \\ };
+ \plays[mdot-idot] (m) to (i);
+ \plays[odot-iodot] (o) to (io);
+\end{tikzpicture}
+\end{codeexample}
+
+
\subsection{Macros for text layout}
\label{sec:ormtext}
The following macros can be used both in \tikzname{} pictures or normal text:
@@ -746,27 +854,31 @@ Sets the font to the same sans-serif variant which is used in ORM diagrams.
\end{command}
\begin{command}{ormbf}
-Sets the font to a bold variant of |\ormtext|.
+Sets the font to a bold variant of \cmd{ormtext}.
\end{command}
\begin{command}{ormc}
-Sets the font to a |\ormtext| in constraint color.
+Sets the font to a \cmd{ormtext} in constraint color.
\end{command}
\begin{command}[\marg{text}]{ormsup}
-Puts some text in a superscript variant of |\ormtext|.
+Puts some text in a superscript variant of \cmd{ormtext}.
\end{command}
\begin{command}[\marg{text}]{ormsub}
-Puts some text in a subscript variant of |\ormtext|.
+Puts some text in a subscript variant of \cmd{ormtext}.
\end{command}
\begin{command}[\marg{text}]{ormind}
-Puts some text in a superscript variant of |\ormbf|.
+Puts some text in a superscript variant of \cmd{ormbf}.
\end{command}
\begin{command}[\marg{text}]{ormbraces}
-Puts some text as |\ormtext| in braces.
+Puts some text as \cmd{ormtext} in braces.
+\end{command}
+
+\begin{command}[\marg{text}]{ormvalues}
+Puts some text as \cmd{ormc} in braces in constraint color.
\end{command}
\begin{codeexample}[]
@@ -783,14 +895,24 @@ Puts some text as |\ormtext| in braces.
This style sets the font and line width and the default node distance
\end{stylekey}
+\begin{stylekey}{orm-spacious}
+ If you prefer to have entities and labels typeset as circles, you can use \texttt{orm-spacious} instead of \texttt{orm}.
+\begin{codeexample}[width=3cm]
+\begin{tikzpicture}[orm-spacious]
+ \node[entity] (P) at (0,0) {Person};
+ \node[value] (N) at (1.5,0) {Name};
+\end{tikzpicture}
+\end{codeexample}
+\end{stylekey}
+
\begin{stylekey}{every orm line}
This style is envoked by all styles of this package that draw lines. By default it sets the line width to 0.3mm.
\end{stylekey}
-%\begin{stylekey}{every orm object}
-%\end{stylekey}
+% \begin{stylekey}{every orm object}
+% \end{stylekey}
% For this purpose (and for subtype arrows) this package defines the arrow tip \arrowtip{orm arrow}.
-%TODO: document arrow tip \arrowtip{orm arrow}
+% TODO: document arrow tip \arrowtip{orm arrow}
% TODO: replace search path with |/orm/| instad of |/tikz/|.
@@ -798,14 +920,17 @@ Puts some text as |\ormtext| in braces.
\begin{description}
\item[\ormVersion, \ormDate]
- First release
+ Unstable developer version (at Github).
+ \item[0.1.4, January 15, 2016]
+ Power types, sequence types, \texttt{orm-spacious} added.
+ \item[0.1, January 25, 2010]
+ First release (at CTAN).
\end{description}
\ifappendix
\bibliographystyle{alpha}
- \addcontentsline{toc}{section}{References}
+ \addcontentsline{toc}{section}{References and Index}
\bibliography{tkz-orm}
- \addcontentsline{toc}{section}{Index}
\printindex
\fi
diff --git a/Master/texmf-dist/tex/latex/tkz-orm/tkz-orm.sty b/Master/texmf-dist/tex/latex/tkz-orm/tkz-orm.sty
index 498656a04b2..749a1f55ee7 100644
--- a/Master/texmf-dist/tex/latex/tkz-orm/tkz-orm.sty
+++ b/Master/texmf-dist/tex/latex/tkz-orm/tkz-orm.sty
@@ -8,10 +8,10 @@
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
-% Copyright 2009 by Jakob Voss
+% Copyright 2009-2016 by Jakob Voss, Camil Staps
%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tkz-orm}[2010/01/20 v0.1 Object-Role Modeling]
+\ProvidesPackage{tkz-orm}[2016/01/15 v0.1.4 Object-Role Modeling]
%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>
\RequirePackage{tikz}[2009/09/04]
@@ -21,6 +21,7 @@
\usetikzlibrary{shadows}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
+\usetikzlibrary{fit}
\makeatletter
@@ -33,23 +34,21 @@
\def\orm@error#1{\relax}% TODO
%\def\orm@error#1{\PackageWarning{tkz-orm}{#1}}%
+%\pgfkeysdefargs{/tikz/ormcolorlet}{#1}{\colorlet{#2}{#1}}
+% \pgfkeys{/orm/.is family} % TODO
-%%%% Stuff missing in TikZ (should become part if TikZ)
+\def\tkzorm{\textsf{tkz-orm}}
-\pgfarrowsdeclare{none}{none}{
- \arrowsize=0pt
- \pgfarrowsleftextend{0}
- \pgfarrowsrightextend{0}
-}{
- \arrowsize=0pt
- \pgfarrowsleftextend{0}
- \pgfarrowsrightextend{0}
-}
-\tikzstyle{noarrows}=[arrows=none-none]
+%%%% ORM color constants
+\colorlet{constraintcolor}{magenta!100}
+\colorlet{ormconstraintcolor}{magenta!100}
+\colorlet{ormdeonticcolor}{blue!100}
+\colorlet{ormimpliedcolor}{gray!100}
+\def\orm@constraint@stroke{magenta}
+\def\orm@constraint@fill{magenta}
-%%%% ORM color constants
-\definecolor{constraintcolor}{rgb}{1,0,1}
+\pgfkeysdefargs{/tikz/constraintcolor}{#1}{\colorlet{constraintcolor}{#1}}
%%%% ORM width and length
\newlength{\orm@linewidth}
@@ -64,10 +63,8 @@
%%%% Text markup
-% textsubscript like textsuperscript
-\DeclareRobustCommand*\textsubscript[1]{%
- \@textsubscript{\selectfont#1}}
-\newcommand{\@textsubscript}[1]{%
+% textsubscript may not be defined like textsuperscript
+\newcommand{\orm@textsubscript}[1]{%
{\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
% similar to \blacktriangle (could better be implemented directly in pgf)
@@ -85,9 +82,10 @@
\def\ormbf{\orm@font@bold}
\def\ormc{\orm@font\color{constraintcolor}}
\def\ormsup#1{\textsuperscript{\orm@font@scriptsize #1}}
-\def\ormsub#1{\textsubscript{\orm@font@scriptsize #1}}
-\def\ormind#1{\textsuperscript{\orm@font@bold@scriptsize #1}}
+\def\ormsub#1{\orm@textsubscript{\orm@font@scriptsize #1}}
+\def\ormind#1{\textsuperscript{\orm@font@bold@scriptsize\color{constraintcolor} #1}}
\def\ormbraces#1{{\orm@font\textbraceleft#1\textbraceright}}
+\def\ormvalues#1{\ormc{\ormbraces{#1}}}
\def\ormleft#1{{\ormarrowleft\ormtext #1}}
\def\ormup#1{{\ormtext #1\ormarrowup}}
@@ -102,33 +100,42 @@
%%%% ORM styles
-\tikzstyle{every orm line}= [solid,draw,line width=\orm@linewidth]
+\pgfkeys{/tikz/constraint stroke/.store in=\orm@constraint@stroke}
+\pgfkeys{/tikz/constraint fill/.store in=\orm@constraint@fill}
+\pgfkeys{/tikz/constraint color/.style={constraint stroke=#1,constraint fill=#1}}
+
+
+\tikzstyle{every orm line}= [solid,draw=black,line width=\orm@linewidth,-]
\tikzstyle{orm}= [font=\orm@font,node distance=4mm,
%label distance=1.5mm,
- line width=\orm@linewidth,
+ %line width=\orm@linewidth,
label distance=1.25mm
]
+\tikzstyle{orm-spacious}= [orm,
+ every object/.style={shape=circle}
+ ]
\tikzstyle{every orm}= [every orm line,fill=white,orm]
\tikzstyle{zoomed}= [line width=\orm@linewidth*1.5]
-\tikzstyle{every object type}= []
+\tikzstyle{every object}= []
\tikzstyle{every entity}= []
\tikzstyle{entity}= [every orm,
shape=rectangle,rounded corners,
align=center,minimum size=6mm,
- every object type,every entity]
+ every object,every entity]
\tikzstyle{every value}= []
\tikzstyle{value}= [every orm,
shape=rectangle,rounded corners,densely dashed,
align=center,minimum size=6mm,
- every object type,every value]
+ every object,every value]
\tikzstyle{relationship}= [every orm line,every relationship]
\tikzstyle{relation}= [relationship]
+\tikzstyle{plays}= [relationship]
\tikzstyle{every relationship}= []
@@ -159,6 +166,10 @@
\tikzaddtikzonlycommandshortcutdef{\rules}{\matrix[row sep=0mm,nodes={right}]}
\tikzaddtikzonlycommandshortcutdef{\limits}{\draw[limits]}
+\tikzaddtikzonlycommandshortcutdef{\limited}{\draw[limits]}
+\tikzaddtikzonlycommandshortcutdef{\limitsto}{\draw[limits to]}
+
+\tikzaddtikzonlycommandshortcutdef{\constraint}{\node[text=constraintcolor]}
%%%% Textual rules
@@ -167,7 +178,7 @@
\bgroup%
[current point is local=true]
(\tikzlastnode.north west) node[font=\orm@font@bold@scriptsize,
- anchor=north east,inner sep=0] {#1}
+ anchor=north east,inner sep=0,text=constraintcolor] {#1}
\egroup%
},
orm,inner sep=0.5mm,
@@ -205,6 +216,97 @@
% TODO: read
% http://www.latex-project.org/guides/clsguide.pdf
+\pgfkeyssetvalue{/tkzorm/constraintstroke}{constraintcolor}
+\pgfkeyssetvalue{/tkzorm/constraintfill}{constraintcolor}
+
+%%%
+% arrow heads
+
+% dot as arrow head (no color)
+\pgfarrowsdeclare{dot}{dot}{
+ \pgfutil@tempdima=0.2pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfutil@tempdimb=5.5\pgfutil@tempdima\advance\pgfutil@tempdimb
+ by\pgflinewidth
+ \pgfarrowsleftextend{+-\pgfutil@tempdimb}
+ \pgfutil@tempdimb=1.5\pgfutil@tempdima\advance\pgfutil@tempdimb
+ by.5\pgflinewidth
+ \pgfarrowsrightextend{+\pgfutil@tempdimb}
+}{
+ \pgfutil@tempdima=0.2pt%
+ \advance\pgfutil@tempdima by.2\pgflinewidth%
+ \pgfsetdash{}{+0pt}
+ \pgfpathcircle{\pgfqpoint{+3\pgfutil@tempdima}{0pt}}{+4.5\pgfutil@tempdima}
+ \pgfsetstrokecolor{\orm@constraint@stroke}
+ \pgfsetfillcolor{\orm@constraint@fill}
+ %\pgfsetfillcolor{\pgfkeysvalueof{/tkzorm/constraintfill}}
+ \pgfusepathqfillstroke
+}
+
+% mandatory constraint dot arrow head
+\pgfarrowsdeclare{mdot}{mdot}{
+ \pgfarrowsrightextend{0pt}% put arrow head over the tip
+ \pgfutil@tempdima=0.25mm\advance\pgfutil@tempdima by 0.5\pgflinewidth% lw
+ \pgfarrowsleftextend{+-\pgfutil@tempdima}% for arrow composing
+}{
+ \pgfutil@tempdima=0.5mm\advance\pgfutil@tempdima by \pgflinewidth% radius
+ \pgfutil@tempdimb=0.25mm\advance\pgfutil@tempdimb by 0.5\pgflinewidth% lw
+ \pgfpathcircle{\pgfqpoint{0.5\pgflinewidth}{0pt}}{\pgfutil@tempdima}
+ \pgfsetfillcolor{ormconstraintcolor}
+ \pgfusepathqfill
+}
+
+% implied mandatory constraint dot arrow head
+\pgfarrowsdeclare{idot}{idot}{
+ \pgfarrowsrightextend{0pt}% put arrow head over the tip
+ \pgfutil@tempdima=0.25mm\advance\pgfutil@tempdima by 0.5\pgflinewidth% lw
+ \pgfarrowsleftextend{+-\pgfutil@tempdima}% for arrow composing
+}{
+ \pgfutil@tempdima=0.5mm\advance\pgfutil@tempdima by \pgflinewidth% radius
+ \pgfpathcircle{\pgfqpoint{0.5\pgflinewidth}{0pt}}{\pgfutil@tempdima}
+ \pgfsetfillcolor{ormimpliedcolor}
+ \pgfusepathqfill
+}
+
+% deontic mandatory constraint dot arrow head
+\pgfarrowsdeclare{odot}{odot}{
+ \pgfutil@tempdima=0.5mm\advance\pgfutil@tempdima by 1.0\pgflinewidth% radius
+ \pgfarrowsrightextend{0.5\pgfutil@tempdima}% put arrow head over the tip
+ \pgfarrowsleftextend{0pt}% for arrow composing
+}{
+ %\pgfutil@tempdima=0.5mm\advance\pgfutil@tempdima by 1.0\pgflinewidth% radius
+ %\pgfutil@tempdimb=0.25mm\advance\pgfutil@tempdimb by 0.5\pgflinewidth% lw
+ %\advance\pgfutil@tempdima by -0.5\pgfutil@tempdimb% -linewidth
+ \pgfutil@tempdima=0.475mm\advance\pgfutil@tempdima by 0.75\pgflinewidth% r-lw
+ \pgfutil@tempdimb=0.25mm\advance\pgfutil@tempdimb by 1\pgflinewidth% lw
+ \pgfpathcircle{\pgfqpoint{\pgfutil@tempdimb}{0pt}}{\pgfutil@tempdima}
+ \pgfutil@tempdima=0.25mm\advance\pgfutil@tempdima by 0.5\pgflinewidth% lw
+ \pgfsetdash{}{+0pt}
+ \pgfsetlinewidth{\pgfutil@tempdima}
+ \pgfsetstrokecolor{ormdeonticcolor}
+ \pgfsetfillcolor{white}
+ \pgfusepathqfillstroke
+}
+
+% implied deontic mandatory constraint dot arrow head
+\pgfarrowsdeclare{iodot}{iodot}{
+ \pgfutil@tempdima=0.5mm\advance\pgfutil@tempdima by 1.0\pgflinewidth% radius
+ \pgfarrowsrightextend{0.5\pgfutil@tempdima}% put arrow head over the tip
+ \pgfarrowsleftextend{0pt}% for arrow composing
+}{
+ \pgfutil@tempdima=0.475mm\advance\pgfutil@tempdima by 0.75\pgflinewidth% r-lw
+ \pgfutil@tempdimb=0.25mm\advance\pgfutil@tempdimb by 1\pgflinewidth% lw
+ \pgfpathcircle{\pgfqpoint{\pgfutil@tempdimb}{0pt}}{\pgfutil@tempdima}
+ \pgfutil@tempdima=0.25mm\advance\pgfutil@tempdima by 0.5\pgflinewidth% lw
+ \pgfsetdash{}{+0pt}
+ \pgfsetlinewidth{\pgfutil@tempdima}
+ \pgfsetstrokecolor{ormimpliedcolor}
+ \pgfsetfillcolor{white}
+ \pgfusepathqfillstroke
+}
+
+
+% filled arrow for subtyping, subset constraints and value-comparision constraints
\pgfarrowsdeclare{orm arrow}{orm arrow}
{
\pgfutil@tempdima=0.5pt%
@@ -222,54 +324,44 @@
\pgfpathlineto{\pgfqpoint{0.5\pgfutil@tempdima}{0\pgfutil@tempdima}}
\pgfpathlineto{\pgfpointadd{\pgfqpoint{0.5\pgfutil@tempdima}{0pt}}{\pgfqpointpolar{-157}{10\pgfutil@tempdima}}}
\pgfpathclose
+ \pgfsetfillcolor{ormconstraintcolor} % TODO: change if implied, deontic etc.
+ %\pgfsetstrokefillcolor{ormconstraintcolor} % TODO: change if implied, deontic etc.
\pgfusepathqfillstroke
}
-% enables the 'mandatory' arrow tip
-%\tikzstyle{mandatory}= [relationship,cdot-]
-%\tikzstyle{required}= [relationship,cdot-]
-%\tikzstyle{optional}= [relationship]
-%\tikzstyle{required by}= [relationship,-cdot]
-%\tikzstyle{both required}= [relationship,cdot-cdot]
-%\tikzstyle{both mandatory}= [relationship,cdot-cdot]
-
-% TODO: save the current 'to path' parameters and restore it or use execute
-\tikzstyle{mandatory}= [relationship,
- to path={-- (\tikztotarget) {[to path={-- (\tikztotarget) \tikztonodes}] \tikztonodes} node[cdot,pos=0]{}}
-]
-
-\tikzstyle{required by}= [relationship,
- to path={-- (\tikztotarget) {[to path={-- (\tikztotarget) \tikztonodes}] \tikztonodes} node[cdot,pos=1]{}}
-]
-
-\tikzstyle{both mandatory}= [relationship,
- to path={-- (\tikztotarget) {[to path={-- (\tikztotarget) \tikztonodes}] \tikztonodes}
- node[cdot,pos=0]{} node[cdot,pos=1]{}}
-]
-\tikzstyle{required}= [mandatory]
-\tikzstyle{both required}= [both mandatory]
-\tikzstyle{optional}= [relationship]
+% line styles that enable the mandatory constraint arrow tip
+\tikzstyle{required} =[relationship,mdot-]
+\tikzstyle{required by} =[relationship,-mdot]
+\tikzstyle{both required} =[relationship,mdot-mdot]
+% aliases
+\tikzstyle{mandatory} =[required]
+\tikzstyle{both mandatory}=[both required]
+\tikzstyle{optional} =[relationship]
-\tikzstyle{constraint dot} = [fill=constraintcolor,minimum size=1.5mm,draw=none,shape=circle,inner sep=0]
-\tikzstyle{cdot}=[constraint dot]
+% draw a mandatory constraint arrow tip over a node
+\tikzset{constraint dot/.style={append after command={
+ (\tikzlastnode.center) edge[required] (\tikzlastnode.center)
+}}}
+\tikzstyle{cdot} =[constraint dot]
%%%% Constraint symbols
-\tikzstyle{every constraint}= [draw=constraintcolor]
-\tikzstyle{every constraint line}= [line width=\orm@linewidth,draw=constraintcolor,solid]
+\tikzstyle{every constraint}= []
+% TODO: every uniqueness bar
+\tikzstyle{every constraint line}= [every orm line,draw=constraintcolor,every constraint]
+%\tikzstyle{every constraint line}= [line width=\orm@linewidth,draw=constraintcolor,solid]
\tikzstyle{every constraint circle}=[]
-\tikzstyle{constraint circle}= [every orm,every constraint,
+\tikzstyle{constraint circle}= [every orm,every constraint line,
shape=circle,
font=\orm@font@scriptsize,
minimum size=4mm,,inner sep=0pt,
every constraint circle]
\tikzstyle{constraint no circle}= [constraint circle,draw=none,fill=none]
-\tikzstyle{limits}= [line width=\orm@linewidth,draw=constraintcolor,dotted]
-\tikzstyle{limits to}= [line width=\orm@linewidth,draw=constraintcolor,dashed,
- color=constraintcolor,-orm arrow]
+\tikzstyle{limits}= [every constraint line,dotted]
+\tikzstyle{limits to}= [every constraint line,dashed,-orm arrow]
% internal uniqueness constraint
@@ -280,9 +372,29 @@
\tikzstyle{duplicated model}= [every orm/.append style={drop shadow},
every predicate/.append style={drop shadow}]
-\tikzstyle{implied}= [fill=gray!30,thin]
-\tikzstyle{implied model}= [every orm/.append style={fill=gray!30},
- every orm line/.append style={thin}]
+\tikzstyle{every implied line}= [constraintcolor=gray!80,thin]
+\tikzstyle{every implied}= [fill=gray!30,every implied line]
+
+\tikzstyle{implied}=[
+ every orm/.append style={every implied},
+ every orm line/.append style={every implied line},,
+ constraint color=gray!100,thin,
+ every relationship/.style={fill=gray!30},
+ required/.append style={idot-},
+ required by/.append style={-idot},
+ both required/.append style={idot-idot}
+]
+\tikzstyle{implied model}=[implied]
+
+\tikzstyle{deontic}= [
+ every orm line/.append style={constraintcolor=blue!100},
+ constraintcolor=blue!100,
+ constraint color=blue!100,
+ required/.append style={odot-},
+ required by/.append style={-odot},
+ both required/.append style={odot-odot}
+]
+
%%%% Constraints
@@ -313,7 +425,7 @@
% style /tikz/constraint and its keys
\tikzset{constraint/.is choice}
-\tikzset{constraint/misc/.style={constraint circle,text=constraintcolor}}%
+%\tikzset{constraint/misc/.style={constraint circle,text=constraintcolor}}%
%\constraintdeclarealias{le}{symmetric}
@@ -371,85 +483,17 @@
%\tikzstyle{entity}= [every orm,
% shape=rectangle,rounded corners,
% align=center,minimum size=6mm,
-% every object type,every entity]
+% every object,every entity]
\tikzset{constraint/text/.style={color=constraintcolor,font=\orm@font,align=center}}
\tikzset{constraint/.default=text}
% TODO: color=constraintcolor
-\constraintdeclare{custom}{} % empty constraint circle
-% inclusive-or (disjunctive mandatory role) constraint
-\constraintdeclareasnode{mandatory}{
- \fill[every constraint,fill=constraintcolor] (0,0) circle (1mm);
-}
-\constraintdeclarealias{required}{mandatory}
-\constraintdeclarealias{total}{mandatory}
-\constraintdeclarealias{or}{mandatory}
-
-% exclusive constraint ('x')
-\constraintdeclare{exclusive}{
- ($(\tikzlastnode.center) +(45:2mm)$) edge[every constraint line] +(225:4mm)
- ($(\tikzlastnode.center) +(-45:2mm)$) edge[every constraint line] +(-225:4mm)
-}
-\constraintdeclarealias{x}{exclusive}
-
-% exclusive-or constraint ('xor' or 'partition')
-\constraintdeclareasnode{xor}{
- \fill[every constraint,fill=constraintcolor] (0,0) circle (1mm);
- \draw[every constraint line] (45:2mm) -- (225:2mm)
- (-45:2mm) -- (-225:2mm);
-}
-\constraintdeclarealias{partition}{xor}
-
-% external uniqueness constraint
-\constraintdeclare{unique}{
- (\tikzlastnode.east) edge [every constraint line] (\tikzlastnode.west)
-}
-
-\constraintdeclare{preferred unique}{
- ($(\tikzlastnode.west) +(0,-.4mm)$) edge[every constraint line] +(4mm,0mm)
- ($(\tikzlastnode.west) +(0, .4mm)$) edge[every constraint line] +(4mm,0mm)
-}
-
-\constraintdeclare{equal}{
- ($(\tikzlastnode.center) +(-.8mm,-.4mm)$) edge[every constraint line] +(1.6mm,0mm)
- ($(\tikzlastnode.center) +(-.8mm, .4mm)$) edge[every constraint line] +(1.6mm,0mm)
-}
-
-\constraintdeclareasnode{subset}{
- \draw [every constraint line,rounded corners=0]
- (.8mm,0mm) -- (-.2mm, 0mm) arc (270:90:0.5mm) -- (.8mm,.9mm)
- (.8mm,-.9mm) -- (-.8mm,-.9mm);
-}
-
-\constraintdeclareasnode{supset}{
- \draw [every constraint line,rounded corners=0]
- (-.8mm,0mm) -- (.2mm, 0mm) arc (-90:90:0.5mm) -- (-.8mm,.9mm)
- (.8mm,-.9mm) -- (-.8mm,-.9mm);
-}
-
-% Collection constraints (no standard ORM2)
-
-\constraintdeclareasnode{ordered}{
- \draw [every constraint line,rounded corners=0]
- (1.6mm,.8mm) -- (0,0) -- (1.6mm,-.8mm);
-}
-\constraintdeclarealias{sorted}{ordered}
-
-\constraintdeclareasnode{counted}{
- \draw [every constraint line]
- (-.9mm,-.4mm) -- (+.9mm,-.4mm)
- (-.9mm,+.4mm) -- (+.9mm,+.4mm)
- (-.4mm,-.9mm) -- (-.4mm,+.9mm)
- (+.4mm,-.9mm) -- (+.4mm,+.9mm);
-}
-\constraintdeclarealias{in bag}{counted}
-\constraintdeclarealias{in multiset}{counted}
%%%% Ring constraints
-% TODO: join
+% TODO: possibly join with cdot
\tikzstyle{ormdot}= [fill=constraintcolor,radius=.6mm,draw=none]
@@ -471,13 +515,47 @@
\draw[every constraint line] (270:0mm) to (270:1.75mm);
}
+% TODO: document
+\constraintdeclareasnode{strongly intransitive}{
+ \fill[every constraint line,fill=white,draw=white] circle (2.2mm);
+ \path [ormdot] (90:2mm) circle;
+ \path [ormdot] (30:1mm) circle;
+ \path [ormdot] (210:2mm) circle;
+ \path [ormdot] (330:2mm) circle;
+ \path[every constraint line,rounded corners=0] (90:2mm) -- (210:2mm) -- (330:2mm) -- (90:2mm);
+ \draw[every constraint line] (270:0mm) to (270:1.75mm);
+}
+
+% TODO: document tree and otree
+\constraintdeclareasnode{tree}{
+ \fill[every constraint line,fill=white,draw=white] circle (2.2mm);
+ \path [ormdot] (90:2mm) circle;
+ \path [ormdot] (210:2mm) circle;
+ \path [ormdot] (330:2mm) circle;
+ \path[every constraint line,rounded corners=0] (339:2mm) -- (90:2mm) -- (210:2mm);
+}
+
+\constraintdeclareasnode{otree}{
+ \fill[every constraint line,fill=white,draw=white] circle (2.2mm);
+ \path [ormdot] (90:2mm) circle;
+ \path [ormdot] (210:2mm) circle;
+ \path [ormdot] (330:2mm) circle;
+ \path[every constraint line,rounded corners=0] (339:2mm) -- (90:2mm) -- (210:2mm);
+ \path[every constraint line,rounded corners=0]
+ (.8mm,-0mm) -- (-.6mm,-1mm) -- (.8mm,-2mm);
+}
\constraintdeclareasnode{purely reflexive}{
+ \path[use as bounding box] (270:2.75mm) -- (90:2.75mm);
+ \path [ormdot] (180:2mm) circle;
+ \draw[every constraint line] (90:1.25mm) to (270:1.25mm);
+% (-.8mm, .4mm) -- (.8mm, .4mm)
+% (-.8mm,-.4mm) -- (.8mm,-.4mm);
+}
+
+\constraintdeclareasnode{reflexive}{
+ \path[use as bounding box] (270:2.75mm) -- (90:2.75mm);
\path [ormdot] (180:2mm) circle;
- \path [ormdot] ( 0:2mm) circle;
- \draw[every constraint line]
- (-.8mm, .4mm) -- (.8mm, .4mm)
- (-.8mm,-.4mm) -- (.8mm,-.4mm);
}
\constraintdeclareasnode{irreflexive}{
@@ -525,11 +603,9 @@
}
\constraintdeclareasnode{antisymmetric}{
- \path[use as bounding box] (270:2.75mm) -- (90:2.75mm);
\path [ormdot] (180:2mm) circle;
\path [ormdot] ( 0:2mm) circle;
- \path [every constraint line,fill=white,radius=.7mm] (0:2mm) circle;
- \draw [every constraint line] (270:1mm) to (270:2.75mm);
+ \draw[every constraint line] (90:2.75mm) to (270:2.75mm);
}
\constraintdeclareasnode{tree}{
@@ -543,7 +619,7 @@
% TODO: strictly order, total, connected, etc.
-
+% TODO: test and document this
\tikzset{objectification/.style={
entity,fill=none,
append after command={
@@ -556,11 +632,13 @@
%%%% Subtypes
-
-\tikzstyle{subtype}= [line width=\orm@linewidth*1.5, % TODO: how to get current line width?
- >=orm arrow,<-,solid,draw]
-\tikzstyle{suptype}= [subtype,->]
-
+ % TODO: how to get current line width?
+\tikzstyle{inheritance}=[line width=\orm@linewidth*1.5,>=orm arrow,
+ draw,color=constraintcolor]
+\tikzstyle{subtype}=[inheritance,<-,solid]
+\tikzstyle{suptype}=[inheritance,->,solid]
+\tikzstyle{subinterface}=[subtype,dashed]
+\tikzstyle{supinterface}=[suptype,dashed]
%%%% Role indices
@@ -605,87 +683,440 @@
\ifnum#1<0-\fi0.5*\orm@role@height+#1*\orm@rolebar@shift%
}
-\tikzstyle{uniqueness bar}=[every constraint line]
+\tikzstyle{uniqueness bar}=[every constraint line,-]
\tikzstyle{skipped uniqueness bar}=[
- every constraint line,dotted,preaction={every constraint line,white}
+ every constraint line,-,dotted,preaction={every constraint line,-,white}
]
\def\orm@unique@bar@normal{uniqueness bar}
\def\orm@unique@bar@skipped{skipped uniqueness bar}
\global\let\orm@unique@bar@style=\orm@unique@bar@normal
-\tikzset{
- unique/.code={\orm@parse@unique#1:\pgf@nil},
- unique/.default=1,
+%%
+% Styles to draw external constraints
+%
+\pgfkeys{
+ /orm/external constraint/.style={
+ every constraint line,
+ fill=white,text=constraintcolor,align=center,
+ font=\orm@font@scriptsize,minimum size=4mm,inner sep=0pt
+ }
+}
+
+% Defines an external constraints as node shape, based on the circle shape
+% The symbol is *always* drawn but circle and fill can be modified.
+% You can still modify the layout via color, line width, stroke opacity.
+% The shapes do not respect outer sep (outer xsep/outer ysep) yet (TODO).
+\newcommand{\constraintdeclareshape}[2]{%
+ \expandafter\pgfdeclareshape{#1}{
+ \inheritsavedanchors[from=circle]
+ \inheritanchor[from=circle]{north}
+ \inheritanchor[from=circle]{north west}
+ \inheritanchor[from=circle]{north east}
+ \inheritanchor[from=circle]{center}
+ \inheritanchor[from=circle]{west}
+ \inheritanchor[from=circle]{east}
+ \inheritanchor[from=circle]{mid}
+ \inheritanchor[from=circle]{mid west}
+ \inheritanchor[from=circle]{mid east}
+ \inheritanchor[from=circle]{base}
+ \inheritanchor[from=circle]{base west}
+ \inheritanchor[from=circle]{base east}
+ \inheritanchor[from=circle]{south}
+ \inheritanchor[from=circle]{south west}
+ \inheritanchor[from=circle]{south east}
+ \inheritanchorborder[from={circle}]
+ \backgroundpath{% \behindbackgroundpath and \beforebackgroundpath don't do.
+ \pgfsetdash{}{0pt}% solid circle
+ \pgfutil@tempdima=\radius%
+ \pgfmathsetlength{\pgf@xb}{\pgfkeysvalueof{/pgf/outer xsep}}%
+ \pgfmathsetlength{\pgf@yb}{\pgfkeysvalueof{/pgf/outer ysep}}%
+ \ifdim\pgf@xb<\pgf@yb%
+ \advance\pgfutil@tempdima by-\pgf@yb%
+ \else%
+ \advance\pgfutil@tempdima by-\pgf@xb%
+ \fi%
+ \pgfpathcircle{\centerpoint}{\pgfutil@tempdima}%
+ }
+ \foregroundpath{%
+ \pgfsetdash{}{0pt}%
+ \pgfsetbuttcap%
+ \pgfsetmiterjoin%
+ #2 \pgfusepathqstroke%
+ }
+ }
+ \tikzset{constraint/#1/.style={/orm/external constraint,shape=#1}}
+ \tikzset{#1 constraint/.style={/orm/external constraint,shape=#1}}
+}
+
+
+\constraintdeclareshape{unique}{
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\radius}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\radius}%
+}
+
+\constraintdeclareshape{preferred unique}{
+ \centerpoint \pgf@xc=\pgf@x \pgf@yc=\pgf@y%
+ \pgfutil@tempdima=\pgflinewidth%
+ \pgfutil@tempdima1.5\pgfutil@tempdima%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\radius\advance\pgf@y by-\pgfutil@tempdima}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\radius\advance\pgf@y by-\pgfutil@tempdima}%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\radius\advance\pgf@y by\pgfutil@tempdima}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\radius\advance\pgf@y by\pgfutil@tempdima}%
+}
+
+\constraintdeclareshape{equal}{
+ \pgfutil@tempdima=\radius% x
+ \pgfutil@tempdima0.4\pgfutil@tempdima%
+ \pgfutil@tempdimb=\radius% y
+ \pgfutil@tempdimb0.2\pgfutil@tempdimb%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\pgfutil@tempdima\advance\pgf@y by\pgfutil@tempdimb}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\pgfutil@tempdima\advance\pgf@y by\pgfutil@tempdimb}%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\pgfutil@tempdima\advance\pgf@y by-\pgfutil@tempdimb}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\pgfutil@tempdima\advance\pgf@y by-\pgfutil@tempdimb}%
+}
+
+\constraintdeclareshape{subset}{
+ \pgf@xa=\radius \pgf@xa0.4\pgf@xa% xa = 0.5 r
+ \pgf@ya=\radius \pgf@ya0.4\pgf@ya% ya = 0.4 r
+ \pgf@yb0.5\pgf@ya% yb = 0.5 ya = 0.2 r
+ \pgf@xb=\pgf@xa \advance\pgf@xb by -\pgf@yb%
+
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\pgf@xa\advance\pgf@y by-\pgf@ya}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by \pgf@xa\advance\pgf@y by-\pgf@ya}%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by \pgf@xa}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by-\pgf@xb}%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by \pgf@xa\advance\pgf@y by\pgf@ya}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by-\pgf@xb\advance\pgf@y by\pgf@ya}%
+ \pgfpatharc{90}{270}{\pgf@yb}
+}
+
+\constraintdeclareshape{supset}{
+ \pgf@xa=\radius \pgf@xa0.4\pgf@xa% xa = 0.5 r
+ \pgf@ya=\radius \pgf@ya0.4\pgf@ya% ya = 0.4 r
+ \pgf@yb0.5\pgf@ya% yb = 0.5 ya = 0.2 r
+ \pgf@xb=\pgf@xa \advance\pgf@xb by -\pgf@yb%
+
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\pgf@xa\advance\pgf@y by-\pgf@ya}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by \pgf@xa\advance\pgf@y by-\pgf@ya}%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\pgf@xa}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by \pgf@xb}%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\pgf@xa\advance\pgf@y by\pgf@ya}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by \pgf@xb\advance\pgf@y by\pgf@ya}%
+ \pgfpatharc{90}{-90}{\pgf@yb}
+}
+
+\constraintdeclareshape{exclusive}{% exclusive constraint ('x')
+ \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{45}{\radius}}}%
+ \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{225}{\radius}}}%
+ \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{135}{\radius}}}%
+ \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{-45}{\radius}}}%
+}
+
+% inclusive-or (disjunctive mandatory role) constraint
+\constraintdeclareshape{mandatory}{
+ \pgf@xa=\radius \pgf@xa0.4\pgf@xa%
+ \pgfpathcircle{\centerpoint}{\pgf@xa}
+ \pgfsetfillcolor{constraintcolor} % TODO: constraitfillcolor / not for deontic
+ % use deontic dot instead?
+ \pgfusepathqfillstroke
+}
+
+% exclusive-or constraint ('xor' or 'partition')
+\constraintdeclareshape{partition}{
+ \pgf@xa=\radius \pgf@xa0.4\pgf@xa%
+ \pgfpathcircle{\centerpoint}{\pgf@xa}
+ \pgfsetfillcolor{constraintcolor} % TODO: constraitfillcolor / not for deontic
+ \pgfusepathqfillstroke
+ \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{45}{\radius}}}%
+ \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{225}{\radius}}}%
+ \pgfpathmoveto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{135}{\radius}}}%
+ \pgfpathlineto{\pgfpointadd{\centerpoint}{\pgfqpointpolar{-45}{\radius}}}%
+}
+
+% Collection constraints (not standard ORM2)
+\constraintdeclareshape{rank}{% aka ordered set
+ \pgf@xa=\radius \pgf@xa0.3\pgf@xa%
+ \pgf@ya=\radius \pgf@ya0.4\pgf@ya%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@y by\pgf@ya}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by-\pgf@ya}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@y by-\pgf@ya}%
+}
+\constraintdeclareshape{sequence}{%
+ \pgf@xa=\radius \pgf@xa0.3\pgf@xa%
+ \pgf@ya=\radius \pgf@ya0.4\pgf@ya%
+ \pgf@xc=\radius \pgf@xc0.2\pgf@xc%
+
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@y by\pgf@ya}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by-\pgf@ya}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@y by-\pgf@ya}%
+ \pgfusepathqstroke
+
+ \pgfsetdash{{\pgflinewidth}{1pt}}{0pt}% dotted
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\radius}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\radius}%
+}
+\constraintdeclareshape{weak sequence}{%
+ \pgf@xa=\radius \pgf@xa0.3\pgf@xa%
+ \pgf@xb=\pgflinewidth%
+ \pgf@yb=\radius \pgf@yb0.15\pgf@yb%
+ \pgf@ya=\radius \pgf@ya0.4\pgf@ya%
+
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@y by\pgf@ya\advance\pgf@y by\pgf@yb}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by-\pgf@xa\advance\pgf@y by\pgf@yb}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@y by-\pgf@ya\advance\pgf@y by\pgf@yb}%
+
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\pgf@xa\advance\pgf@x by-\pgf@xb\advance\pgf@y by-\pgf@yb}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@x by-\pgf@xb\advance\pgf@y by-\pgf@ya\advance\pgf@y by-\pgf@yb}%
+ \pgfusepathqstroke
+
+ \pgfsetdash{{\pgflinewidth}{1pt}}{0pt}% dotted
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\radius\advance\pgf@y by\pgf@yb}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\radius\advance\pgf@y by\pgf@yb}%
+}
+
+\constraintdeclareshape{weak rank}{% aka poset
+ \pgf@xa=\radius \pgf@xa0.3\pgf@xa%
+ \pgf@xb=\pgflinewidth%
+ \pgf@yb=\radius \pgf@yb0.15\pgf@yb%
+ \pgf@ya=\radius \pgf@ya0.4\pgf@ya%
+
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@y by\pgf@ya\advance\pgf@y by\pgf@yb}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by-\pgf@xa\advance\pgf@y by\pgf@yb}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@y by-\pgf@ya\advance\pgf@y by\pgf@yb}%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\pgf@xa\advance\pgf@x by-\pgf@xb\advance\pgf@y by-\pgf@yb}%
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@x by-\pgf@xb\advance\pgf@y by-\pgf@ya\advance\pgf@y by-\pgf@yb}%
+}
+
+\constraintdeclareshape{counted}{
+ \pgf@xa=\radius \pgf@xa0.5\pgf@xa%
+ \pgf@xb=\radius \pgf@xb0.25\pgf@xb%
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\pgf@xa\advance\pgf@y by\pgf@xb}
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@y by\pgf@xb}
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\pgf@xa\advance\pgf@y by-\pgf@xb}
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\pgf@xa\advance\pgf@y by-\pgf@xb}
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by\pgf@xb\advance\pgf@y by\pgf@xa}
+ \pgfpathlineto{\centerpoint\advance\pgf@x by\pgf@xb\advance\pgf@y by-\pgf@xa}
+ \pgfpathmoveto{\centerpoint\advance\pgf@x by-\pgf@xb\advance\pgf@y by\pgf@xa}
+ \pgfpathlineto{\centerpoint\advance\pgf@x by-\pgf@xb\advance\pgf@y by-\pgf@xa}
}
+%\constraintdeclarealias{in bag}{counted}
+%\constraintdeclarealias{in multiset}{counted}
+
+\constraintdeclareshape{external}{} % needed because shapes are in /orm/...
+\constraintdeclareshape{misc}{} % alias for 'external'
+
+%\constraintdeclare{custom}{} % empty constraint circle
+
+\constraintdeclarealias{required}{mandatory}
+\constraintdeclarealias{total}{mandatory}
+\constraintdeclarealias{or}{mandatory}
+\constraintdeclarealias{x}{exclusive}
+\constraintdeclarealias{xor}{partition}
+
+%%
+% Styles to draw uniqueness bars
+%
+\pgfkeys{/orm/.cd,
+ uniqueness bar from/.initial=1,%
+ uniqueness bar to/.initial=1,%
+ uniqueness bar level/.initial=1,%
+ uniqueness bar roles/.initial=1,%
+ uniqueness bar set roles/.style={%
+ /orm/uniqueness bar roles=#1,
+ /pgf/minimum width=#1*4mm
+ },
+ uniqueness bar lower/.initial=0,%
+ uniqueness bar from/.value required,%
+ uniqueness bar to/.value required,%
+ uniqueness bar level/.value required,%
+ uniqueness bar roles/.value required,%
+ uniqueness bar set roles/.value required,%
+ uniqueness bar lower/.value required,%
+ uniqueness bar style/.style={}
+}
+
+%
+% This node shape draws a uniqueness bar above or below a predicate node.
+% You should use is to shape an invisible node of same size and position
+% as the predicate to constraint. The bar is affected by several styles
+% named '/orm/uniqueness bar ...' each.
+%
+\pgfdeclareshape{uniqueness bar}{
+ \inheritsavedanchors[from=rectangle]
+ \inheritanchorborder[from=rectangle]
+ \inheritanchor[from=rectangle]{north}
+ \inheritanchor[from=rectangle]{west}
+ \inheritanchor[from=rectangle]{east}
+ \inheritanchor[from=rectangle]{south}
+ \inheritanchor[from=rectangle]{center}
+ \savedmacro\barlevel{%
+ \edef\barlevel{\pgfkeysvalueof{/orm/uniqueness bar level}}%
+ \edef\barfrom{\pgfkeysvalueof{/orm/uniqueness bar from}}%
+ \edef\barto{\pgfkeysvalueof{/orm/uniqueness bar to}}%
+ \edef\barroles{\pgfkeysvalueof{/orm/uniqueness bar roles}}%
+ \edef\barlower{\pgfkeysvalueof{/orm/uniqueness bar lower}}%
+ }
+ \foregroundpath{
+ \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
+ \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
+ \pgfmathsetlength\pgfutil@tempdima{
+ (\pgf@xb-\pgf@xa-\pgflinewidth) / (\barroles>0 ? \barroles : 1)
+ }% role width
+ \pgf@xb=\pgf@xa
+ \advance\pgf@xa by 1.5\pgflinewidth%
+ \advance\pgf@xa by -1\pgfutil@tempdima%
+ \advance\pgf@xa by \barfrom\pgfutil@tempdima%
+ \advance\pgf@xb by-0.5\pgflinewidth%
+ \advance\pgf@xb by \barto\pgfutil@tempdima%
+ \pgfmathsetlength\pgfutil@tempdima{\barlevel}%
+ \pgfutil@tempdimb=3\pgflinewidth% level distance
+ \ifdim\pgfutil@tempdima<0pt%
+ \advance\pgf@ya by +0.5\pgflinewidth%
+ \advance\pgf@ya by \barlower\pgfutil@tempdimb%
+ \advance\pgf@ya by \barlevel\pgfutil@tempdimb%
+ \pgf@yb=\pgf@ya%
+ \else%
+ \advance\pgf@yb by-0.5\pgflinewidth%
+ \advance\pgf@yb by -\barlower\pgfutil@tempdimb%
+ \advance\pgf@yb by \barlevel\pgfutil@tempdimb%
+ \fi%
+ \pgfpathmoveto{\pgfqpoint{\pgf@xa}{\pgf@yb}}%
+ \pgfpathlineto{\pgfqpoint{\pgf@xb}{\pgf@yb}}%
+ }
+}
+
+
+% Power types
+\tikzset{power/.style args={#1}{
+ append after command={
+ \pgfextra{
+ \node[entity,shape=rectangle,rounded corners,fit={(\tikzlastnode)},label={[font=\orm@font]#1}] at (\tikzlastnode) (\tikzlastnode-power) {};
+ }
+ }
+ }
+}
+
+
+% Sequence types
+\tikzset{sequence/.style args={#1}{
+ append after command={
+ \pgfextra{
+ \node[entity,shape=rectangle,rounded corners=0pt,fit={(\tikzlastnode)},label={[font=\orm@font]#1}] at (\tikzlastnode) (\tikzlastnode-sequence) {};
+ }
+ }
+ }
+}
+
\tikzset{
- skip unique/.code={\orm@parse@unique@skipped#1:\pgf@nil},
- skip unique/.default=1,
+ unique/.code={\orm@parse@xunique#1:\pgf@nil},
+ unique/.default=1,
}
-% parses b:l and b
-\def\orm@parse@unique#1:#2\pgf@nil{%
+% parses '<which>:<level>' and '<which>'
+\def\orm@parse@xunique#1:#2\pgf@nil{%
\def\orm@temp{#2}%
\ifx\orm@temp\pgfutil@empty%
- \orm@@parse@unique#1:0_1:\pgf@nil%
+ \orm@@parse@xunique#1:1:\pgf@nil%
\else%
- \orm@@parse@unique#1:0_#2\pgf@nil%
+ \orm@@parse@xunique#1:#2\pgf@nil%
\fi%
}
-\def\orm@parse@unique@skipped#1:#2\pgf@nil{%
+% parses n-m:<level> and n:<level>
+\def\orm@@parse@xunique#1:#2:\pgf@nil{%
+ \pgfutil@in@{-}{#1}%
+ \ifpgfutil@in@%
+ \orm@parse@xunique@@bar#1:#2\pgf@nil%
+ \else%
+ \orm@parse@xunique@@bar#1-#1:#2\pgf@nil%
+ \fi%
+}
+
+\def\orm@parse@xunique@@bar#1-#2:#3\pgf@nil{%
+ \def\orm@tempA{#1}%
+ \ifx\orm@tempA\pgfutil@empty%
+ \relax%
+ \orm@parse@xunique@@bar#2-#2:-1\pgf@nil
+ \else%
+\tikzset{append after command={
+ \bgroup%
+ [current point is local=true]
+ let \p1 = (\tikzlastnode.west), \p2 = (\tikzlastnode.east)
+ in \pgfextra{\pgfmathparse{(\x2-\x1)/4mm}}
+ (\tikzlastnode) node[
+ /orm/uniqueness bar from/.expand once=#1,
+ /orm/uniqueness bar to/.expand once=#2,
+ /orm/uniqueness bar set roles/.expand once=\pgfmathresult,
+ /orm/uniqueness bar level=#3,
+ shape=uniqueness bar,
+ \orm@unique@bar@style,
+ minimum height=2.5mm,
+ /orm/uniqueness bar style
+ ]{}
+ \egroup
+ }}%
+ \fi%
+}
+
+%% Skipped uniqueness bar
+% TODO: remove this duplicated code.
+
+\tikzset{
+ skip unique/.code={\orm@parse@sunique#1:\pgf@nil},
+ skip unique/.default=1,
+}
+
+% parses '<which>:<level>' and '<which>'
+\def\orm@parse@sunique#1:#2\pgf@nil{%
\def\orm@temp{#2}%
\ifx\orm@temp\pgfutil@empty%
- \orm@@parse@unique#1:1_1:\pgf@nil%
+ \orm@@parse@sunique#1:1:\pgf@nil%
\else%
- \orm@@parse@unique#1:1_#2\pgf@nil%
+ \orm@@parse@sunique#1:#2\pgf@nil%
\fi%
}
-% parses n-m:l and n:l
-\def\orm@@parse@unique#1:#2_#3:\pgf@nil{%
+% parses n-m:<level> and n:<level>
+\def\orm@@parse@sunique#1:#2:\pgf@nil{%
\pgfutil@in@{-}{#1}%
\ifpgfutil@in@%
- \orm@parse@unique@@bar#1:#3_#2\pgf@nil%
+ \orm@parse@sunique@@bar#1:#2\pgf@nil%
\else%
- \orm@parse@unique@@bar#1-#1:#3_#2\pgf@nil%
+ \orm@parse@sunique@@bar#1-#1:#2\pgf@nil%
\fi%
}
-% Appends a uniqueness bar at the current predicate node.
-%
-% #1 - from role (1,2,..)
-% #2 - to role (1,2,..)
-% #3 - level (above: 1,2,.., below: -1,-2,..)
-% #4 - 1 if skipped, 0 otherwise
-\def\orm@parse@unique@@bar#1-#2:#3_#4\pgf@nil{%
+\def\orm@parse@sunique@@bar#1-#2:#3\pgf@nil{%
\def\orm@tempA{#1}%
\ifx\orm@tempA\pgfutil@empty%
\relax%
- \orm@parse@unique@@bar#2-#2:-1_#4\pgf@nil
+ \orm@parse@xunique@@bar#2-#2:-1\pgf@nil
\else%
- \tikzset{append after command={%
- \bgroup%
- [current point is local=true]
- \pgfextra{%
- \ifnum#4>0%
- \let\orm@unique@bar@style=\orm@unique@bar@skipped%
- \fi%
- }
- let
- \n1 = {\orm@rolebar@xshifta{#1}},
- \n2 = {\orm@rolebar@xshiftb{#2}},
- \n3 = {\orm@rolebar@yshift{#3}},
- \p1 = ($(\tikzlastnode.west)!-\n3!-90:(\tikzlastnode.east)$),
- \p2 = ($(\tikzlastnode.east)!-\n3!90:(\tikzlastnode.west)$)
- in
- ($(\p1)!\n1!(\p2)$) edge [\orm@unique@bar@style] ($(\p1)!\n2!(\p2)$)
- \egroup%
+\tikzset{append after command={
+ \bgroup%
+ [current point is local=true]
+ let \p1 = (\tikzlastnode.west), \p2 = (\tikzlastnode.east)
+ in \pgfextra{\pgfmathparse{(\x2-\x1)/4mm}}
+ \pgfextra{\let\orm@unique@bar@style=\orm@unique@bar@skipped}%
+ (\tikzlastnode) node[
+ /orm/uniqueness bar from/.expand once=#1,
+ /orm/uniqueness bar to/.expand once=#2,
+ /orm/uniqueness bar set roles/.expand once=\pgfmathresult,
+ /orm/uniqueness bar level=#3,
+ shape=uniqueness bar,
+ \orm@unique@bar@style,
+ minimum height=2.5mm
+ ]{}
+ \egroup
}}%
\fi%
}
+% TODO: add optional parameters and document this
+\tikzstyle{preferred unique}=[unique=1:1,unique=1:2]
+
\makeatother
%<–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––>