Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QUESTION] - Ontology in LOD #119

Open
siegefrSICKAG opened this issue Jun 19, 2024 · 4 comments
Open

[QUESTION] - Ontology in LOD #119

siegefrSICKAG opened this issue Jun 19, 2024 · 4 comments

Comments

@siegefrSICKAG
Copy link

Description

I would like to include the oml ontology in my own ontologies, i.e. like:
@Prefix owl: http://www.w3.org/2002/07/owl# .

However i don't find the actual ontology under an URI, do you provide it somewhere?

@melaasar
Copy link
Member

Do you mean you want to use the "owl" vocabulary from your oml vocabulary?

In OML, the extend statement is equivalent to both an owl:imports axiom and a @prefix statement in one.

First, first make sure that your project has the file build/oml/www.w3.org/2002/07/owl.oml. You get this file when you build the project if you have a (direct or transitive) dependency on the core-vocabularies library in your gradle.build like this:

dependencies {
    oml "io.opencaesar.ontologies:core-vocabularies:5.+" // direct dependency
}

Then, in your vocabulary, you can extend the owl vocabulary then use it:

vocabulary <http://opencaesar.io/template/vocabulary1#> as vocabulary1 {
	
	extends <http://www.w3.org/2002/07/owl#> as owl
	
        concept C1 < owl:Thing  // an example of using owl terms

}```

@siegefrSICKAG
Copy link
Author

I want to do it the other way around. I want to reuse the oml concepts and extend those, because i want the formality of oml, but only for a small subset of a domain and connect it to the more broader concepts that are possible within owl.

@melaasar
Copy link
Member

melaasar commented Jun 19, 2024

Ah I see. This is also doable.

First, notice that OML maps to a pattern-based subset of OWL2-DL and SWRL, let's call it the "oml profile". This profile is not small so you can probably do most of your modeling in OML. The profile is chosen to optimize speed of consistecy checking and explainability of consistency issues when we reason with the DL reasoner. For example, we avoid "negation" and "disjunction" class expressions, anonymous classes used directly in domain/range of properties, disjointness axioms (which we generate by policy in vocabulary bundles), etc.

Now, if you want to go outside this profile, you can certainly do that by adding another OWL ontology that imports the OWL ontology derived from your OML ontology. For example, let's assume you have the following folder structure:

src/oml/vocabulary1.oml // your main ontology
src/owl/vocabulary2.owl // your extended ontology
build/owl/vocabulary1.owl // equivalent of your main ontology in owl that you get when you build the project

In your vocabulary1.oml you can have:

vocabulary <http://vocabulary1#> as v1 {
    concept C1
    concept C2
    relation r1 [ from C1 to C2 functional ]
}

When you build the project, you will get vocabulary1.owl as follows:

<?xml version="1.0"?>
<rdf:RDF xmlns="http://vocabulary1#"
     xml:base="http://vocabulary1"
     ....
     xmlns:v1="http://vocabulary1#"

    <owl:Ontology rdf:about="http://vocabulary1">
        <oml:namespace rdf:resource="http://vocabulary1#"/>
        <oml:prefix>v1</oml:prefix>
        <oml:type rdf:resource="http://opencaesar.io/oml#Vocabulary"/>
    </owl:Ontology>

    <owl:Class rdf:about="http://vocabulary1#C1">
        <oml:type rdf:resource="http://opencaesar.io/oml#Concept"/>
    </owl:Class>

    <owl:Class rdf:about="http://vocabulary1#C2">
        <oml:type rdf:resource="http://opencaesar.io/oml#Concept"/>
    </owl:Class>

    <owl:ObjectProperty rdf:about="http://vocabulary#r1">
        <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
        <rdfs:domain rdf:resource="http://vocabulary1#C1"/>
        <rdfs:range rdf:resource="http://vocabulary1#C2"/>
        <oml:type rdf:resource="http://opencaesar.io/oml#UnreifiedRelation"/>
    </owl:ObjectProperty>
</rdf:RDF>

Note: that the 'oml' namespace is used in annotation properties only and these are defined inline in the generated owl ontologies. We are considering having a "oml.oml" ontology as part of the core-vocabularies library to avoid this inlining but it should not matter in your case.

Then, you can define your voabulary2.owl that imports/prefixes the http://vocabulary1 namespace and adds extra statements in OWL directly, in which you could possibly go outside the oml profile:

<?xml version="1.0"?>
<rdf:RDF xmlns="http://vocabulary2#"
     xml:base="http://vocabulary2"
     ....
     xmlns:v1="http://vocabulary1#"
     xmlns:v2="http://vocabulary2#"

    <owl:Ontology rdf:about="http://vocabulary2">
        <owl:imports rdf:resource="http://vocabulary1"/> 
    </owl:Ontology>

    <owl:Class rdf:about="http://vocabulary2#C3">
        <rdfs:subClassOf rdf:resource="http://vocabulary1#C1"/>
    </owl:Class>

    <owl:Class rdf:about="http://vocabulary1#C2">
        <rdfs:subClassOf rdf:resource="http://vocabulary2#C3"/>
    </owl:Class>
</rdf:RDF>

@melaasar
Copy link
Member

melaasar commented Jun 19, 2024

To cleanly separate your src and build folders, you can add a task in your gradle.build script to copy your src/owl contents directly to the build/owl folder as part of the build. This way, all your owl files (specified in owl or derived from oml) will be in the same folder build/owl after you build.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants