AmpersandTarski / Ampersand

Build database applications faster than anyone else, and keep your data pollution free as a bonus.
http://ampersandtarski.github.io/
GNU General Public License v3.0
40 stars 8 forks source link

SemWeb: first step towards integrating with semantic web #487

Open Michiel-s opened 7 years ago

Michiel-s commented 7 years ago

Inspired by the talk of @LloydRutledge at the Ampersand Conference 2015 Ampersand and the Semantic Web, this issue describes a first step towards integrating semantic web technologies into Ampersand.

Parsing RDFS

As first step I propose to build a RDFS parser for the Ampersand compiler. This will enable us to (re)use ontologies as starting point for Ampersand models.

Ontologies are serialized into several formats (e.g. RDF/XML, RDF/Turtle, ..). I propose to start with support for the RDF/Turtle syntax. This looks very much like the declarative statements we have in the Ampersand syntax. I hope their is already a library in Haskell to parse this syntax. Otherwise the RDF/XML is also fine by me. Ontology engineering tools (like Protoge and Topbraid) have support to translate one another.

The RDF Schema specification: https://www.w3.org/TR/rdf-schema/ The Turtle specification: https://www.w3.org/TR/turtle/

A second step can be to extend the parser to the OWL specification, which uses rdfs classes and properties.

Mapping

Adapted from slide 18 of Lloyd's presentation, the table below provides a draft of the RDFS <-> Ampersand meta model mapping:

Classes

RDFS Ampersand Comment
rdfs:Resource Atom Note! Concepts, rules, relations are included (i.e. are also atoms, as in meat-grinder)
rdfs:Class Concept
rdfs:Literal Concept Ampersand doesn't distinguish between Classes and Literals
rdfs:Datatype TType representation
rdf:langString x specialization of Literal
rdf:HTML x specialization of Literal
rdf:XMLLiteral x specialization of Literal
rdf:Property Relation

Properties RDFS specifies the following properties between resources (in &: relations between concepts)

RDFS Ampersand Comment
Property rdfs:range Class target[Relation*Concept]
Property rdfs:domain Class source[Relation*Concept]
Resource rdf:type Class instanceOf[Atom*Concept]
Class1 rdfs:subClassOf Class2 isa[Concept*Concept]
Property1 rdfs:subPropertyOf Property2 x
Resource rdfs:label Literal name[ConceptIdentifier], name[RelationIdentifier], ..[Atom*Identifier]??
Resouce rdfs:comment Literal purpose, meaning, ...

Furthermore the RDFS specification defines a couple of non-normative classes and properties regarding containers, collections, reification and utilities. I suggest we ignore these (for the moment).

Including rdfs models

When providing a rdfs turtle file to the Ampersand compiler we only get output of ampersand classes, relations and if provided, certain population. For prototyping, this has no actual value yet. Therefore we should be able to include these rdfs models in our Ampersand scripts and define rules and interfaces as we are used to. Could this be made possible with the current INCLUDE statement? e.g.

CONTEXT Test IN ENGLISH
  INCLUDE "pathToRdfsModel.rdfs"

  <the usual ampersand syntax>
ENDCONTEXT
LloydRutledge commented 7 years ago

Was on a long vacation so sorry about this late reply. Great that we're doing this integration! Let me propose a general approach. First of all, use existing Semantic Web engines because they provide dependable, scalable reasoning. But since we doing that, a first step would be to have this endpoint replace the current database. This helps in particular with inferencing, which is a key component of Semantic Web reasoning. Then Ampersand gets not just the "assertions" but also the inferences from them, and in a way that is consistent between them.

That's the easy part. Trickier is how relation algebra is different than the Semantic Web in how it approaches reasoning and logical structure. Not just the inferencing, which we'd get easy and for free. But also the open world assumption of the Semantic Web, and how to combine that with the closed world assumption of Ampersand. We'd need to understand that relationship and difference fully at an academic and formal logic level before we can sensibly plan an integration of the two approaches and their tools. But of course, I'm very much up for it!

stefjoosten commented 6 years ago

I have made a start in branch "reading_RDF". The idea is to reuse the existing Haskell package rdf4h, which contains both reading and writing of RDF in various serialization formats. This is work in progress.

github-actions[bot] commented 1 month ago

This issue is stale because it has been open 5 years with no activity. Remove stale label or comment or this will be closed in 30 days.