Skip to content

Jena based framework to implement ontological mediation of SPARQL queries

Notifications You must be signed in to change notification settings

correndo/mediation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mediation toolkit

It's a lightweight toolkit to implement ontological mediation over RDF. It uses ontology mappings in order to rewrite SPARQL SELECT queries and to generate SPARQL CONSTRUCT queries to import an external data set.

API

The tool is divided in the following packages:

The ontology alignments are represented as RDF files and describe rewriting rules that allows to define class mappings:


	[]    <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
              <http://ecs.soton.ac.uk/om.owl#Alignment> ;
      <http://ecs.soton.ac.uk/om.owl#hasEntityAlignment>
              [ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
                        <http://ecs.soton.ac.uk/om.owl#EntityAlignment> ;
                <http://ecs.soton.ac.uk/om.owl#hasRelation>
                        <http://ecs.soton.ac.uk/om.owl#EQ> ;
                <http://ecs.soton.ac.uk/om.owl#lhs>
                        [ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
                                  <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#object>
                                  <http://correndo.ecs.soton.ac.uk/ontology/target#Boiler> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate>
                                  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject>
                                  _:b1
                        ] ;
                <http://ecs.soton.ac.uk/om.owl#rhs>
                        [ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
                                  <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#object>
                                  <http://correndo.ecs.soton.ac.uk/ontology/source#Kettle> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate>
                                  <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject>
                                  _:b1
                        ]
              ] ;

...property mappings:

      <http://ecs.soton.ac.uk/om.owl#hasEntityAlignment>
              [ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
                        <http://ecs.soton.ac.uk/om.owl#EntityAlignment> ;
                <http://ecs.soton.ac.uk/om.owl#hasRelation>
                        <http://ecs.soton.ac.uk/om.owl#EQ> ;
                <http://ecs.soton.ac.uk/om.owl#lhs>
                        [ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
                                  <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#object>
                                  _:b2 ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate>
                                  <http://correndo.ecs.soton.ac.uk/ontology/target#boiler> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject>
                                  _:b3
                        ] ;
                <http://ecs.soton.ac.uk/om.owl#rhs>
                        [ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
                                  <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#object>
                                  _:b2 ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate>
                                  <http://correndo.ecs.soton.ac.uk/ontology/source#hasKettle> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject>
                                  _:b3
                        ]
              ] ;

...and data manipulation:

      <http://ecs.soton.ac.uk/om.owl#hasEntityAlignment>
              [ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
                        <http://ecs.soton.ac.uk/om.owl#EntityAlignment> ;
                <http://ecs.soton.ac.uk/om.owl#hasFunctionalDependency>
                        [ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
                                  <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#object>
                                  [ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
                                            <http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq> ;
                                    <http://www.w3.org/1999/02/22-rdf-syntax-ns#_1>
                                            _:b4 ;
                                    <http://www.w3.org/1999/02/22-rdf-syntax-ns#_2>
                                            273.15
                                  ] ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate>
                                  <http://www.w3.org/2005/xpath-functions/sub> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject>
                                  _:b5
                        ] ;
                        <http://ecs.soton.ac.uk/om.owl#hasRelation>
                        <http://ecs.soton.ac.uk/om.owl#EQ> ;
                <http://ecs.soton.ac.uk/om.owl#lhs>
                        [ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
                                  <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#object>
                                  _:b4 ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate>
                                  <http://correndo.ecs.soton.ac.uk/ontology/target#temp> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject>
                                  _:b6
                        ] ;
                <http://ecs.soton.ac.uk/om.owl#rhs>
                        [ <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>
                                  <http://www.w3.org/1999/02/22-rdf-syntax-ns#Statement> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#object>
                                  _:b5 ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate>
                                  <http://correndo.ecs.soton.ac.uk/ontology/source#hasTemperature> ;
                          <http://www.w3.org/1999/02/22-rdf-syntax-ns#subject>
                                  _:b6
                        ]
              ] ;

Once loaded an alignment the tool allows to rewrite a SPARQL SELECT query in order to fit a given schema:

[kettle-boiler] original query:

	PREFIX  rdfs: <http://www.w3.org/2000/01/rdf-schema#>
	PREFIX  source: <http://correndo.ecs.soton.ac.uk/ontology/source#>
	PREFIX  owl:  <http://www.w3.org/2002/07/owl#>
	PREFIX  rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
	SELECT DISTINCT  ?v ?y ?z ?lt
	WHERE
	{ ?v rdf:type source:Person .
	?v source:hasKettle ?y .
	?v source:hasKettle ?l .
	?y source:hasTemperature 10 .
	?l source:hasTemperature ?lt .
	} LIMIT   10

[kettle-boiler] translated query:

	SELECT DISTINCT  ?v ?y ?z ?lt
	WHERE
	{ ?v   <http://www.w3.org/1999/02/22-rdf-syntax-ns#type>  <http://correndo.ecs.soton.ac.uk/ontology/target#User> ;
	       <http://correndo.ecs.soton.ac.uk/ontology/target#boiler>  ?y ;
	       <http://correndo.ecs.soton.ac.uk/ontology/target#boiler>  ?l ;
	?y   <http://correndo.ecs.soton.ac.uk/ontology/target#temp>  283.15 .
	?l  <http://correndo.ecs.soton.ac.uk/ontology/target#temp>  ?_12 .
	LET (?lt := ( ?_12 - 273.15 ))
	} LIMIT   10

About

Jena based framework to implement ontological mediation of SPARQL queries

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages