| # X3D Ontology for Semantic Web |

The X3D Ontology for Semantic Web provides terms of reference for semantic query of X3D graphics models, including interactive 3D geometry, multimedia, and metadata.

> Motivation | Download | Design and Design Patterns | OWLDoc | Queries | References | Tools | TODO | Contact

### 🔖 Motivation

Extensible 3D (X3D) Graphics is the royalty-free open standard for publishing, viewing, printing and archiving interactive 3D models on the Web.

The X3D Semantic Web Working Group mission is to publish models to the Web using X3D in order to best gain Web interoperability and enable intelligent 3D applications, feature-based 3D model querying, and reasoning over 3D scenes.

Motivating insights:

> "The answer to your question is the response to the query." Jim Hendler and Dean Allemang

> "Trying to use the Semantic Web without SPARQL is like trying to use a relational database without SQL." Tim Berners-Lee

> "The proof of the pudding is in the eating." Wiktionary

To learn more about publishing 3D graphics on the Web, please see What is X3D? and X3D Version 4 Overview.

### 🔖 Download

#### Information

- X3D Ontology for Querying 3D Models on the Semantic Web, Don Brutzman and Jakub Flotyński, Web3D 2020 Conference, Seoul Korea, 9-13 November 2020, with accompanying presentation.
- X3D Ontology for Semantic Web is an overview presentation that describes this project.
- Part 1, Web3D Overview: Semantic Web3D: Towards comprehensive representation of 3D content on the Semantic Web presented by Christophe Mouton, with co-authors Don Brutzman, John Carlson, Jakub Flotyński, Felix Hamza-Lup , Athanasios Malamos, Christophe Mouton, Marc Petit, Nicholas Polys, Leslie Sikos, and Krzysztof Walczak, was presented at Semantic Web Pro (SemWeb.Pro) in Paris France, 3 December 2019. Also available: Web3D event announcement.
- Part 2, Query Examples: Semantic Web3D: Towards Comprehensive Representation of 3D Content on the Semantic Web (paper) by Jakub Flotyński, Don Brutzman, Felix G. Hamza-Lup, Athanasios Malamos, Nicholas Polys, Leslie F. Sikos, and Krzysztof Walczak was presented at International Conference on 3D Immersion (IC3D) in Brussels Belgium, 11 December 2019. Also available: Web3D event announcement.
- The documentation directory holds a variety of useful working-group products.

#### Resources

- X3D Ontology X3dOntology4.0.ttl is our primary product from X3DUOM.
- Also producing matching versions in RDF and OWL X3dOntology4.0.rdf and X3dOntology4.0.owl using Protege export.
- Official URI namespace:
  `PREFIX x3do: <https://www.web3d.org/specifications/X3dOntology4.0#>`
- X3D Ontology OWLDoc documentation is generated via Protégé.
- X3dToTurtle.xslt conversion stylesheet translates an `.x3d` model from XML into `.ttl` triples.
- Build process: build.xml uses Apache Ant with associated output logs: build.all.log.txt and build.SPARQL.query.tests.log.txt
- An early-draft X3D Ontology by Leslie Sikos t3dmo.ttl (README) includes example constructs for other 3D model formats.
- X3dSemanticWebDevelopmentArchive.zip collects all current assets for easier download and use.

#### Version Control

All work is maintained using subversion at Sourceforge version control under a non-viral Web3D Consortium open-source license (text).

### 🔖 Design

The current X3D Ontology is reasonably stable as we work to make X3D models queriable in interesting ways. These representations fully match the functionality of X3D4.

TODO. More work remains for the X3D Ontology. Expected progression, with adjacent steps typically in tandem:

1. Continued review of `.ttl` representations generated from X3DUOM.
2. Establishing satisfactory URI matching website URL, e.g. `https://www.web3D.org/semantics` (website request pending).
3. Building an extensive set of SPARQL queries.
4. Autogenerate and publish RDF-A for all X3D examples, following patterns in Leslie Sikos' book.
5. Defining use cases for queries and demonstrating examples.
6. Define similar/corresponding triple constructs for different 3D formats, building upon Leslie's 3dmo.ttl exemplars.
7. Investigate existing vocabularies and tools for visual 3D shape search including potential analysis and annotation of models.
8. Use Apache Daffodil (DFDL) to actually parse and subsequently query those other formats coherently.

### 🔖 Design Patterns

1. Triple names. Each triple must be uniquely named. Please note that these names are ID labels that can be matched and reported, but the text used for each name cannot be reasoned against.
   - `DEF` names, if available, are prefixed by a colon. Example: `:MySpecialMaterial`.
   - `USE` names, if available, are adapted by prefixing with a colon and appending `-USE-` and the number of current occurrence. Example: `:MySpecialMaterial-USE-4`.
   - `X3D`, `head` and `Scene` are always singletons and so are eponymous and always get the same name, e.g. `:X3D`, `:head` and `:Scene`.
   - Unnamed X3D nodes and statements are identified with the following pattern: node name, followed by tree hierarchy below the root `X3D` node. Example labels: `:meta_1_5` had 1 for `head` and 5 for fifth child; `:Shape_2_3_2_1` has initial 2 for `Scene` followed by third/second/first children nodes, and so on.
2. `FontStyle` and `ScreenFontStyle` nodes each have a `style` field. This has been renamed as `styleSelection` to avoid query collisions when contained in a Web page.
3. More to follow.

### 🔖 Queries

X3D Semantic Web Working Group efforts include defining use cases for queries and demonstrating examples, which will like follow three general patterns:

- Geometric properties of an X3D model, some of which are addable (e.g. bbox values for dimension).
- Document meta information.
- Typed Metadata* values in an X3D model, often for a given vocabulary.
- Consider constructs used in 3D model search to determine applicability and possible addition.

build.all.log.txt and build.SPARQL.query.tests.log.txt each provide a full set of queries and responses. These build logs help practitioners compare results and track progress (or setbacks).

🔖 | Graph (triple store) | SPARQL Query | SPARQL Response | Description
--- | --- | --- | --- | ---
🔖 | X3dOntology4.0.ttl (X3dOntology4.0.rdf) | X3dOntologyQuery_01.rq | X3dOntologyQuery_01.rq.txt | Metaquery (against X3D Ontology itself) to list all properties with corresponding domains and ranges.
X3dOntologyQuery_02.rq | X3dOntologyQuery_02.rq.txt | Metaquery (against X3D Ontology itself) to list nodes and statements (concrete owl:Class) with inherited node types and object types.
X3dOntologyQuery_03.rq | X3dOntologyQuery_03.rq.txt | Metaquery (against X3D Ontology itself) to list all geometry nodes.
X3dOntologyQuery_04.rq | X3dOntologyQuery_04.rq.txt | Metaquery (against X3D Ontology itself) to list all X3D default simple-type field values (ontology annotationProperties).
X3dOntologyQuery_05.rq | X3dOntologyQuery_05.rq.txt | Metaquery (against X3D Ontology itself) to list all X3D literals (enumeration constants).
🔖 | HelloWorld.ttl from HelloWorld.x3d HelloWorld.html | X3dHelloWorldQuery_01.rq | X3dHelloWorldQuery_01.rq.txt | Query HelloWorld.ttl to count number of Shape nodes, with expected result = 2 nodes.
X3dHelloWorldQuery_02.rq | X3dHelloWorldQuery_02.rq.txt | Query HelloWorld.ttl to show url values within an ImageTexture node.
X3dHelloWorldQuery_03.rq | X3dHelloWorldQuery_03.rq.txt | Query HelloWorld.ttl to show title given to model within a WorldInfo node.
X3dHelloWorldQuery_04.rq | X3dHelloWorldQuery_04.rq.txt | Query HelloWorld.ttl to show contained geometry, appearance, material and texture field SFNode values within each Shape node.
X3dHelloWorldQuery_05.rq | X3dHelloWorldQuery_05.rq.txt | Query HelloWorld.ttl to show all nodes in 'children' field contained within any Group node.
🔖 | Altar.ttl from Altar.x3d Altar.html | X3dSanCarlosCathedralAltarQuery_01.rq | X3dSanCarlosCathedralAltarQuery_01.rq.txt | Query SanCarlosCathedral Altar.ttl to show the number of shapes composing the altar.
X3dSanCarlosCathedralAltarQuery_02.rq | X3dSanCarlosCathedralAltarQuery_02.rq.txt | Query SanCarlosCathedral Altar.ttl to show url addresses of all textures used within the scene.
X3dSanCarlosCathedralAltarQuery_03.rq | X3dSanCarlosCathedralAltarQuery_03.rq.txt | Query SanCarlosCathedral Altar.ttl to determine Background skyColor values.
🔖 | HelloX3dAuthorsAnimationChain.ttl from HelloX3dAuthorsAnimationChain.x3d HelloX3dAuthorsAnimationChain.html | HelloX3dAuthorsAnimationChainQuery_01.rq | HelloX3dAuthorsAnimationChainQuery_01.rq.txt | Query HelloX3dAuthorsAnimationChain.ttl to determine ROUTE parameters of interest.
AllDocumentMetaInformation.rq | AllDocumentMetaInformation.rq.txt | Query HelloX3dAuthorsAnimationChain.ttl to identify all document meta information.
DocumentMetaProperties.rq | DocumentMetaProperties.rq.txt | Query HelloX3dAuthorsAnimationChain.ttl to identify specific document meta properties of interest.
🔖 | MetadataNodeExamplesX3D4.ttl from MetadataNodeExamplesX3D4.x3d MetadataNodeExamplesX3D4.html | DocumentMetadataValues.rq | DocumentMetadataValues.rq.txt | Query MetadataNodeExamplesX3D4.ttl to list all values found in Metadata nodes.
🔖 | MaterialModulator.ttl from MaterialModulator.x3d MaterialModulator.html | X3dMaterialModulatorQuery_03.rq | X3dMaterialModulatorQuery_03.rq.txt | Query MaterialModulator.ttl to show title given to model within a WorldInfo node. .

🔖 |  | Several thousand XML-based `.x3d` models in the X3D Example Archives have been converted into `.ttl` Turtle triples, using the X3dToTurtle.xslt conversion stylesheet. Both `.ttl` and SPARQL query results are available for each model, as illustrated in the screenshot for the HelloWorld example catalog entry. Comprehensive conversion and test-query results for all models in X3D Resources, Examples: Scene Archives for X3D are listed in build.turtle.all.log.txt. This is a comprehensive set of unit tests for X3D ontology, xslt model conversion into `.ttl`, and SPARQL query.

### 🔖 References: Books, Papers and Workshops, Specifications

### Books

1. Dean Allemang, James Hendler and Fabien Gandon, Semantic Web for the Working Ontologist: Effective Modeling for Linked Data, RDFS and OWL, third edition, ACM Books, 2020.
2. Jakub Flotyński, Knowledge-Based Explorable Extended Reality Environments, Springer, 2020.
3. Don Brutzman and Leonard Daly, X3D for Web Authors Morgan Kaufmann Publishers, Elsevier, April 2007.
4. Bob DuCharme, Learning SPARQL, second edition, OReilly Media, Sebastopol, 2013.
   - Bob DuCharme's weblog, 21 April 2014, RDF lists and SPARQL
5. Leslie F. Sikos, Mastering Structured Data on the Semantic Web: from HTML5 Microdata to Linked Open Data, Apress Springer Science+Business Media, New York, 2015.
6. SPARQL on Wikibooks covers both the language and a powerful Web-based GUI, the Wikidata Query Service SPARQL endpoint.
7. William Kent and Steve Hoberman, Data and Reality, Technics Publications, third edition, 2012. "A timeless perspective on perceiving and managing information in our imprecise world." (excerpts) (goodreads) (Owen Ambur)
8. Jose E. Labra Gayo, Eric Prud’hommeaux, Iovka Boneva, and Dimitris Kontokostas, Validating RDF Data, Synthesis Lectures on the Semantic Web: Theory and Technology, Vol. 7, No. 1, DOI: 10.2200/S00786ED1V01Y201707WBE016, Morgan & Claypool, 2018.

### Papers and Workshops

1. Pascal Hitzler, "A review of the semantic web field," Communications of the ACM, Vol. 64, No. 2, January 2021. "Tracing the triumphs and challenges of two decades of Semantic Web research and applications." Includes video overview.
2. Metadata and Semantics for Web3D Workshop (tex.zip) at Web3D 2019
3. Preservation, Access, and Reuse: Advancing 3D and VR Strategy in the Research Library (pptx) by Jamie Wittenberg, Indiana University at Web3D 2019
4. X3D Ontology for Semantic Web was presented as a "Lightning Talk" at US Semantic Technologies Symposium (US2TS). Raleigh North Carolina, 9-11 March 2020.
5. R.C. Jackson, J.P. Balhoff, E. Douglass, N.L. Harris, C.J. Mungall, and J.A. Overton, ROBOT: A tool for automating ontology workflows. BMC Bioinformatics, vol. 20, July 2019.

### Specifications

1. X3D Specifications: Schema and DOCTYPE Validation provides assets commonly used for XML validation of X3D scenes.
2. X3D Recommended Standards provide a coordinated set of steadily evolving ISO standards which are Royalty Free (RF) and publicly available for any use.
3. OWL 2 Web Ontology Language, Document Overview (Second Edition), W3C Recommendation, 11 December 2012.

   > The OWL 2 Web Ontology Language, informally OWL 2, is an ontology language for the Semantic Web with formally defined meaning. OWL 2 ontologies provide classes, properties, individuals, and data values and are stored as Semantic Web documents. OWL 2 ontologies can be used along with information written in RDF, and OWL 2 ontologies themselves are primarily exchanged as RDF documents. This document serves as an introduction to OWL 2 and the various other OWL 2 documents. It describes the syntaxes for OWL 2, the different kinds of semantics, the available profiles (sub-languages), and the relationship between OWL 1 and OWL 2.

4. RDF 1.1 Semantics, W3C Recommendation, 25 February 2014.

   > This document describes a precise semantics for the Resource Description Framework 1.1 [RDF11-CONCEPTS] and RDF Schema [RDF11-SCHEMA]. It defines a number of distinct entailment regimes and corresponding patterns of entailment. It is part of a suite of documents which comprise the full specification of RDF 1.1.

5. SPARQL 1.1 Query Language, W3C Recommendation, 21 March 2013.

   > RDF is a directed, labeled graph data format for representing information in the Web. This specification defines the syntax and semantics of the SPARQL query language for RDF. SPARQL can be used to express queries across diverse data sources, whether the data is stored natively as RDF or viewed as RDF via middleware. SPARQL contains capabilities for querying required and optional graph patterns along with their conjunctions and disjunctions. SPARQL also supports aggregation, subqueries, negation, creating values by expressions, extensible value testing, and constraining queries by source RDF graph. The results of SPARQL queries can be result sets or RDF graphs.

6. RDF 1.1 Turtle: Terse RDF Triple Language, W3C Recommendation, 25 February 2014.

   > The Resource Description Framework (RDF) is a general-purpose language for representing information in the Web. This document defines a textual syntax for RDF called Turtle that allows an RDF graph to be completely written in a compact and natural text form, with abbreviations for common usage patterns and datatypes. Turtle provides levels of compatibility with the N-Triples format as well as the triple pattern syntax of the SPARQL W3C Recommendation.

7. Time Ontology in OWL, W3C Candidate Recommendation, 25 March 2020.

   > OWL-Time is an OWL-2 DL ontology of temporal concepts, for describing the temporal properties of resources in the world or described in Web pages. The ontology provides a vocabulary for expressing facts about topological (ordering) relations among instants and intervals, together with information about durations, and about temporal position including date-time information. Time positions and durations may be expressed using either the conventional (Gregorian) calendar and clock, or using another temporal reference system such as Unix-time, geologic time, or different calendars.

### 🔖 Tools

Many tools are available for Semantic Web development. Here are the primary ones used for this work.

- Apache Jena is a free and open source Java framework for building Semantic Web and Linked Data applications.
  - After installation, set `JENA_HOME=C:\languages\java\apache-jena-4.2.0` (or somesuch location) to run build tasks and ARQ queries properly.
  - ARQ SPARQL Processor for Jena, a query engine that supports the SPARQL RDF Query language.
- Protégé is a free, open-source ontology editor and framework for building intelligent systems.
- Manchester Owl Validator (use Profile OWL 2, Report syntax: Manchester Owl Syntax). Provided by Owl@Manchester. Reference: W3C listing: Owl Validator.
- Visual Data Web supports a VOWL copy of OWL Validator
- ROBOT is an OBO Tool for automating ontology workflows. (paper) (tutorial, commands)

### 🔖 Contact

> Questions, suggestions, additions and comments about this X3D Ontology for Semantic Web page are welcome. Please send them to Don Brutzman and Jakub Flotyński (email brutzman at nps.edu and flotynski at kti.ue.poznan.pl).

> Master version of this X3D Ontology for Semantic Web page is available online at
> https://www.web3d.org/x3d/content/semantics/semantics.html and available in Sourceforge version control.

> Updated: 29 January 2023