# Interactive 3D Exploration of RDF Graphs through Semantic Planes
## 2 Tarsier: Splitting Data among Semantic Planes
### Data Extractor  
Data extracted from the triple store is classified through a set of SPARQL queries. First, classes (and details, if present) are retrieved with the SPARQL query proposed in Listing 1.  
```
PREFIXrdf:<[[http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#)]([http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#))> PREFIXrdfs:<[[http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#)]([http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#))> PREFIXowl:<[[http://www.w3.org/2002/07/owl#](http://www.w3.org/2002/07/owl#)]([http://www.w3.org/2002/07/owl#](http://www.w3.org/2002/07/owl#))> SELECTDISTINCT?class?label?comment WHERE{ {?resourcerdf:type?class. OPTIONAL{?classrdf:label?label}. OPTIONAL{?classrdf:comment?comment} } UNION{?classrdf:typeowl:Class. OPTIONAL{?classrdf:label?label}. OPTIONAL{?classrdf:comment?comment} } UNION{?classrdf:typerdfs:Class. OPTIONAL{?classrdf:label?label}. OPTIONAL{?classrdf:comment?comment} } }
```  
The data extractor also retrieves a list of Datatype properties and Object properties, respectively, with the SPARQL queries of Listings 2 and 3.  
Figure 4: Filtering helps to gradually build the desired visualization of data: an example knowledge base (**a**); the result of filtering (**b**); and one of the UI boxes through which filtering can be applied (**c**).  
```
Listing 2: Datatype Properties.
``` PREFIXrdf:<[[http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#)]([http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#))> PREFIXrdfs:<[[http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#)]([http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#))> PREFIXowl:<[[http://www.w3.org/2002/07/owl#](http://www.w3.org/2002/07/owl#)]([http://www.w3.org/2002/07/owl#](http://www.w3.org/2002/07/owl#))> PREFIXowl:<[[http://www.w3.org/2002/07/owl#](http://www.w3.org/2002/07/owl#)]([http://www.w3.org/2002/07/owl#](http://www.w3.org/2002/07/owl#))> SELECTDISTINCT?prop?domain?range?label?comment WHERE{ {?prop rdf:typeowl:DatatypeProperty. OPTIONAL{?prop rdfs:range?range}. OPTIONAL{?prop rdfs:domain?domain}. OPTIONAL{?prop rdfs:label?label}. OPTIONAL{?prop rdfs:comment?comment} } } UNION{?s?prop?o. FILTERisLiteral(?o) } } ```
Listing 3: Object Properties.
``` PREFIXrdf:<[[http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#)]([http://www.w3.org/1999/02/22-rdf-syntax-ns#](http://www.w3.org/1999/02/22-rdf-syntax-ns#))> PREFIXrdfs:<[[http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#)]([http://www.w3.org/2000/01/rdf-schema#](http://www.w3.org/2000/01/rdf-schema#))> PREFIXowl:<[[http://www.w3.org/2002/07/owl#](http://www.w3.org/2002/07/owl#)]([http://www.w3.org/2002/07/owl#](http://www.w3.org/2002/07/owl#))> SELECTDISTINCT?prop?domain?range?label?comment WHERE{ {?prop rdf:typeowl:ObjectProperty. OPTIONAL{?prop rdfs:range?range}. OPTIONAL{?prop rdfs:domaindomain}. OPTIONAL{?prop rdfs:label?label}. OPTIONAL{?prop rdfs:comment?comment} } } UNION{ {?s?prop?o. FILTER(isIRI(?o)||isBlank(?o)) } } ```
Listing 4: Datatype Properties.  
As detailed in Section 2.6, the user interface also presents a list of the Resources, Literals and Blank Nodes. Since this information is already available through the underlying Python RDFlib after the pre-filtering query, no further queries are used.