# A Graph DB-Based Solution for Semantic Technologies in the Future Internet
## 4 Connection between the LPG and SW
### OWL/RDF Mapping  
Since the SW setting requires every element in the KB to be uniquely identified by a URL, we defined the prefix [[http://graphbrain.it/_ontologyName_](http://graphbrain.it/_ontologyName_)]([http://graphbrain.it/_ontologyName_](http://graphbrain.it/_ontologyName_)) (for which the abbreviation used in this paper is _gb_) and obtained the URI of a resource as the concatenation of such a prefix with its element identifier in GraphBRAIN. Then, we defined a set of translation rules to map GBSs onto OWL ontologies based on the strategy reported in the following paragraphs. (1) Entities, Entity Attributes, and Relationships  
The entities, attributes, and relationships in a GBS are mapped onto classes, data properties, and object properties (respectively) in an OWL ontology using the obvious corresponding OWL elements _owl:class_, _owl:objectProperty_ and _owl:dataTypeProperty_. Some examples extracted from a concrete-generated OWL ontology are reported in Listing 1. ```
1<!--OWLClasses-->
2<owl:Classrdf:about=\"gb:Place\">
3<owl:disjointWithrdf:resource=\"gb:ProcessComponent\"/>
4
5</owl:Class>
6
7<owl:Classrdf:about=\"gb:Administrative\">
8<crdfs:subClassOfrdf:resource=\"gb:Place\"/>
9...
10</owl:Class>
11
12<!--OWLObjectproperties-->
13<owl:ObjectPropertyrdf:about=\"gb:pertainsTo\">
14<owl:intervaledrdf:resource=\"gb:pertainedBy\"/>
15<rdfs:domainrdf:resource=\"gb:Word\"/>
16<rdfs:range:fresource=\"gb:Word\"/>
17</owl:ObjectProperty>
18
19<!--OWLDatatypeproperties-->
20<owl:DatatypePropertyrdf:about=\"gb:codeISO_Administrative\">
21<rdfs:domainrdf:resource=\"gb:Administrative\"/>
22<rdfs:rangerdf:resource=\"xad:string\"/
23</owl:DatatypeProperty>
```  
**Listing 1**. Example of GraphBRAIN-generated export in OWL. Other components or features of GBSs are not available in OWL. Specifically, relationship mapping deserves some explanation as it may generate inconsistencies in the ontology if not performed correctly. (2) Relationships with multiple domain-range pairs  
As previously mentioned, relationships are translated as object properties. While each object property must have a single domain and range, GBS allows several Subject-Object pairs for each relationship. To handle this, for each Subject-Object pair available for a relationship'rel', we introduce a different _owl:objectProperty_'rel_subject_object', assigning its subject as its _owl:domain_ and object as its _owl:range_. We then state that all of these newly added object properties are specializations of the _owl:objectProperty_'rel', with the domain given by the union of the OWL classes identified by the subjects and the range given by the union of the OWL classes identified by the objects, e.g., suppose the GBS relationship'rel' can be established between Subject-Object pairs (ClassA,ClassB) and (ClassC,ClassD), it translates to  
ObjectProperty: rel Domain: ClassA or ClassC Range: ClassB orClassD ObjectProperty: rel_ClassA_ClassB Domain: ClassA Range: ClassB ObjectProperty: rel_ClassC_ClassD Domain: ClassC Range: ClassD where _rel_ClassA_ClassB_ and _rel_ClassC_ClassD_ are specializations of'rel'. You can see an example of this strategy in Figure 2. Note that'rel' alone in OWL would allow the establishment of the relationship between an individual of ClassA and one of ClassD in the KB, which would be not allowed by the original GBS relationship. By adding the other two relationships, the OWL KG becomes inconsistent. (3) Relationship attributes  
For relationship attributes, we use an implicit reification: we introduce a class for each relationship in the schema and the **Relationship** class, which generalizes all of them. This allows us to represent the attributes of relationships as datatype properties of these newly reified classes. This is compliant with the official W3C guidelines [52] by applying the pattern relating to Use Case 1, where the requirement is to represent an additional  
Figure 2: Protège view of the classifiedAs object property and its specializations. attribute describing an instance of a relation.