-
Notifications
You must be signed in to change notification settings - Fork 2
/
README.html
1791 lines (1626 loc) · 77.5 KB
/
README.html
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
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Semantic Objects Modeling Language</title>
<meta name="author" content="Vladimir Alexiev" />
<meta name="generator" content="Org Mode" />
<style>
#content { max-width: 60em; margin: auto; }
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #e6e6e6;
border-radius: 3px;
background-color: #f2f2f2;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: auto;
}
pre.src:before {
display: none;
position: absolute;
top: -8px;
right: 12px;
padding: 3px;
color: #555;
background-color: #f2f2f299;
}
pre.src:hover:before { display: inline; margin-top: 14px;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-authinfo::before { content: 'Authinfo'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { }
</style>
<style> #content {max-width: 120em; margin: auto} h1,h2,h3,h4,h5,h6,h7 {font-family: Arial} .author, .date, .creator {-webkit-margin-before: 0em; -webkit-margin-after: 0em} .abstract {margin: 1em; padding: 1em; border: 1px solid black} .abstract:before {content: 'Abstract: '; font-weight: bold} #preamble p {font-size: 110%%; margin-left: auto; margin-right: auto; text-align: center} th.org-left {text-align:left} th.org-right {text-align:right} th.org-center {text-align:center} th, td {line-height: 1em; border-width: 1px; border-style: solid solid; border-spacing: 2px 2px; padding: 2px 1px} .CANCELED {color: blue} .MAYBE {color: blue} .POSTPONED {color: blue} .SAME {color: blue} .APPLIED {color: orange} .FOLLOW {color: orange} .INPROGRESS {color: orange} .NEXT {color: orange} .IER {color: orange}.underline {text-decoration:underline} </style>
</head>
<body>
<div id="preamble" class="status">
<p class="author">Author: Vladimir Alexiev (<a href="mailto:[email protected]">[email protected]</a>)</p>
<p class="date">Date: 2024-10-14</p>
</div>
<div id="content" class="content">
<h1 class="title">Semantic Objects Modeling Language</h1>
<div id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
<li><a href="#intro">Intro</a>
<ul>
<li><a href="#why-soml">Why SOML?</a></li>
<li><a href="#similar-schema-languages">Similar Schema Languages</a></li>
<li><a href="#what-is-soml">What is SOML</a></li>
</ul>
</li>
<li><a href="#complex-schema-company-graph">Complex Schema (Company Graph)</a>
<ul>
<li><a href="#example-class">Example Class</a></li>
<li><a href="#example-inverse-alias">Example Inverse Alias</a></li>
<li><a href="#example-diagram-exchange-listing-soml">Example Diagram: Exchange Listing SOML</a></li>
<li><a href="#example-diagram-exchange-listing-rdf">Example Diagram: Exchange Listing RDF</a></li>
</ul>
</li>
<li><a href="#soml-tooling">SOML Tooling</a>
<ul>
<li><a href="#owl2soml">owl2soml</a></li>
<li><a href="#tsv2soml">tsv2soml</a>
<ul>
<li><a href="#reusing-property-characteristics">Reusing Property Characteristics</a></li>
</ul>
</li>
<li><a href="#soml-map">soml-map</a></li>
<li><a href="#soml-simplify">soml-simplify</a>
<ul>
<li><a href="#example-source-soml-schema">Example Source (SOML schema)</a></li>
<li><a href="#example-target-simplified">Example Target (Simplified)</a></li>
</ul>
</li>
<li><a href="#tsv2owl">tsv2owl</a>
<ul>
<li><a href="#ontology-preamble">Ontology Preamble</a></li>
<li><a href="#tsv2owl-options">tsv2owl Options</a></li>
<li><a href="#tsv2owl-columns-and-features">tsv2owl Columns and Features</a></li>
<li><a href="#rdf-replacement">RDF Replacement</a></li>
<li><a href="#running-tsv2owl">Running tsv2owl</a></li>
</ul>
</li>
<li><a href="#soml2puml">soml2puml</a></li>
</ul>
</li>
<li><a href="#tricky-points-and-deficiencies">Tricky Points and Deficiencies</a>
<ul>
<li><a href="#graphql-type-vs-rdf-type">GraphQL Type vs rdf:type</a></li>
<li><a href="#single-vs-multiple-value-props">Single vs Multiple-Value Props</a></li>
<li><a href="#inverse-aliases">Inverse Aliases</a></li>
<li><a href="#literals">Literals</a></li>
<li><a href="#extended-pattern-prefix-regex">Extended Pattern (Prefix + Regex)</a></li>
<li><a href="#iri-generation">IRI Generation</a></li>
<li><a href="#schema-inclusion-modularity">Schema Inclusion/Modularity</a></li>
</ul>
</li>
</ul>
</div>
</div>
<p>
(You can read this <a href="https://github.com/VladimirAlexiev/soml/">rendered by github</a> or <a href="https://rawgit2.com/VladimirAlexiev/soml/master/README.html">rendered as HTML</a>)
</p>
<div id="outline-container-intro" class="outline-2">
<h2 id="intro">Intro</h2>
<div class="outline-text-2" id="text-intro">
<p>
The Semantic Objects Modeling Language (SOML)
is a simple YAML-based language for describing business objects (business entities, domain objects)
that are handled using semantic technologies and GraphQL.
SOML is the language of the Ontotext Platform.
</p>
<p>
The Ontotext Platform helps create knowledge graphs in an easier way,
both using and enabling text analytics to interlink and enrich knowledge graphs,
and enabling better search, exploration, classification, and recommendation across diverse information spaces.
</p>
<p>
Version 3.0 of the Platform was released at the end of 2019 and is under active develoment and evolution.
</p>
<ul class="org-ul">
<li>It is documented at <a href="http://platform.ontotext.com/">http://platform.ontotext.com/</a>, including:
<ul class="org-ul">
<li><a href="http://platform.ontotext.com/semantic-objects/semantic-objects.html">Semantic Objects as a Service (SOaaS)</a></li>
<li><a href="http://platform.ontotext.com/soml/index.html">Semantic Objects Modeling Language (SOML)</a></li>
<li><a href="http://platform.ontotext.com/tutorials/soaas-tutorial.html">SOaaS Tutorial</a></li>
</ul></li>
<li>The blog post <a href="https://www.ontotext.com/blog/the-rise-of-the-knowledge-graph/">A New Hope: The Rise of the Knowledge Graph</a>
(Navigating through the Star Wars universe with knowledge graphs, SPARQL and GraphQL),
6 December 2019
introduces the platform,
compares RDF and GraphQL representations of a domain (Star Wars),
and shows interactive GraphQL queries.</li>
</ul>
<p>
This blog goes in-depth on SOML:
motivates the use of SOML,
describes some tricky points of SOML usage and GraphQL deficiencies,
and introduces some SOML tooling for
generating SOML (<code>tsv2soml</code>) and mapping RDF data (<code>soml-map</code>)
</p>
</div>
<div id="outline-container-why-soml" class="outline-3">
<h3 id="why-soml">Why SOML?</h3>
<div class="outline-text-3" id="text-why-soml">
<p>
We often are asked why we had to introduce yet another object modeling language?
Why didn't we use existing semantic web mechanisms such as
ontologies (RDFS or OWL) or shapes (SHACL or SHEX),
or schema mechanisms such as GraphQL schema, JSON schema and the like?
The answer is multi-fold:
</p>
<dl class="org-dl">
<dt>Semantic models are more than ontologies</dt><dd>Every sizable semantic project (and many LOD datasets) use a number of ontologies together.
While ontologies describe the vocabulary of classes and properties to use,
extra mechanisms are required to describe how these elements are put together,
and what are the data expectations about different kinds of nodes in the graph.
One could do some of that with ontologies,
e.g. use OWL property cardinalities,
complex OWL classes to define polymorphic domains and ranges,
and XSD datatype constructions to describe literal patterns.
However, the inferential rather than validation semantics of RDFS and OWL
and their inherent complexity
have led people to use application profiles and RDF shapes instead.</dd>
<dt>Lack of standardization</dt><dd>While there are several implementations of GraphQL querying over RDF,
each of them does it in a different way and there is no standardization.
The <a href="https://www.topquadrant.com/graphql/graphql-shacl.html">TopQuadrant GraphQL to SHACL</a> mapping comes close to using
SHACL for generating GraphQL schemas, but still uses custom extensions.
Definitive mappings between SHACL and SHEX are not available.
The <a href="https://www.w3.org/community/graphql-rdf/">Bridging GraphQL and RDF</a> W3C Community Group has been launched (Jan 2020)
with the mission to close this gap,
and hopefully define standard mappings/crosswalks between SHACL, SHEX and
GraphQL schemas and validation mechanisms.
We plan to participate actively in this group.</dd>
<dt>Freedom to innovate</dt><dd>Our ambition is for the Ontotext platform to cover a wide variety of enterprise features.
To be able to develop them at our own pace, we need a language where we can add such innovations.
Examples include
data validation based on RDF shapes (generated from SOML);
Role-Based Access Control (RBAC);
faceting, autocompletion and full-text search;
aggregation;
distribution of data to various stores through GraphDB Connectors and/or GraphQL Federation.</dd>
<dt>Technology independence</dt><dd>Flowing from the previous reason, we'd like SOML to be technology-independent to some degree.
While we don't aim for a theoretical develpment that lives in a technological vacuum,
we need to be able to generate a number of technical artefacts from the same business-level model.</dd>
</dl>
</div>
</div>
<div id="outline-container-similar-schema-languages" class="outline-3">
<h3 id="similar-schema-languages">Similar Schema Languages</h3>
<div class="outline-text-3" id="text-similar-schema-languages">
<p>
A number of schema languages have appeared recently that are based on YAML,
express business-level object models that are somewhat independent of technological choices,
and can render the models to a variety of schema technologies:
</p>
<ul class="org-ul">
<li><a href="https://biolink.github.io/biolinkml/">BioLink modeling language</a>.
Models are authored in YAML. A variety of artefacts can be generated, including SHEX, JSON-Schema, OWL, Python dataclasses, ElasticSearch type definitions,
UML diagrams, Markdown pages for deployment in a GitHub pages site, etc.</li>
<li><a href="https://www.hl7.org/fhir/">HL7 FHIR</a>, which is a business-level language for expressing Health Care models
and has renditions in UML, XML, JSON, Turtle, SHEX.</li>
<li><b>a.ml</b>: <a href="https://a.ml/">Anything Modeling Language</a> (see <a href="https://a.ml/docbook/">documentation</a>, <a href="https://a.ml/aml-spec/vocabularies/">vocabularies</a>, <a href="https://a.ml/aml-spec/dialects/">dialects</a>),
which targets mapping of YAML schemas to ontologies and SHACL shapes,
and YAML documents to RDF graphs.</li>
<li><a href="https://cloudinformationmodel.org/about.html">Cloud Information Model (CIM)</a>, which targets
AML Vocabulary (conceptual model),
AML Dialect (data shapes),
RDFS (entities and relationships),
SHACL (data shapes and constraints),
SQL DDL (relational database schema),
R2RML (mapping from relational schema to RDF),
RAML (REST API data types),
JSON Schema (data shapes)</li>
<li>The Uber Graph Schema Language, a YAML language that is
used to generate various artefacts (ProtoBuf, Avro, RDFS ontology, etc)
and to integrate <b>200 thousand</b> datasets at Uber.
While not publically available, it's described in presentations by <a href="https://www.slideshare.net/joshsh">Joshua Shinavier</a> including:
<ul class="org-ul">
<li><a href="https://www.slideshare.net/joshsh/a-graph-is-a-graph-is-a-graph-equivalence-transformation-and-composition-of-graph-data-models-129403012/1">A Graph is a Graph is a Graph: Equivalence, Transformation, and Composition of Graph Data Models</a> (Jan 2019).</li>
<li><a href="https://www.slideshare.net/joshsh/building-an-enterprise-knowledge-graph-uber-lessons-from-reality">Building an Enterprise Knowledge Graph @Uber: Lessons from Reality</a> (May 2019)</li>
</ul></li>
</ul>
</div>
</div>
<div id="outline-container-what-is-soml" class="outline-3">
<h3 id="what-is-soml">What is SOML</h3>
<div class="outline-text-3" id="text-what-is-soml">
<p>
At present SOML is very simple, but will evolve to include more features.
The overall structure of a SOML file (schema) is shown below.
</p>
<div class="org-src-container">
<pre class="src src-yaml"><span style="color: #b22222;"># </span><span style="color: #b22222;">comment</span>
<span style="color: #a0522d;">id</span>: /soml/<identifier>
<span style="color: #a0522d;">label</span>: some name
<span style="color: #a0522d;">created</span>: yyyy-mm-dd
<span style="color: #a0522d;">updated</span>: yyyy-mm-dd
<span style="color: #a0522d;">creator</span>: name and/or URL
<span style="color: #a0522d;">versionInfo</span>: version
<span style="color: #b22222;"># </span><span style="color: #b22222;">comment</span>
<span style="color: #a0522d;">specialPrefixes</span>:
<span style="color: #a0522d;">base_iri</span>: <base>
<span style="color: #a0522d;">vocab_iri</span>: <vocab>
<span style="color: #a0522d;">vocab_prefix</span>: <voc>
<span style="color: #a0522d;">ontology_iri</span>: <ontology>
<span style="color: #a0522d;">shape_iri</span>: <shape>
<span style="color: #a0522d;">prefixes</span>:
<span style="color: #a0522d;"><pfx></span>: <namespace>
<span style="color: #b22222;"># </span><span style="color: #b22222;">datatypes</span>
<span style="color: #a0522d;">types</span>:
<span style="color: #a0522d;"><type></span>: {<span style="color: #a0522d;">rdf</span>: <xsd-type>, <span style="color: #a0522d;">graphql</span>: <GQL-type>, <span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"..."</span>, <span style="color: #a0522d;">graphqlExtension</span>: <boolean>}
<span style="color: #a0522d;"><union-type></span>: {<span style="color: #a0522d;">union</span>: [<type>...], <span style="color: #a0522d;">graphql</span>: <GQL-type>, <span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"..."</span>}
<span style="color: #b22222;"># </span><span style="color: #b22222;">common property definitions</span>
<span style="color: #a0522d;">properties</span>:
<span style="color: #a0522d;"><prop></span>: {<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"..."</span>, <span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"..."</span>, <span style="color: #a0522d;">range</span>: <datatype|Obj>, <span style="color: #a0522d;">rangeCheck</span>: <boolean>, <span style="color: #a0522d;">typeCast</span>: <boolean>,
<span style="color: #a0522d;">kind</span>: (object|literal|mixed), <span style="color: #a0522d;">min</span>: <default 0>, <span style="color: #a0522d;">max</span>: <default 1>,
<span style="color: #a0522d;">inverseAlias</span>: <prop>, <span style="color: #a0522d;">inverse</span>: <prop>, <span style="color: #a0522d;">rdfProp</span>: pfx:prop, <span style="color: #a0522d;">symmetric</span>: <boolean>, <span style="color: #a0522d;">regex</span>: <span style="color: #8b2252;">'<regex>'</span>, <span style="color: #a0522d;">prefix</span>: <span style="color: #8b2252;">"<string>"</span>}
<span style="color: #b22222;"># </span><span style="color: #b22222;">object class definitions</span>
<span style="color: #a0522d;">objects</span>:
<span style="color: #a0522d;"><Obj></span>: {<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"..."</span>, <span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"..."</span>, <span style="color: #a0522d;">regex</span>: <span style="color: #8b2252;">'<regex>'</span>, <span style="color: #a0522d;">prefix</span>: <span style="color: #8b2252;">"<string>"</span>,
<span style="color: #a0522d;">typeProp</span>: <prop>, <span style="color: #a0522d;">type</span>: [<iri>...], <span style="color: #a0522d;">name</span>: <prop>, <span style="color: #a0522d;">inherits</span>: <Obj>, <span style="color: #a0522d;">kind</span>: (abstract|supertype)}
<span style="color: #a0522d;">props</span>:
<span style="color: #a0522d;"><prop></span>: ...
</pre>
</div>
<p>
From this schema the Platform generates a complex GraphQL schema
including a fairly complete querying language that allows you to
find any kind of object, filter, order, navigate through the KG,
and do pagination (limit, offset).
</p>
<p>
You can find details in the <a href="http://platform.ontotext.com/soml/index.html">SOML documentation</a>, while below we describe
some tricky points of SOML usage and GraphQL deficiencies, and some tooling.
</p>
</div>
</div>
</div>
<div id="outline-container-complex-schema-company-graph" class="outline-2">
<h2 id="complex-schema-company-graph">Complex Schema (Company Graph)</h2>
<div class="outline-text-2" id="text-complex-schema-company-graph">
<p>
To introduce the proper context for this blog (working with complex SOML schemas),
we'll describe the Ontotext Company Graph (ONTO CG) ontology and model.
It's a medium-high complexity data model that reuses 14 ontologies and adds classes and props of its own.
Of its 24 classes and 150 props, about half are reused and half are created especially for CG.
It's fairly typical data model for the kind of projects that Ontotext deals with.
</p>
<p>
Creating the ONTO CG knowledge graph is part of
the <a href="https://www.ontotext.com/cima/">Intelligent Matching and Linking of Company Data (CIMA)</a> research project.
We are integrating data from open and a few proprietary datasets. The emphasis of the project is on financial transactions, industrial classification, company size/importance observations (e.g. annual sales, number of employees), etc.
</p>
<p>
The following table shows the count of classes and properties defined by the ONTO-CG ontology, as well as those reused from other ontologies.
</p>
<table border="1" cellspacing="0" cellpadding="2" rules="all" frame="box">
<caption class="t-above"><span class="table-number">Table 1:</span> Ontology reuse and extension in Ontotext Company Graph.</caption>
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-right" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Prefix</th>
<th scope="col" class="org-left">Ontology</th>
<th scope="col" class="org-right">Classes</th>
<th scope="col" class="org-right">Props</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">cg</td>
<td class="org-left">Ontotext Company Graph</td>
<td class="org-right">12</td>
<td class="org-right">70</td>
</tr>
<tr>
<td class="org-left">adms</td>
<td class="org-left">Asset Description Metadata Schema</td>
<td class="org-right">1</td>
<td class="org-right">1</td>
</tr>
<tr>
<td class="org-left">dcat</td>
<td class="org-left">Data Catalog Vocabulary</td>
<td class="org-right"> </td>
<td class="org-right">3</td>
</tr>
<tr>
<td class="org-left">dct</td>
<td class="org-left">Dublin Core Terms</td>
<td class="org-right"> </td>
<td class="org-right">8</td>
</tr>
<tr>
<td class="org-left">ebg</td>
<td class="org-left">euBusinessGraph</td>
<td class="org-right">1</td>
<td class="org-right">12</td>
</tr>
<tr>
<td class="org-left">gn</td>
<td class="org-left">GeoNames</td>
<td class="org-right">1</td>
<td class="org-right">9</td>
</tr>
<tr>
<td class="org-left">locn</td>
<td class="org-left">W3C Location Ontology</td>
<td class="org-right">1</td>
<td class="org-right">8</td>
</tr>
<tr>
<td class="org-left">org</td>
<td class="org-left">W3C Core Organization Ontology</td>
<td class="org-right">1</td>
<td class="org-right">5</td>
</tr>
<tr>
<td class="org-left">qb</td>
<td class="org-left">W3C Cube Ontology</td>
<td class="org-right">1</td>
<td class="org-right">1</td>
</tr>
<tr>
<td class="org-left">rov</td>
<td class="org-left">W3C Registered Organization</td>
<td class="org-right">1</td>
<td class="org-right">4</td>
</tr>
<tr>
<td class="org-left">schema</td>
<td class="org-left">Schema.org</td>
<td class="org-right">3</td>
<td class="org-right">12</td>
</tr>
<tr>
<td class="org-left">skos</td>
<td class="org-left">Simple Knowledge Organization System</td>
<td class="org-right">1</td>
<td class="org-right">6</td>
</tr>
<tr>
<td class="org-left">time</td>
<td class="org-left">W3C Time Ontology</td>
<td class="org-right"> </td>
<td class="org-right">2</td>
</tr>
<tr>
<td class="org-left">void</td>
<td class="org-left">Vocabulary of Interlinked Datasets</td>
<td class="org-right">1</td>
<td class="org-right">7</td>
</tr>
<tr>
<td class="org-left">wgs84</td>
<td class="org-left">World Geodetic Survey</td>
<td class="org-right"> </td>
<td class="org-right">2</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="org-left"> </td>
<td class="org-left"> </td>
<td class="org-right">24</td>
<td class="org-right">150</td>
</tr>
</tbody>
</table>
<p>
ONTO CG builds upon the results of the euBusinessGraph project.
The euBusinessGraph semantic model and dataset covers the following
(we have submitted a description of it to a prominent journal on semantic technologies):
</p>
<ul class="org-ul">
<li>Basic firmography (legal names, preferred name)</li>
<li>Basic person info</li>
<li>Geography, address, hieararchical administrative divisions</li>
<li>Company legal type and status</li>
<li>Industry classification (based on NACE)</li>
<li>Identifiers from Official registers and others</li>
<li>Company officers and directors (positions, using <code>org:Membership</code>)</li>
<li>Datasets, providers, dataset descriptions</li>
</ul>
<p>
ONTO-CG steps on the euBusinessGraph model and adds the following:
</p>
<ul class="org-ul">
<li><code>IdentifierSystems</code>: We extend the euBusinessGraph idea of generalized identifiers to record any kind of potentially useful identification info in a generic way: phone, email, website, blog, logo/image; profile links and identifiers in various external systems such as: Wikidata, DBpedia, Facebook, LinkedIn, Twitter, Youtube, Reddit, Github, CrunchBase, OpenCorporates, Thomson Reuters permid (TR), ISO 10383 Market Identifier Code (MIC); research-oriented identifiers such as CrossRef funder, Microsoft Academic Graph, Global Research Identifier Database (GRID), Research Organization Registry (ROR), Virtual International Authority File (VIAF).</li>
<li><code>cg:StockExchange</code>: a Stock exchange where companies can offer shares or other securities. We record MIC and TR exchange codes as identifiers.</li>
<li><code>cg:Event</code> and <code>cg:EventAppearance</code>: Conference, workshop, meetup, etc where the work of a certain person or company may be highlighted.</li>
<li><code>gn:Feature</code>: While the euBusinessGraph geographic hierarchy is based on EuroStat NUTS and LAU, ONTO-CG uses Geonames locations to implement geographic matching, auto-completion and faceting. We are particularly interested in the 3 levels Country, Region, City that we have defined as particular lists of gn:featureCodes (e.g. Country corresponds to <code>gn:A.PCLI, gn:A.PCLD, gn:A.PCLIX, gn:A.PCLS, gn:A.PCL, gn:A.TERR, gn:A.PCLF</code>).</li>
<li><code>cg:AcademicQualification</code>: Academic degree (completed or not) of a person at a scholl in an academic major.</li>
<li><code>qb:Observation</code>: Statistical or other observation about an object (typically company), such as annual sales, number of employees, etc. May be for a particular year, point in time, or without date (current).</li>
<li><code>cg:Transaction</code>: Financial transaction that gives money to a company in return for shares or other consideration.</li>
<li><code>cg:OrganizationRelation</code>: Relation between two agents. For asymmetric relations we use two fields "agentMinor" (e.g. subsidiary, owned, supplier) and "agentMajor" (e.g. parent, owner, customer); for symmetric relations we use the field "agent" twice. Usually these are Organizations, but "owner" could involve Persons.</li>
<li>Sourcing (provenance) for each node:
<ul class="org-ul">
<li><code>void:Dataset</code>: Dataset as source of entities</li>
<li><code>void:Linkset</code>: Linkset as source of identifiers (links)</li>
<li><code>cg:SourceMatch</code>: Cluster of matched lower-level entities as the source of a higher-level entity.</li>
</ul></li>
</ul>
<p>
In addition to the above new classes, ONTO-CG adds:
</p>
<ul class="org-ul">
<li>A 2-level data model where data from individual datasets sits at a lower (KG-building) level, and after matching and data fusion is promoted at a higher (data consumption) level.</li>
<li>Various extra fields, e.g. <code>cg:geoPrecision</code> "Precision of geo coordinates in meters (e.g. street address or building -> 30.8)" to complement <code>ebg:geoResolution</code> "Resolution of geo coordinates as a categorial value (e.g. building -> <code><resolution/L9></code>)"</li>
<li>Various flags, e.g. for Organization (<code>cg:isResearch</code>), Position (<code>cg:isCurrent, cg:isPrimary</code>), AcademicQualification (<code>cg:isCompleted</code>), ExchangeListing, OrganizationRelation (<code>cg:isCurrent</code>)</li>
<li>Business nomenclatures (<code>skos:ConceptScheme</code>): <code>Organization Type, Legal Form, Organization Status, Industry, Investor Type, Geo Coordinate Resolution, Address Type, Observation Type, Gender, Event Type, Event Appearance Type, Position Type, Transaction Type, Relation Type</code></li>
</ul>
<p>
The full CG schema is included: <a href="./schemas/CG.yaml">CG.yaml</a>. Below we show a couple of typical examples.
</p>
</div>
<div id="outline-container-example-class" class="outline-3">
<h3 id="example-class">Example Class</h3>
<div class="outline-text-3" id="text-example-class">
<div class="org-src-container">
<pre class="src src-yaml"><span style="color: #a0522d;">ExchangeListing</span>:
<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"Exchange Listing"</span>
<span style="color: #a0522d;">inherits</span>: Transaction
<span style="color: #a0522d;">type</span>: [cg:ExchangeListing]
<span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"Public offering (IPO, SPO etc) wheres the company receives money from the wide public, and as a result is listed for trading on an exchange"</span>
<span style="color: #a0522d;">props</span>:
<span style="color: #a0522d;">exchange</span>:
<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"exchange"</span>
<span style="color: #a0522d;">range</span>: StockExchange
<span style="color: #a0522d;">min</span>: 1
<span style="color: #a0522d;">rdfProp</span>: cg:exchange
<span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"Stock exchange"</span>
<span style="color: #a0522d;">stockSymbol</span>:
<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"stock symbol"</span>
<span style="color: #a0522d;">range</span>: string
<span style="color: #a0522d;">rdfProp</span>: cg:stockSymbol
<span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"Stock symbol (ticker). </span><span style="color: #ff0000; font-weight: bold;">TODO</span><span style="color: #8b2252;">: this should also be represented as an Identifier?"</span>
<span style="color: #a0522d;">valuation</span>:
<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"valuation (MUSD)"</span>
<span style="color: #a0522d;">range</span>: decimal
<span style="color: #a0522d;">rdfProp</span>: cg:valuation
<span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"Company valuation at IPO in MUSD"</span>
<span style="color: #a0522d;">valuationLocal</span>:
<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"valuation (M local currency)"</span>
<span style="color: #a0522d;">range</span>: decimal
<span style="color: #a0522d;">rdfProp</span>: cg:valuationLocal
<span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"Company valuation at IPO in millions of local currency"</span>
<span style="color: #a0522d;">valuationCurrency</span>:
<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"valuation currency"</span>
<span style="color: #a0522d;">range</span>: string
<span style="color: #a0522d;">rdfProp</span>: cg:valuationCurrency
<span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"Currency code of the valuation"</span>
<span style="color: #a0522d;">dateEnd</span>:
<span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"Date delisted or left this exchange"</span>
<span style="color: #a0522d;">isCurrent</span>:
<span style="color: #a0522d;">rdfProp</span>: cg:isCurrent
<span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"Whether the listing is still effective"</span>
</pre>
</div>
<p>
If you look closely, you may wonder where the range and RDF mapping of <code>dateEnd</code> is defined.
It's in the list of reusable properties:
</p>
<div class="org-src-container">
<pre class="src src-yaml"><span style="color: #a0522d;">properties</span>: <span style="color: #b22222;"># </span><span style="color: #b22222;">reused props</span>
<span style="color: #a0522d;">dateEnd</span>: {<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"dateCompleted"</span>, <span style="color: #a0522d;">range</span>: dateOrYearOrMonth, <span style="color: #a0522d;">rdfProp</span>: cg:dateEnd}
</pre>
</div>
<p>
A more appropriate <code>descr</code> is given at the object level, overriding the generic description.
</p>
</div>
</div>
<div id="outline-container-example-inverse-alias" class="outline-3">
<h3 id="example-inverse-alias">Example Inverse Alias</h3>
<div class="outline-text-3" id="text-example-inverse-alias">
<p>
A Position is an associative node between Person and Organization that adds more data (not shown):
</p>
<div class="org-src-container">
<pre class="src src-yaml"><span style="color: #a0522d;">Position</span>:
<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"Position"</span>
<span style="color: #a0522d;">inherits</span>: BusinessObject
<span style="color: #a0522d;">type</span>: [org:Membership]
<span style="color: #a0522d;">descr</span>: <span style="color: #8b2252;">"Position of a person in an organization, former or current"</span>
<span style="color: #a0522d;">props</span>:
<span style="color: #a0522d;">person</span>: {<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"person"</span>, <span style="color: #a0522d;">range</span>: PersonCommon, <span style="color: #a0522d;">min</span>: 1, <span style="color: #a0522d;">rdfProp</span>: org:member}
<span style="color: #a0522d;">organization</span>: {<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"organization"</span>, <span style="color: #a0522d;">range</span>: OrganizationCommon, <span style="color: #a0522d;">min</span>: 1, <span style="color: #a0522d;">rdfProp</span>: org:organization}
</pre>
</div>
<p>
To allow navigation in any direction (not just from Position out, but also in), we add inverse aliases:
</p>
<div class="org-src-container">
<pre class="src src-yaml"><span style="color: #a0522d;">PersonCommon</span>:
<span style="color: #a0522d;">props</span>:
<span style="color: #a0522d;">position</span>: {<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"position"</span>, <span style="color: #a0522d;">range</span>: Position, <span style="color: #a0522d;">inverseAlias</span>: person}
<span style="color: #a0522d;">OrganizationCommon</span>:
<span style="color: #a0522d;">props</span>:
<span style="color: #a0522d;">position</span>: {<span style="color: #a0522d;">label</span>: <span style="color: #8b2252;">"position"</span>, <span style="color: #a0522d;">range</span>: Position, <span style="color: #a0522d;">inverseAlias</span>: organization}
</pre>
</div>
</div>
</div>
<div id="outline-container-example-diagram-exchange-listing-soml" class="outline-3">
<h3 id="example-diagram-exchange-listing-soml">Example Diagram: Exchange Listing SOML</h3>
<div class="outline-text-3" id="text-example-diagram-exchange-listing-soml">
<p>
For example, the figure below shows the stock exchange listing (IPO) of Apple on the Tokyo exchange and NASDAQ, and the listing of Nasdaq Inc (the company) on NASDAQ (the stock exchange).
</p>
<ul class="org-ul">
<li>The data is integrated from Wikidata.</li>
<li>This figure is generated from RDF Turtle using <a href="https://github.com/VladimirAlexiev/rdf2rml">rdfpuml</a> (see V.Alexiev, <a href="http://rawgit2.com/VladimirAlexiev/my/master/pres/20161128-rdfpuml-rdf2rml/index.html">RDF by Example: rdfpuml for True RDF Diagrams, rdf2rml for R2RML Generation</a>, Semantic Web in Libraries (SWIB), Nov 2016.</li>
<li>This version of the diagram uses original SOML (GraphQL) property and class names, i.e. all of them share the same namespace (expressed using the empty) prefix.</li>
<li>It can be considered as a "logical" data model of how data should be queried with GraphQL</li>
</ul>
<p>
<a href="./eg/model-exchange-listing.ttl">./eg/model-exchange-listing.ttl</a>
</p>
<div id="orgc7fc250" class="figure">
<p><img src="./eg/model-exchange-listing.png" alt="model-exchange-listing.png" />
</p>
</div>
</div>
</div>
<div id="outline-container-example-diagram-exchange-listing-rdf" class="outline-3">
<h3 id="example-diagram-exchange-listing-rdf">Example Diagram: Exchange Listing RDF</h3>
<div class="outline-text-3" id="text-example-diagram-exchange-listing-rdf">
<p>
This version of the diagram uses <a href="#soml-map">soml-map</a> to map SOML names to RDF names in specific namespaces.
</p>
<ul class="org-ul">
<li>So this can be considered the "physical" data model of data as it's stored in the semantic database</li>
</ul>
<p>
<a href="./eg/model-exchange-listing-mapped.ttl">./eg/model-exchange-listing-mapped.ttl</a>
</p>
<div id="orgdc71676" class="figure">
<p><img src="./eg/model-exchange-listing-mapped.png" alt="model-exchange-listing-mapped.png" />
</p>
</div>
</div>
</div>
</div>
<div id="outline-container-soml-tooling" class="outline-2">
<h2 id="soml-tooling">SOML Tooling</h2>
<div class="outline-text-2" id="text-soml-tooling">
</div>
<div id="outline-container-owl2soml" class="outline-3">
<h3 id="owl2soml">owl2soml</h3>
<div class="outline-text-3" id="text-owl2soml">
<p>
This tool (written in Perl) generates SOML schemas from ontologies (that use RDFS, OWL and/or schema.org constructs).
It handles numerous features and has been integrated in the Ontotext Platform (reimplemented in Java).
See its own README.
</p>
</div>
</div>
<div id="outline-container-tsv2soml" class="outline-3">
<h3 id="tsv2soml">tsv2soml</h3>
<div class="outline-text-3" id="text-tsv2soml">
<p>
Editing large schemas is often easier to do in a table, even when the schema language is simple.
(Also, this enables domain experts to participate in schema authoring, even if only editing the descriptions.)
</p>
<p>
The CG model was not written by hand, it was generated from a TSV (google sheet).
</p>
<p>
The sheet has 300 rows, and the generated SOML is 1176 lines.
Here's the beginning of the sheet:
</p>
<div id="orgc2b8524" class="figure">
<p><img src="./eg/CG-sheet.png" alt="CG-sheet.png" />
</p>
</div>
<p>
Here is the end of the sheet, which exposes various thesauri (<code>ConceptSchemes</code>)
as distinct business classes
</p>
<div id="org5fae081" class="figure">
<p><img src="./eg/CG-sheet2.png" alt="CG-sheet2.png" />
</p>
</div>
<p>
To generate a SOML schema from the google sheet <a href="https://docs.google.com/spreadsheets/d/1_-bn9Y-9rtysnvKiVus6BkFKXqHhiV4vCjYeiRmb6XU/edit#gid=0">CG-data-model</a>, call it like this:
</p>
<pre class="example">
curl -s "https://docs.google.com/spreadsheets/d/1_-bn9Y-9rtysnvKiVus6BkFKXqHhiV4vCjYeiRmb6XU/export?format=tsv" | perl tsv2soml.pl | cat CG-preamble.yaml - > CG.yaml
</pre>
<p>
Here <a href="./schemas/CG-preamble.yaml">CG-preamble.yaml</a> is some fixed SOML metadata (a header).
</p>
<p>
Options:
</p>
<ul class="org-ul">
<li><code>-p</code>: don't emit <code>pattern</code> (this feature restricts URLs to a certain pattern)</li>
<li><code>-l</code>: downgrade Literals: <code>stringOrLangString, langString</code> -> <code>string</code>, <code>dateOrYearOrMonth</code> -> <code>date</code>.
This can be used to simplify the schema not to use <code>langString</code> and union datatypes</li>
</ul>
<p>
Comment lines start with hash (<code>#</code>) in the first column
</p>
<ul class="org-ul">
<li><code># HEADER</code>: if there is a space after the hash, the first cell is printed surrounded by newlines</li>
<li><code>#commented out</code>: if there is no space, the whole line is skipped</li>
</ul>
</div>
<div id="outline-container-reusing-property-characteristics" class="outline-4">
<h4 id="reusing-property-characteristics">Reusing Property Characteristics</h4>
<div class="outline-text-4" id="text-reusing-property-characteristics">
<ul class="org-ul">
<li>The script counts how many times each prop is used in objects</li>
<li>For props used more than once, the script emits the <b>first occurrence</b> of each prop
in the common <code>properties</code> section:</li>
</ul>
<div class="org-src-container">
<pre class="src src-yaml"><span style="color: #a0522d;">properties</span>: <span style="color: #b22222;"># </span><span style="color: #b22222;">reused props</span>
</pre>
</div>
<ul class="org-ul">
<li>This allows you to omit common details (eg <code>label, descr, range</code>) on subsequent occurrences</li>
<li>But it also means that characteristics given in the first occurrence override the defaults
for subsequent occurrences, which may lead to unintended consequences.</li>
</ul>
<p>
Consider a SOML based on schema.org where we allow multiple <code>sameAs</code> values
(e.g. the item's Wikipedia page, Wikidata entry, Linkedin profile, YouTube profile, etc),
and want the field to be mandatory for <code>Organization</code> but optional for <code>Person</code>.
</p>
<p>
We write the details on the first occurrence and then just mention the prop on the second occurrence:
</p>
<table border="1" cellspacing="0" cellpadding="2" rules="all" frame="box">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Class/prop</th>
<th scope="col" class="org-left">label</th>
<th scope="col" class="org-left">Inherits/range</th>
<th scope="col" class="org-left">char</th>
<th scope="col" class="org-left">descr</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Organization</td>
<td class="org-left"> </td>
<td class="org-left"> </td>
<td class="org-left"> </td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left">sameAs</td>
<td class="org-left">same as</td>
<td class="org-left">iri</td>
<td class="org-left">min: 1, max: inf</td>
<td class="org-left">URL that unambiguously indicates the thing's identity</td>
</tr>
<tr>
<td class="org-left">Person</td>
<td class="org-left"> </td>
<td class="org-left"> </td>
<td class="org-left"> </td>
<td class="org-left"> </td>
</tr>
<tr>
<td class="org-left">sameAs</td>
<td class="org-left"> </td>
<td class="org-left"> </td>
<td class="org-left"> </td>
<td class="org-left"> </td>
</tr>
</tbody>
</table>
<p>
This results in a SOML like this:
</p>
<div class="org-src-container">
<pre class="src src-yaml"><span style="color: #a0522d;">objects</span>:
<span style="color: #a0522d;">Organization</span>:
<span style="color: #a0522d;">props</span>:
<span style="color: #a0522d;">sameAs</span>:
<span style="color: #a0522d;">range</span>: iri
<span style="color: #a0522d;">min</span>: 1
<span style="color: #a0522d;">max</span>: inf
<span style="color: #a0522d;">descr</span>: URL that unambiguously indicates the thing's identity
<span style="color: #a0522d;">Person</span>:
<span style="color: #a0522d;">props</span>:
<span style="color: #a0522d;">sameAs</span>:
<span style="color: #a0522d;">properties</span>: <span style="color: #b22222;"># </span><span style="color: #b22222;">reused props</span>
<span style="color: #a0522d;">sameAs</span>:
<span style="color: #a0522d;">range</span>: iri
<span style="color: #a0522d;">min</span>: 1
<span style="color: #a0522d;">max</span>: inf
<span style="color: #a0522d;">descr</span>: URL that unambiguously indicates the thing's identity
</pre>
</div>