Home

Awesome

ODMTP TPF Server

odmtp-tpf is a Triple Pattern Fragment server using Python, Django and ODMTP.

ODMTP (On Demand Mapper with Triple pattern matching) enables triple pattern matching over non-RDF datasources.

ODMTP support inference (see Semantic Reasoner (Inference) section)

Online demo

ODMTP's implemented for Twitter API, Github API and Linkedin API are available online. You can run SPARQL queries using the online TPF client demo: Here for Twitter, Here for Github (limited to 60 request per hour) and Here for your Linkedin profile (you will need to login to access your personal LI profile).

ODMTP approach is already used on OpenDataSoft Plateform and can be tested Here.

Instructions

Installation

macOS

You need to install Homebrew.

and then install Python 2.7:

brew install python

Ubuntu

sudo apt-get install python-dev python-setuptools

Dependencies

You need to install dependencies with pip:

pip install -r requirements.txt

Running The Platform

macOS & Ubuntu

From ~/odmtp-tpf run the comand:

python manage.py runserver

The TPF server should run at: http://127.0.0.1:8000/

Semantic Reasoner (Inference)

RDF data contains explicit and implicit triples that can be inferred using rules described in ontologies. To support inference, ODMTP use ontologies to materialize implicit triples of mappings (extended mappings). Each API can be queried using extended mappings at: http://127.0.0.1:8000/{api}/extended Example: http://127.0.0.1:8000/twitter/extended

However, mappings only contains schema of the corresponding RDF dataset. Thus, rules that apply on RDF instances cannot be applied on mappings.

Supported rules

All rules that apply to schema (class and properties) are supported by ODMTP Semantic Reasoner.

Implemented rules

Rule Nameif dataset contains ...... then add
rdfs2 (domain)aaa rdfs:domain xxx .<br>uuu aaa yyy .uuu rdf:type xxx .
rdfs3 (range)aaa rdfs:range xxx .<br>uuu aaa vvv .vvv rdf:type xxx .
rdfs5 (subProperty transitivity)uuu rdfs:subPropertyOf vvv .<br>vvv rdfs:subPropertyOf xxx .uuu rdfs:subPropertyOf xxx .
rdfs7 (subProperty)aaa rdfs:subPropertyOf bbb .<br>uuu aaa yyy .uuu bbb yyy .
rdfs9 (subClassOf)uuu rdfs:subClassOf xxx .<br>vvv rdf:type uuu .vvv rdf:type xxx .
rdfs11 (subClassOf transitivity)uuu rdfs:subClassOf vvv .<br>vvv rdfs:subClassOf xxx .uuu rdfs:subClassOf xxx .
owl sameAs Classuuu owl:sameAs xxx .<br>vvv rdf:type uuu .vvv rdf:type xxx .
owl sameAs Propertyaaa owl:sameAs bbb .<br>uuu aaa yyy .uuu bbb yyy .
owl equivalentClassuuu owl:equivalentClass xxx .<br>vvv rdf:type uuu .vvv rdf:type xxx .
owl equivalentPropertyaaa owl:equivalentProperty bbb .<br>uuu aaa yyy .uuu bbb yyy .

Not implemented rules

Not all supported rules are yet implemented. Complete list of RDFS and OWL-LD rules.

Not supported rules

Rules that applies on instances are not supported by ODMTP Semantic Reasoner. examples:

Rule Nameif data contains ...... then addComment
owl-ld eq-rep-subjectsubj1 owl:sameAs subj2 .<br> subj1 aaa obj1 .subj2 aaa obj1 .Not supported if one of the two subject<br> is not defined in ontology or mapping
owl-ld eq-rep-objectobj1 owl:sameAs obj2 .<br> subj1 aaa obj1 .subj1 aaa obj2 .Not supported if subject or objects are<br> not defined in ontology or mapping

Mappings

Mappings are accessible at: http://127.0.0.1:8000/{api}/mapping Example: http://127.0.0.1:8000/twitter/mapping

Extended mapping are accessible at http://127.0.0.1:8000/{api}/mapping/extended Example: http://127.0.0.1:8000/twitter/mapping/extended

Examples of Simple Queries

You can use any Triple Pattern Fragment client: http://linkeddatafragments.org/software/ to run SPARQL queries over twitter API and github Repo API V3

SPARQL queries over Twitter API

You can run this SPARQL query over http://127.0.0.1:8000/twitter/ to retrieve tweets using #iswc2017 hashtag.

PREFIX it: <http://www.influencetracker.com/ontology#>

SELECT ?s WHERE {
 ?s it:includedHashtag "SemanticWeb".
}

Retrieve tweets from a specific user.

PREFIX schema: <http://schema.org/>

SELECT ?s WHERE {
 ?s schema:author "NantesTech".
}

SPO query to browse tweets

SELECT ?s ?p ?o WHERE {
 ?s ?p ?o
}

To retrieve a specific tweet by ID

SELECT ?p ?o WHERE {
 <https://twitter.com/statuses/889775221452005377> ?p ?o
}

SPARQL queries over Github API

You can run this SPARQL query over http://127.0.0.1:8000/github/ to retrieve repositories using Java programming language.

PREFIX schema: <http://schema.org/>

SELECT ?repo
WHERE {
?repo schema:language "Java"
}

SPO query to browse repositories

SELECT ?s ?p ?o WHERE {
 ?s ?p ?o
}

Extras

To understand how ODTMP approach is working, the ISWC 2017 poster is available here.

This is just a prototype, feel free to optimize it, improve mapping files, work on new api's etc.