Modelling Knowledge using Semantic Technologies¶
Semantic Technologies¶
Knowledge can be described ad hoc or in a structural manner. Semantic Technologies facilitate the description of structured knowledge, consistency checking and reasoning.
Some of this technologies which are also W3C standars are:
For data: RDF (Resource Description Framework)
For knowledge: OWL (Web Ontology Language)
For queries: SPARQL (an RDF query language)
RDF (Resource Description Framework)¶
In the semantic technology context (and in particular in RDF), data is expressed by triples (facts), which consists of a subject, a predicate and an object.
Example:
Alice (id 111) is a Person. She has a child named Bob (id 222) who is also a Person. Bob has a child named Charlie (id 333) who is also a Person.
Here we see multiple facts, each of which is a triple. The subject is the entity that is being described (Alice id 111), the predicate is the property of the subject (having a child), and the object is the value of the property (Bob id 111).
OWL (Web Ontology Language)¶
It’s a knowledge representation language used to build ontologies.
Ontologies are logics for knowledge representation
The following is a simple example of an ontology in OWL. Since it express knowledge in a formal way it can be represented also in logical form.
hasChild
some (hasChild
some Person
) subClassOf GrandParent
Ontologies represent knowledge that is incremented over time
SPARQL (SPARQL Protocol and RDF Query Language)¶
SPARQL is a query language for databases stored in RDF format.
SELECT ?x WHERE { ?x a :Person }
SELECT ?x ?y WHERE { ?x a :Person. ?x :hasChild ?y }
SELECT ?x WHERE { ?x a :GrandParent }
Asset modelling¶
Asset model in the engineering domain
An asset model is an organized, digital description of the composition and properties of an asset.
In the engineering domain it is common practice to build asset models to support, e.g., maintenance, operations, design etc…
There are currently several industry initiatives that endorse the use of ontologies for asset modelling, e.g., in the Industry 4.0
Asset models & digital twins
Assets models are any object of interest in a digital twin. They provide the twin with knowledge about the static structure that can be used for the twin’s simulation model
The next example is the modelling of an house by exploiting semantic technologies illustrated before. We can create a representation of the house (in all his parts) by the means of RDF triples. In this way there is a formal representation of it that can be interpreted/understood by a computer in order to obtain meaningful information from it.
House Asset Use Case¶
The architecture of the house expressed here:
Is expressed in RDF format (Turtle syntax) as follows:
Example of SPARQL in SMOL¶
The following is an example of the usage of SPARQL in SMOL code.
It selects the ids of all the rooms represented in the house asset model and print them out.
main
List<Int> results = access(
"SELECT ?obj {
?a a asset:Room.
?a asset:id ?obj
}";
)
while results != null do
Int current = results.content;
results = results.next;
println(current);
end
end