-
Notifications
You must be signed in to change notification settings - Fork 1
/
manual-listings-owl.tex
1158 lines (1033 loc) · 30.3 KB
/
manual-listings-owl.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
\documentclass[11pt,a4paper,final,oneside,onecolumn]{article}
\usepackage[english]{babel}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{url}
\usepackage{xcolor}
\usepackage[colorlinks]{hyperref}
\usepackage{listings-owl}
\author{Eugeniu Costetchi}
\title{Syntax highlighting for OWL syntaxes}
\date{06/05/2020}
\begin{document}
\maketitle
\tableofcontents
\begin{abstract}
Listings-OWL is a \texttt{listings} extension to provide syntax highlighting for SPARQL 1.1 and the most in use OWL syntaxes. This library implements Turtle, Manchester, and Functional-Style OWL syntaxes.
\end{abstract}
\section{Introduction}
This library implements syntax highlighting for the most in use serialisations for OWL language.
To use the package download it first into the document folder and refer to it in the header as follows: \verb|\usepackage{listings-owl}|
Then create your listing and indicate the language for highlighting. The possible variants offered by this library are: \texttt{SPARQL1.1}, \texttt{Turtle}, \texttt{SPARQL1.1}, \texttt{Functional-style} and \texttt{Manchester-syntax}.
\section{Languages}
This section demonstrates usage of the four languages each in a separate subsection. Each subsection comprises of a small example demonstrating the syntax highlight followed by the \LaTeX code to generate it.
\subsection{SPARQL}
\begin{lstlisting}[language=SPARQL1.1]
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?title
WHERE {
?x dc:title ?title
FILTER regex(?title, "^SPARQL")
}
\end{lstlisting}
\begin{verbatim}
\begin{lstlisting}[language=SPARQL1.1]
PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT ?title
WHERE
{
?x dc:title ?title
FILTER regex(?title, "^SPARQL")
}
\end{lstlisting}
\end{verbatim}
\subsection{Functional-Style syntax}
\begin{lstlisting}[language=Functional-style]
Prefix(:=<http://example.com/owl/families/>)
Ontology(<http://example.com/owl/families>
Import( <http://example.org/otherOntologies/families.owl> )
Declaration( Class( :Teenager ) )
SubClassOf( :Teenager
DataSomeValuesFrom( :hasAge
DatatypeRestriction( xsd:integer
xsd:minExclusive "12"^^xsd:integer
xsd:maxInclusive "19"^^xsd:integer
)
)
)
\end{lstlisting}
\begin{verbatim}
\begin{lstlisting}[language=Functional-style]
Prefix(:=<http://example.com/owl/families/>)
Ontology(<http://example.com/owl/families>
Import( <http://example.org/otherOntologies/families.owl> )
Declaration( Class( :Teenager ) )
SubClassOf( :Teenager
DataSomeValuesFrom( :hasAge
DatatypeRestriction( xsd:integer
xsd:minExclusive "12"^^xsd:integer
xsd:maxInclusive "19"^^xsd:integer
)
)
)
\end{lstlisting}
\end{verbatim}
\subsection{Manchester syntax}
\begin{lstlisting}[language=Manchester-syntax]
Ontology: <http://example.com/owl/families>
AnnotationProperty: rdfs:comment
Individual: John
Types:
Father,
hasChild exactly 5 OWL:Thing,
hasChild max 4 Parent,
hasChild exactly 3 Parent,
hasChild min 2 Parent
Facts:
hasWife Mary,
hasAge 51
SameAs:
Jack,
otherOnt:JohnBrown
DifferentFrom:
Bill
\end{lstlisting}
\begin{verbatim}
\begin{lstlisting}[language=Manchester-syntax]
Ontology: <http://example.com/owl/families>
Individual: John
Types:
Father,
hasChild exactly 5 OWL:Thing,
hasChild max 4 Parent,
hasChild exactly 3 Parent,
hasChild min 2 Parent
Facts:
hasWife Mary,
hasAge 51
SameAs:
Jack,
otherOnt:JohnBrown
DifferentFrom:
Bill
\end{lstlisting}
\end{verbatim}
\subsection{Turtle}
\begin{lstlisting}[language=Turtle]
@prefix : <http://example.com/owl/families/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
<http://example.com/owl/families> rdf:type OWL:Ontology .
:minorAge rdf:type rdfs:Datatype .
:toddlerAge rdf:type rdfs:Datatype ;
OWL:equivalentClass [
rdf:type rdfs:Datatype ;
OWL:oneOf [
rdf:type rdf:List ;
rdf:first 1 ;
rdf:rest [ rdf:type rdf:List ;
rdf:first 2 ;
rdf:rest rdf:nil
]
]
] .
\end{lstlisting}
\begin{verbatim}
\begin{lstlisting}[language=Turtle]
@prefix : <http://example.com/owl/families/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
<http://example.com/owl/families> rdf:type OWL:Ontology .
:minorAge rdf:type rdfs:Datatype .
:toddlerAge rdf:type rdfs:Datatype ;
OWL:equivalentClass [
rdf:type rdfs:Datatype ;
OWL:oneOf [
rdf:type rdf:List ;
rdf:first 1 ;
rdf:rest [ rdf:type rdf:List ;
rdf:first 2 ;
rdf:rest rdf:nil
]
]
] .
\end{lstlisting}
\end{verbatim}
\section{License and contributions}
Listings-OWL may be distributed and/or modified under the conditions of the LaTeX Project Public License version 1.3 or later. The Current Maintainer of this work is Eugeniu Costetchi (\url{[email protected]}), who welcomes contributions to the package on \href{https://github.com/costezki/owl4latex}{GitHub}.
The goal of this library is to provide a toolkit to draw quickly and efficiently beautiful OWL diagrams. Building such a library can be challenging for one pair of hands alone. If you have used this library yourself or have seen it used, we would greatly appreciate your opinion and feedback . Please open a Github issue or privately email the Current Maintainer with as much information as you can.
We also welcome technical feedback and bug reports in the form of GitHub Issues
and pull requests.
\section{Long Examples}
This set of long examples are possibly useful and should be removed from this document. They are kept currently for consultation and bug-fixing due to their extensive coverage of syntactic features. Their code is not provided but can be consulted directly in the \LaTeX code this document.
\subsection{SPARQL}
\begin{lstlisting}[language=SPARQL1.1]
PREFIX cdm: <http://publications.europa.eu/ontology/cdm#>
PREFIX cmr: <http://publications.europa.eu/ontology/cdm/cmr#>
PREFIX lg: <http://publications.europa.eu/resource/authority/language/>
PREFIX lbl: <http://publications.europa.eu/resource/authority/label-type/>
PREFIX org: <http://www.w3.org/ns/org#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX ev: <http://eurovoc.europa.eu/>
PREFIX 2euvoc4: <http://publications.europa.eu/ontology/euvoc#>
PREFIX sk23os: <http://www.w3.org/2004/02/skos/core#>
prefix ds-type: <http://publications.europa.eu/resource/authority/dataset-type/>
using named graph <http://special.graph/1>
select ?workCellarId ?work_title ?conceptLabel ?language ?dateDocument ?dateCreation ?manifestationType ?mimeType (?itemCellarId as ?download)
WHERE {
VALUES (?conceptLabel ?concept) {
("endemic disease" <http://eurovoc.europa.eu/1758>)
('epidemiology' <http://eurovoc.europa.eu/838>)
("epidemic" <http://eurovoc.europa.eu/837>)
('disease surveillance' <http://eurovoc.europa.eu/c_abfaf2ea>)
("health control" <http://eurovoc.europa.eu/192>)
("public hygiene" <http://eurovoc.europa.eu/3371>)
("respiratory disease" <http://eurovoc.europa.eu/1756>)
("hospital infection" <http://eurovoc.europa.eu/c_9b88f778>)
("patient safety" <http://eurovoc.europa.eu/c_60d3928d>)
("patient's rights" <http://eurovoc.europa.eu/3370>)
("illness" <http://eurovoc.europa.eu/1754>)
}
#?workCellarId owl:sameAs ?workPublicId .
?workCellarId a cdm:work ;
cdm:work_is_about_concept_eurovoc ?concept ;
cdm:work_title ?work_title .
OPTIONAL {?workCellarId cdm:work_date_document ?dateDocument . }
OPTIONAL {?workCellarId cdm:work_date_creation ?dateCreation . }
#?expressionCellarId owl:sameAs ?expressionPublicId .
?expressionCellarId cdm:expression_belongs_to_work ?workCellarId .
OPTIONAL { ?expressionCellarId cdm:expression_uses_language ?language . }
#?manifestationCellarId owl:sameAs ?manifestationPublicId .
?manifestationCellarId cdm:manifestation_manifests_expression ?expressionCellarId .
OPTIONAL { ?manifestationCellarId cdm:manifestation_type ?manifestationType . }
# item is resolved to the phisical file directly
#?itemCellarId owl:sameAs ?itemPublicId .
?itemCellarId cdm:item_belongs_to_manifestation ?manifestationCellarId .
OPTIONAL { ?itemCellarId cmr:manifestationMimeType ?mimeType . }
avg(some average)
bind(if(true, 'ssd',5454)) as ?newVariable
}
limit 1000
\end{lstlisting}
\subsection{Functional-Style syntax}
\begin{lstlisting}[language=Functional-style]
Prefix(:=<http://example.com/owl/families/>)
Prefix(otherOnt:=<http://example.org/otherOntologies/families/>)
Prefix(xsd:=<http://www.w3.org/2001/XMLSchema#>)
Prefix(owl:=<http://www.w3.org/2002/07/owl#>)
Ontology(<http://example.com/owl/families>
Import( <http://example.org/otherOntologies/families.owl> )
Declaration( NamedIndividual( :John ) )
Declaration( NamedIndividual( :Mary ) )
Declaration( NamedIndividual( :Jim ) )
Declaration( NamedIndividual( :James ) )
Declaration( NamedIndividual( :Jack ) )
Declaration( NamedIndividual( :Bill ) )
Declaration( NamedIndividual( :Susan ) )
Declaration( Class( :Person ) )
AnnotationAssertion( rdfs:comment :Person "Represents the set of all people." )
Declaration( Class( :Woman ) )
Declaration( Class( :Parent ) )
Declaration( Class( :Father ) )
Declaration( Class( :Mother ) )
Declaration( Class( :SocialRole ) )
Declaration( Class( :Man ) )
Declaration( Class( :Teenager ) )
Declaration( Class( :ChildlessPerson ) )
Declaration( Class( :Human ) )
Declaration( Class( :Female ) )
Declaration( Class( :HappyPerson ) )
Declaration( Class( :JohnsChildren ) )
Declaration( Class( :NarcisticPerson ) )
Declaration( Class( :MyBirthdayGuests ) )
Declaration( Class( :Dead ) )
Declaration( Class( :Orphan ) )
Declaration( Class( :Adult ) )
Declaration( Class( :YoungChild ) )
Declaration( ObjectProperty( :hasWife ) )
Declaration( ObjectProperty( :hasChild ) )
Declaration( ObjectProperty( :hasDaughter ) )
Declaration( ObjectProperty( :loves ) )
Declaration( ObjectProperty( :hasSpouse ) )
Declaration( ObjectProperty( :hasGrandparent ) )
Declaration( ObjectProperty( :hasParent ) )
Declaration( ObjectProperty( :hasBrother ) )
Declaration( ObjectProperty( :hasUncle ) )
Declaration( ObjectProperty( :hasSon ) )
Declaration( ObjectProperty( :hasAncestor ) )
Declaration( ObjectProperty( :hasHusband ) )
Declaration( DataProperty( :hasAge ) )
Declaration( DataProperty( :hasSSN ) )
Declaration( Datatype( :personAge ) )
Declaration( Datatype( :minorAge ) )
Declaration( Datatype( :majorAge ) )
Declaration( Datatype( :toddlerAge ) )
SubObjectPropertyOf( :hasWife :hasSpouse )
SubObjectPropertyOf(
ObjectPropertyChain( :hasParent :hasParent )
:hasGrandparent
)
SubObjectPropertyOf(
ObjectPropertyChain( :hasFather :hasBrother )
:hasUncle
)
SubObjectPropertyOf(
:hasFather
:hasParent
)
EquivalentObjectProperties( :hasChild otherOnt:child )
InverseObjectProperties( :hasParent :hasChild )
EquivalentDataProperties( :hasAge otherOnt:age )
DisjointObjectProperties( :hasSon :hasDaughter )
ObjectPropertyDomain( :hasWife :Man )
ObjectPropertyRange( :hasWife :Woman )
DataPropertyDomain( :hasAge :Person )
DataPropertyRange( :hasAge xsd:nonNegativeInteger )
SymmetricObjectProperty( :hasSpouse )
AsymmetricObjectProperty( :hasChild )
DisjointObjectProperties( :hasParent :hasSpouse )
ReflexiveObjectProperty( :hasRelative )
IrreflexiveObjectProperty( :parentOf )
FunctionalObjectProperty( :hasHusband )
InverseFunctionalObjectProperty( :hasHusband )
TransitiveObjectProperty( :hasAncestor )
FunctionalDataProperty( :hasAge )
SubClassOf( :Woman :Person )
SubClassOf( :Mother :Woman )
SubClassOf(
:Grandfather
ObjectIntersectionOf( :Man :Parent )
)
SubClassOf( :Teenager
DataSomeValuesFrom( :hasAge
DatatypeRestriction( xsd:integer
xsd:minExclusive "12"^^xsd:integer
xsd:maxInclusive "19"^^xsd:integer
)
)
)
SubClassOf(
Annotation( rdfs:comment "States that every man is a person." )
:Man
:Person
)
SubClassOf(
:Father
ObjectIntersectionOf( :Man :Parent )
)
SubClassOf(
:ChildlessPerson
ObjectIntersectionOf(
:Person
ObjectComplementOf(
ObjectSomeValuesFrom(
ObjectInverseOf( :hasParent )
owl:Thing
)
)
)
)
SubClassOf(
ObjectIntersectionOf(
ObjectOneOf( :Mary :Bill :Meg )
:Female
)
ObjectIntersectionOf(
:Parent
ObjectMaxCardinality( 1 :hasChild )
ObjectAllValuesFrom( :hasChild :Female )
)
)
EquivalentClasses( :Person :Human )
EquivalentClasses(
:Mother
ObjectIntersectionOf( :Woman :Parent )
)
EquivalentClasses(
:Parent
ObjectUnionOf( :Mother :Father )
)
EquivalentClasses(
:ChildlessPerson
ObjectIntersectionOf(
:Person
ObjectComplementOf( :Parent )
)
)
EquivalentClasses(
:Parent
ObjectSomeValuesFrom( :hasChild :Person )
)
EquivalentClasses(
:HappyPerson
ObjectIntersectionOf(
ObjectAllValuesFrom( :hasChild :HappyPerson )
ObjectSomeValuesFrom( :hasChild :HappyPerson )
)
)
EquivalentClasses(
:JohnsChildren
ObjectHasValue( :hasParent :John )
)
EquivalentClasses(
:NarcisticPerson
ObjectHasSelf( :loves )
)
EquivalentClasses(
:MyBirthdayGuests
ObjectOneOf( :Bill :John :Mary)
)
EquivalentClasses(
:Orphan
ObjectAllValuesFrom(
ObjectInverseOf( :hasChild )
:Dead
)
)
EquivalentClasses( :Adult otherOnt:Grownup )
EquivalentClasses(
:Parent
ObjectSomeValuesFrom(
:hasChild
:Person
)
)
DisjointClasses( :Woman :Man )
DisjointClasses(
:Mother
:Father
:YoungChild
)
HasKey( :Person () ( :hasSSN ) )
DatatypeDefinition(
:personAge
DatatypeRestriction( xsd:integer
xsd:minInclusive "0"^^xsd:integer
xsd:maxInclusive "150"^^xsd:integer
)
)
DatatypeDefinition(
:minorAge
DatatypeRestriction( xsd:integer
xsd:minInclusive "0"^^xsd:integer
xsd:maxInclusive "18"^^xsd:integer
)
)
DatatypeDefinition(
:majorAge
DataIntersectionOf(
:personAge
DataComplementOf( :minorAge )
)
)
DatatypeDefinition(
:toddlerAge
DataOneOf( "1"^^xsd:integer "2"^^xsd:integer )
)
ClassAssertion( :Person :Mary )
ClassAssertion( :Woman :Mary )
ClassAssertion(
ObjectIntersectionOf(
:Person
ObjectComplementOf( :Parent )
)
:Jack
)
ClassAssertion(
ObjectMaxCardinality( 4 :hasChild :Parent )
:John
)
ClassAssertion(
ObjectMinCardinality( 2 :hasChild :Parent )
:John
)
ClassAssertion(
ObjectExactCardinality( 3 :hasChild :Parent )
:John
)
ClassAssertion(
ObjectExactCardinality( 5 :hasChild )
:John
)
ClassAssertion( :Father :John )
ClassAssertion( :SocialRole :Father )
ObjectPropertyAssertion( :hasWife :John :Mary )
NegativeObjectPropertyAssertion( :hasWife :Bill :Mary )
NegativeObjectPropertyAssertion(
:hasDaughter
:Bill
:Susan
)
DataPropertyAssertion( :hasAge :John "51"^^xsd:integer )
NegativeDataPropertyAssertion( :hasAge :Jack "53"^^xsd:integer )
SameIndividual( :James :Jim )
SameIndividual( :John otherOnt:JohnBrown )
SameIndividual( :Mary otherOnt:MaryBrown )
DifferentIndividuals( :John :Bill )
)
\end{lstlisting}
\subsection{Manchester syntax}
\begin{lstlisting}[language=Manchester-syntax]
Ontology: <http://example.com/owl/families>
AnnotationProperty: rdfs:comment
Datatype: personAge
EquivalentTo:
xsd:integer[>= 0 , <= 150]
Datatype: rdf:PlainLiteral
Datatype: toddlerAge
EquivalentTo:
{1 , 2}
Datatype: xsd:nonNegativeInteger
Datatype: minorAge
Datatype: majorAge
EquivalentTo:
(personAge and not minorAge)
Datatype: xsd:integer
ObjectProperty: hasBrother
ObjectProperty: hasRelative
Characteristics:
Reflexive
ObjectProperty: otherOnt:child
EquivalentTo:
hasChild
ObjectProperty: parentOf
Characteristics:
Irreflexive
ObjectProperty: hasSon
DisjointWith:
hasDaughter
ObjectProperty: hasWife
SubPropertyOf:
hasSpouse
Domain:
Man
Range:
Woman
ObjectProperty: hasHusband
Characteristics:
InverseFunctional,
Functional
ObjectProperty: hasParent
DisjointWith:
hasSpouse
InverseOf:
hasChild
ObjectProperty: hasUncle
SubPropertyChain:
hasFather o hasBrother
ObjectProperty: hasGrandparent
SubPropertyChain:
hasParent o hasParent
ObjectProperty: hasFather
SubPropertyOf:
hasParent
ObjectProperty: hasDaughter
DisjointWith:
hasSon
ObjectProperty: hasSpouse
DisjointWith:
hasParent
Characteristics:
Symmetric
ObjectProperty: hasAncestor
Characteristics:
Transitive
ObjectProperty: hasChild
EquivalentTo:
otherOnt:child
Characteristics:
Asymmetric
InverseOf:
hasParent
ObjectProperty: loves
DataProperty: otherOnt:age
EquivalentTo:
hasAge
DataProperty: hasAge
Characteristics:
Functional
Domain:
Person
Range:
xsd:nonNegativeInteger
EquivalentTo:
otherOnt:age
DataProperty: hasSSN
Class: OWL:Thing
Class: Father
SubClassOf:
Man
and Parent
Class: Mother
EquivalentTo:
Parent
and Woman
SubClassOf:
Woman
Class: Human
EquivalentTo:
Person
Class: YoungChild
Class: Dead
Class: Grandfather
SubClassOf:
Man
and Parent
Class: Person
Annotations:
rdfs:comment "Represents the set of all people."
EquivalentTo:
Human
HasKey:
hasSSN
Class: MyBirthdayGuests
EquivalentTo:
{Bill , John , Mary}
Class: Adult
EquivalentTo:
otherOnt:Grownup
Class: SocialRole
Class: HappyPerson
EquivalentTo:
(hasChild some HappyPerson)
and (hasChild only HappyPerson)
Class: Parent
EquivalentTo:
(Father or Mother),
hasChild some Person
Class: Teenager
SubClassOf:
hasAge some xsd:integer[> 12 , <= 19]
Class: Orphan
EquivalentTo:
inverse (hasChild) only Dead
Class: NarcisticPerson
EquivalentTo:
loves some Self
Class: ChildlessPerson
EquivalentTo:
Person
and (not (Parent))
SubClassOf:
Person
and (not ( inverse (hasParent) some OWL:Thing))
Class: Woman
SubClassOf:
Person
DisjointWith:
Man
Class: JohnsChildren
EquivalentTo:
hasParent value John
Class: otherOnt:Grownup
EquivalentTo:
Adult
Class: Female
Class: Man
Annotations: rdfs:comment "States that every man is a person."
SubClassOf:
Person
DisjointWith:
Woman
Individual: Mary
Types:
Person,
Woman
SameAs:
otherOnt:MaryBrown
Individual: John
Types:
Father,
hasChild exactly 5 OWL:Thing,
hasChild max 4 Parent,
hasChild exactly 3 Parent,
hasChild min 2 Parent
Facts:
hasWife Mary,
hasAge 51
SameAs:
Jack,
otherOnt:JohnBrown
DifferentFrom:
Bill
Individual: Jim
Individual: otherOnt:JohnBrown
SameAs:
John
Individual: otherOnt:MaryBrown
SameAs:
Mary
Individual: James
Individual: Susan
Individual: Bill
Facts:
not hasWife Mary,
not hasDaughter Susan
DifferentFrom:
John
Individual: Father
Types:
SocialRole
Individual: Jack
Types:
Person
and (not (Parent))
Facts:
not hasAge 53
SameAs:
John
Individual: Meg
DisjointClasses:
Father,Mother,YoungChild
\end{lstlisting}
% \begin{lstlisting}[language=OWL-Manchester]
%Prefix: : <http://ex.com/owl/families#>
%Prefix: g: <http://ex.com/owl2/families#>
%
%Ontology: <http://example.com/owl/families> <http://example.com/owl/families-v1>
%Import: <http://ex.com/owl2/families.owl>
%Annotations: creator John,
% Annotations: rdfs:comment "Creation Year"
% creationYear 2008,
% mainClass Person
%
%ObjectProperty: hasWife
% Annotations: ...
% Characteristics: Functional, InverseFunctional, Reflexive, Irreflexive, Asymmetric, Transitive
% Domain: Annotations: rdfs:comment "General domain",
% creator John
% Person,
% Annotations: rdfs:comment "More specific domain"
% Man
% Range: Person, Woman
% SubPropertyOf: hasSpouse, loves
% EquivalentTo: isMarriedTo ,...
% DisjointWith: hates ,...
% InverseOf: hasSpouse, inverse hasSpouse
% SubPropertyChain: Annotations: ... hasChild o hasParent o...
%
%DataProperty: hasAge
% Annotations: ...
% Characteristics: Functional
% Domain: Person ,...
% Range: integer ,...
% SubPropertyOf: hasVerifiedAge ,...
% EquivalentTo: hasAgeInYears ,...
% DisjointWith: hasSSN ,...
%
%AnnotationProperty: creator
% Annotations: ...
% Domain: Person ,...
% Range: integer ,...
% SubPropertyOf: initialCreator ,...
%
%Datatype: NegInt
% Annotations: ...
% EquivalentTo: integer[< 0]
%
%Class: Person
% Annotations: ...
% SubClassOf: owl:Thing that hasFirstName exactly 1 and hasFirstName only string[minLength 1] ,...
% SubClassOf: hasAge exactly 1 and hasAge only not NegInt,...
% SubClassOf: hasGender exactly 1 and hasGender only {female , male} ,...
% SubClassOf: hasSSN max 1, hasSSN min 1
% SubClassOf: not hates Self, ...
% EquivalentTo: g:People ,...
% DisjointWith: g:Rock , g:Mineral ,...
% DisjointUnionOf: Annotations: ... Child, Adult
% HasKey: Annotations: ... hasSSN
%
%Individual: John
% Annotations: ...
% Types: Person , hasFirstName value "John" or hasFirstName value "Jack"^^xsd:string
% Facts: hasWife Mary, not hasChild Susan, hasAge 33, hasChild _:child1
% SameAs: Jack ,...
% DifferentFrom: Susan ,...
%
%Individual: _:child1
% Annotations: ...
% Types: Person ,...
% Facts: hasChild Susan ,...
%
%DisjointClasses: Annotations: ... g:Rock, g:Scissor, g:Paper
%EquivalentProperties: Annotations: ... hates, loathes, despises
%DisjointProperties: Annotations: ... hates, loves, indifferent
%EquivalentProperties: Annotations: ... favoriteNumber, g:favouriteNumber, g:favouriteInteger
%DisjointProperties: Annotations: ... favoriteInteger, favouriteReal
%SameIndividual: Annotations: ... John, Jack, Joe, Jim
%DifferentIndividuals: Annotations: ... John, Susan, Mary, Jill
% \end{lstlisting}
\subsection{Turtle}
\begin{lstlisting}[language=Turtle]
@prefix : <http://example.com/owl/families/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://example.com/owl/families> rdf:type OWL:Ontology .
:majorAge rdf:type rdfs:Datatype ;
OWL:equivalentClass [
rdf:type rdfs:Datatype ;
OWL:intersectionOf (
:personAge
[ rdf:type rdfs:Datatype ;
OWL:datatypeComplementOf :minorAge]
)
] .
:minorAge rdf:type rdfs:Datatype .
:personAge rdf:type rdfs:Datatype ;
OWL:equivalentClass [
rdf:type rdfs:Datatype ;
OWL:onDatatype xs:integer ;
OWL:withRestrictions (
[ xs:maxInclusive 150 ]
[ xs:minInclusive 0] )
] .
:toddlerAge rdf:type rdfs:Datatype ;
OWL:equivalentClass [
rdf:type rdfs:Datatype ;
OWL:oneOf [
rdf:type rdf:List ;
rdf:first 1 ;
rdf:rest [ rdf:type rdf:List ;
rdf:first 2 ;
rdf:rest rdf:nil
]
]
] .
:hasAncestor rdf:type OWL:ObjectProperty ,
OWL:TransitiveProperty .
:hasBrother rdf:type OWL:ObjectProperty .
:hasChild rdf:type OWL:AsymmetricProperty ,
OWL:ObjectProperty ;
OWL:equivalentProperty otherOnt:child .
:hasDaughter rdf:type OWL:ObjectProperty ;
OWL:propertyDisjointWith :hasSon .
:hasFather rdf:type OWL:ObjectProperty ;
rdfs:subPropertyOf :hasParent .
:hasGrandparent rdf:type OWL:ObjectProperty ;
OWL:propertyChainAxiom ( :hasParent
:hasParent
) .
:hasHusband rdf:type OWL:FunctionalProperty ,
OWL:InverseFunctionalProperty ,
OWL:ObjectProperty .
:hasParent rdf:type OWL:ObjectProperty ;
OWL:inverseOf :hasChild ;
OWL:propertyDisjointWith :hasSpouse .
:hasRelative rdf:type OWL:ObjectProperty ,
OWL:ReflexiveProperty .
:hasSon rdf:type OWL:ObjectProperty .
:hasSpouse rdf:type OWL:ObjectProperty ,
OWL:SymmetricProperty .
:hasUncle rdf:type OWL:ObjectProperty ;
OWL:propertyChainAxiom ( :hasFather
:hasBrother
) .
:hasWife rdf:type OWL:ObjectProperty ;
rdfs:domain :Man ;
rdfs:range :Woman ;
rdfs:subPropertyOf :hasSpouse .
:loves rdf:type OWL:ObjectProperty .
:parentOf rdf:type OWL:IrreflexiveProperty ,
OWL:ObjectProperty .
otherOnt:child rdf:type OWL:ObjectProperty .
:hasAge rdf:type OWL:DatatypeProperty ,
OWL:FunctionalProperty ;
rdfs:domain :Person ;
OWL:equivalentProperty otherOnt:age ;
rdfs:range xs:nonNegativeInteger .
:hasSSN rdf:type OWL:DatatypeProperty .
otherOnt:age rdf:type OWL:DatatypeProperty .
:Adult rdf:type OWL:Class ;
OWL:equivalentClass otherOnt:Grownup .
:ChildlessPerson rdf:type OWL:Class ;
OWL:equivalentClass [ rdf:type OWL:Class ;
OWL:intersectionOf (
:Person
[ rdf:type OWL:Class ;
OWL:complementOf :Parent
]
)
] ;
rdfs:subClassOf [ rdf:type OWL:Class ;
OWL:intersectionOf (
:Person
[ rdf:type OWL:Class ;
OWL:complementOf [
rdf:type OWL:Restriction ;
OWL:onProperty [ OWL:inverseOf :hasParent
] ;
OWL:someValuesFrom OWL:Thing
]
]
)
] .
:Dead rdf:type OWL:Class .
:Father rdf:type OWL:Class ;
rdfs:subClassOf [
rdf:type OWL:Class ;
OWL:intersectionOf ( :Man
:Parent
)
] .
:Female rdf:type OWL:Class .
:Grandfather rdf:type OWL:Class ;
rdfs:subClassOf [
rdf:type OWL:Class ;
OWL:intersectionOf ( :Man :Parent )
] .
:HappyPerson rdf:type OWL:Class ;
OWL:equivalentClass [
rdf:type OWL:Class ;
OWL:intersectionOf (
[ rdf:type OWL:Restriction ;
OWL:onProperty :hasChild ;
OWL:someValuesFrom :HappyPerson
]
[ rdf:type OWL:Restriction ;
OWL:onProperty :hasChild ;
OWL:allValuesFrom :HappyPerson
]
)
] .
:Human rdf:type OWL:Class ;
OWL:equivalentClass :Person .
:JohnsChildren rdf:type OWL:Class ;
OWL:equivalentClass [
rdf:type OWL:Restriction ;
OWL:onProperty :hasParent ;
OWL:hasValue :John
] .
:Man rdf:type OWL:Class ;
rdfs:subClassOf :Person ;
OWL:disjointWith :Woman .