How to correlate Virtual Graph with Ontology

Hi,

I created a virtual graph (VG) from a DB in MySql that I can query without a problem. I also have an ontology that is working fine. My problem is: how to integrate the ontology and the virtual graph, so when am I querying the ontology it automatically "jumps" to the virtual graph and get the most recent data?

Edit: Try to be more clear:
The VG contains the instances for the ontology, i.e. it's on the edge. How can I make queries in any part of the ontology and the reasoner understand that it can go from the ontology to the VG to search for the instances?

What I want is query without I explicit write in SPARQL "go to named-graph virtual" giving more freedom

Hi Caio,

Could you provide some queries that illustrate your situation - a query that shows the ontology working and the VG working and the VG not working with the ontology?

Thanks,
-Paul

Hi Paul,

On the VB I have the follow structure:

* :motor01 a :Motor.
* :drum01 a :Drum.
* :reducer01 :Reducer.
* :trolley01 a :Trolley
* :Trolley :hasPart :Motor;
* 	       :hasPart :Drum;
*          :hasPart :Reducer.

The ontology has a similar structure

* :motor01 a :Motor.
* :drum01 a :Drum.
* :reducer01 a :Reducer.
* :trolley01 a :Trolley

* :Motor :subClass :Part
* :Drum :subClass :Part
* :Reducer :subClass :Part

* :trolley01 a :Trolley
* :Trolley :subClass :Assembly

* :Assembly :hasPart :Part

For the queries, I'm using the following for the VB
1. PREFIX : http://lamis.utfpr.edu.br/fabrao/OverheadCrane/
2. select ?instance ?part
3. where {
4. graph virtual://overheadcrane{
5. ?instance a :Bridge;
6. :hasPart ?part.
7. }
8. }

Response:
/-------------------------------------------\

instance part
dbC:trolley01 dbC:motor01
dbC:trolley01 dbC:drum01
dbC:trolley01 dbC:reducer01

------------------------------------------/
*dbC is the prefix saved on the ontology for http://lamis.utfpr.edu.br/fabrao/OverheadCrane/

and for the ontology
1. select ?instance ?part
2. where {
3. ?instance a :Bridge;
4. :hasPart ?part.
5. }

Response:
/------------------------------\

instance part
:trolley01 :motor01
:trolley01 :drum01
:trolley01 :reducer01

------------------------------/

For the query with the ontology and the VB at the same time, I have no idea on how to make it.

I'm assuming that VB = VG (Virtual Graph). Can you include some more details on what query you'd like to make?

You should be able to treat the virtual graph just like any other named graph you might have.

VB is indeed VG, sorry by the typo.

If I want to know what motor is mounted in which structures I can query the ontology with

  1. SELECT ?motor ?Assembly
  2. WHERE {
  3. ?motor a :Motor.
  4. ?motor :isPartOf ?Assembly.
  5. }

The result will be something like

motor Assembly
:motor01 :trolley01

Now I want to use the motor coming from the VG but still using the reasoning part of the ontology (the Assembly relationship).

  1. PREFIX dbC: overheadcraneURI
  2. SELECT ?motor ?Assembly
  3. WHERE {
  4. graph < virtual://overheadcrane >{
  5. ?motor a dbC:Motor.
  6. }
  7. ?motor :isPartOf ?Assembly.
  8. }

That was my first thought but I understand that :Assembly has no relationship with dbC:Trolley from the VG. Do I need to map that relationship?

It's taken me a bit to respond because I'm still a little confused at what you're asking so I'll take a swing at it. Just let me know if I miss.

You've defined :Trolly to be a subclass of :Assembly so if you have reasoning enabled every Trolly is an Assembly. I think that would be the relationship that you're asking about. If you want you can make that explicit and simply map it so that every Trolly is also an Assembly and use that without reasoning. To apply reasoning to virtual graphs you need to enable the property reasoning.virtual.graph.enabled = true

It would be nice if Stardog included a default properties file like the one at https://github.com/stardog-union/stardog-examples/blob/develop/config/stardog.properties that listed all the possible properties and their defaults.

You can always list them with stardog-admin metadata get mydb but it's nice to have the documentation right there.

I hope that comes close to answering your question.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.