Domain modelling with Mangle #14
-
Hey there, I've read all the documentation and examples on this repo, however I was unable to answer if Mangle could fulfil my use case, could you please clarify this for me? I appreciate that this project is still a WIP, but on the README it says Mangle "can be used to model domain knowledge". I am looking for a means to create a domain model and query its metadata (amongst other things). I notice many approaches to do so (e.g. OWL) have had attention in the research domain but not so much in commercial applications, in addition they don't have the best tooling, and lots are quite old. Hence, when I was reading Mangle's documentation it seemed to suggest that it could be what I am looking for. Would it be possible to get some clarification on Mangle's use for domain modelling and how this could be reasoned with, perhaps with an example (for dummies)? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
There is Prolog support for OWL and RDF, for example: https://www.swi-prolog.org/web/
I don't know whether it's feasible to translate any of this to Datalog (Mangle). And I've never used OWL or RDF. Pointers to resources for OWL, RDF, and other knowledge representation systems: http://www.jfsowa.com/ikl/ |
Beta Was this translation helpful? Give feedback.
-
I will try a concise answer. People may have different ideas of what constitutes a model, but I won't go into that. Pragmatically, a model is something that represents aspects of reality, for a particular purpose, that is valid for some slice of time (cf. Stachowiak "Allgemeine Modelltheorie"). In the context of software, a domain model is some representation of the "business" concepts - the things users perceive as important and how they are related to other things. Entity relationship diagrams, UML class diagrams and even wire formats and class definitions serve the purpose of domain model, even boxes and wires diagrams on a whiteboard. Sometimes, it is useful or necessary to define a formal (machine-readable) domain model. In knowledge representation (which may have other purposes than building sotware) a domain model is a set of formal definitions that captures the concepts of some domain of knowledge. These definitions are called ontology. So ontologies as a more formal, logic-based approach for domain models which also implies that it is machine-readable. A language for expression an ontology is always based on some formal logic. The logical language is what enables precise specification by means of statements and formulas. There are many kinds of formal logic: they differ by the kind of statements that are possible. The "standard" first-order logic would be attractive however it is very expressive which means that many operations that one would like to do on ontologies are undecidable. Research has led to more restricted logics like description logics (DL). These talk strictly about (formal) "concepts" and "roles" and one usually aims at preserving decidability at the cost of expressivity. Importantly, the roles are always binary relations and there are many variations of DL. Datalog is a language based on first-order logic, however with the important difference that it deals with syntactic objects (facts). The "assertions" of description logic which relate instances to classes, e.g. "milka is the name of a cow" and that "grass is some kind of food" can be easily expressed by unary predicates:
The relations can be expressed as logical formulas.
We may want to create more general concepts, so we don't need to repeat ourselves:
These simple definitions are not different from class diagrams (the "is_a" relationship). It is easy to see that it is easy to express binary relationships. However, with plain Datalog, there are some limitations. In order to express more advanced relationships, extensions are necessary. These extensions look like constraints about facts. For example, there are equality-generating constraints and tuple-generating constraints. These integrity constraints are also very useful as a database schema. We'd eventually want some of the operations on ontology definitions implemented in Mangle, by ways of these constraints. |
Beta Was this translation helpful? Give feedback.
-
@rkrishnasanka - are you suggesting using Mangle for static type checking? If so, I have some thoughts, based on my experiences with using Prolog with constraints for type-checking of Python (it's trickier than I had anticipated, and I ended up using some quite different techniques). |
Beta Was this translation helpful? Give feedback.
I will try a concise answer. People may have different ideas of what constitutes a model, but I won't go into that. Pragmatically, a model is something that represents aspects of reality, for a particular purpose, that is valid for some slice of time (cf. Stachowiak "Allgemeine Modelltheorie").
In the context of software, a domain model is some representation of the "business" concepts - the things users perceive as important and how they are related to other things. Entity relationship diagrams, UML class diagrams and even wire formats and class definitions serve the purpose of domain model, even boxes and wires diagrams on a whiteboard.
Sometimes, it is useful or necessary to define a f…