Re: [protege-user] How to Create Sub-Property
Michael DeBellis <[email protected]>
| Newsgroups | gmane.comp.misc.ontology.protege.owl |
|---|---|
| Message-ID | <CALGFikdy25Rus9XTEz4CzZNrz8HsNfdiqyWA_GDzJsf01+x+Pg@mail.gmail.com> |
> > Yes, but *why* is it not correct? I didn't participate in defining the standard so I don't know but I suspect the reason is that just because you add a mapping to your ontology doesn't mean you want every entity in that mapped ontology in your ontology. In fact, you almost never do. Consider SNOMED. Adding a snomed: prefix doesn’t import SNOMED itself, it just gives you a shorthand for writing IRIs. SNOMED CT is enormous — over 350,000 concepts — and covers diagnoses, procedures, medications, anatomy, and more. It would be very unusual for any ontology to want or need to reuse all of those concepts; in practice you only reference the handful that are relevant to your domain. If you ever programmed in Python they do the same thing. At the top of your file you have definitions like: from rdflib import Graph, URIRef, Namespace, BNode, Literal There are a lot of other useful functions and other things in rdflib but you only get the ones you need so you don't clutter up the namespace and memory. You can do: from rdflib import * Which gets you everything but that is considered a bad practice and almost no one ever does it. What I'm trying to understand is why Protege doesn't fetch the ontology > description of those ontologies I've created prefix mappings for behind the > scenes and make available to me all the individuals, classes, properties, > etc. so that I can reference them in my ontology? Why am I forced to do it > manually? For the same reason you should declare explicitly which code in a Python library you want to use from a Python library. Because while requiring you to explicitly add them is a bit more work it is far less work than what would happen if it worked the other way and for example you only wanted skos:prefLabel, skos:altLabel in your ontology but once you put the SKOS mapping you got the whole thing. I suppose a related question is this: why am I able to reference some terms > like rdf:type and rdfs:label without doing anything special? Those are fundamentally different. Entities like rdf:type, rdfs:label, and owl:Class are part of the meta-model that defines an OWL ontology. You need to have them all to create an ontology to work. Most other ontologies are domain ontologies where it is much less likely you will ever want the whole thing. I assume this is the case because I don't understand what you mean by ". . > . it can slow down your loading because every time you load it has to go > out to the Internet." If that's the case, isn't it always true, even for > references to rdf and rdfs? Most people get confused about this as well, I know I did. When you use an IRI like http://www.w3.org/2000/01/rdf-schema#label The IRI is a unique locator and there is no need to go to the W3C site when you load an ontology that has rdfs:label as one of its entities. You CAN go there because the IRI has been mapped to an Internet domain but often with ontologies that people build that isn't the case. E.g., in an ontology I'm working on now there are classes like: https://www.michaeldebellis.com/climate_obstruction/Belief If you type that into a browser you will get a 404 Error because I haven't mapped the ontology IRIs to pages on my web site. A lot of ontologies are like this. Although the ones that get reused the most are mapped. E.g., if you enter: http://www.w3.org/2000/01/rdf-schema#label in your browser, it will take you to the file where that entity is defined. A more sophisticated example is if you enter: https://www.w3.org/2009/08/skos-reference/skos.html#example in your browser it will take you to the place in the SKOS documentation where that entity is defined. But in all cases just because the IRIs can sometimes be entered into a browser doesn't mean that when you load them the system has to go to their site... as long as they are saved in your ontology which is why I usually do the Merge Ontologies. That way the IRIs are part of my ontology and no need to go over the Internet to find them.. On Fri, Sep 12, 2025 at 11:51 AM Tim McIver <[email protected]> wrote: > My expectation is that properties from the ontologies for which I've >> created prefix mappings would show up there. > > > That's not correct. > > Yes, but *why* is it not correct? I created the following small ontology > by hand: > > @prefix owl: <http://www.w3.org/2002/07/owl#> <http://www.w3.org/2002/07/owl#> . > @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . > @prefix xml: <http://www.w3.org/XML/1998/namespace> <http://www.w3.org/XML/1998/namespace> . > @prefix xsd: <http://www.w3.org/2001/XMLSchema#> <http://www.w3.org/2001/XMLSchema#> . > @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> <http://www.w3.org/2000/01/rdf-schema#> . > @prefix dct: <http://purl.org/dc/terms/> <http://purl.org/dc/terms/> . > @base <http://timmciver.com/file-ontology/> <http://timmciver.com/file-ontology/> . > <http://timmciver.com/file-ontology> <http://timmciver.com/file-ontology> rdf:type owl:Ontology ; > rdfs:label "An ontology for describing file data and metadata."@en . > > :OWLDataProperty_f2f87965_60f0_4405_a160_36fe9bcb23e2 rdf:type owl:DatatypeProperty ; > rdfs:subPropertyOf dct:creator ; > rdfs:comment "The dateTime on which the FileData object was created."@en ; > rdfs:label "created"@en . > > (You can probably tell I cheated a bit and used part of a file produced by > Protege). I'm free to simply reference dct:creator without "importing" > anything. > > What I'm trying to understand is why Protege doesn't fetch the ontology > description of those ontologies I've created prefix mappings for behind the > scenes and make available to me all the individuals, classes, properties, > etc. so that I can reference them in my ontology? Why am I forced to do it > manually? > > I suppose a related question is this: why am I able to reference some > terms like rdf:type and rdfs:label without doing anything special? > > I'm fairly new to Protege but have quite a bit of familiarity with linked > data and RDF. It's possible that I just don't understand a nuance here and > would love to be enlightened. I assume this is the case because I don't > understand what you mean by ". . . it can slow down your loading because > every time you load it has to go out to the Internet." If that's the case, > isn't it *always* true, even for references to rdf and rdfs? > Thanks, > Tim > > > Just because you have a mapping in Protege doesn't mean you can see all > the entities that exist in an ontology that has the base IRI as the > mapping. You still need to bring some or all of those entities into your > ontology. There are a few ways to do this: > > > 1) Manually. Don't recommend this but you can literally copy an IRI like: > IRI http://purl.org/dc/terms/creator and add that as a property in your > ontology.This is more for special cases where you may only need a few > entities and you need them ASAP to continue a task. If you do this you > won't get all the annotations that are associated with that entity. E.g., > things like Equivalent Property = http://xmlns.com/foaf/0.1/maker. You > can copy some or all of those annotations by hand as well and I've done > that in a few situations but that is not a good way to do it. > > 2) Import the ontology you want to use. This is the more common way. You > probably know there is an Import Ontology subtab in the Active Ontology tab > in Protege. After you import the ontology you can then delete entities that > you don't need (at least at that time). What you do after that is debatable > and the way I do it probably isn't something everyone would agree on but > what I usually do after importing an ontology is use: Refactor>Merge > Ontologies and merge the ontology I just imported into my main ontology. > What I do after that is: > 2.1) Add documentation to an annotation property on the ontology itself > that says something like "reused ontology Foo from https://FooBar.com > 2.2) Delete the ontology I imported from that same subtab on Active > Ontologies. > > The reason I do 2.2 is if I don't and I send the ontology to someone else, > actually even for my own use, it can slow down your loading because every > time you load it has to go out to the Internet. If you do the merge, the > IRIs for the reused vocabulary don't change, its just that you have > explicitly add them to your ontology rather than requiring others to wait > for Protege to load the ontology from somewhere on the Internet. > > Also, an issue that comes up is how do you handle changes to the ontology > you imported? Do you want to add changes from the vocabulary to the version > you have in yours or are you fine just using the entities as they existed > and don't care if the reusable vocabulary changes. I think there are some > tools in the OBO foundry https://obofoundry.org/resources that help you > do this process when you want to incorporate one vocabulary and keep > consistent with it. I think the people at Semantic Arts also have tools for > this for their Gist Upper Model: https://www.semanticarts.com/gist/ . > But I've never used either of them. > > Since you are a new Protege user, you might find this tutorial useful. It > is a revision of the original Pizza tutorial that is one of the most common > simple examples used to teach people how to build ontologies. I also added > sections on SWRL, SHACL, and SPARQL that weren't in the original tutorial: > https://www.michaeldebellis.com/post/new-protege-pizza-tutorial > > One last thing: I don't understand your domain of course but I just > thought I would mention you might want to re-think if you even need your > own property called creator and can't just use the DCT one. > > Cheers, > Michael > https://www.michaeldebellis.com/blog > > > > On Fri, Sep 12, 2025 at 7:29 AM Tim McIver <[email protected]> wrote: > >> Hello, >> >> I'm a new Protege user. I'm attempting to design a custom ontology for a >> linked data application. >> >> My current goal is to create a property `creator` that I wish to be a >> sub-property of `dct:creator`, the term from the Dublin Core Terms >> ontology. I have added `dct` as prefix under "Ontology Prefixes" with a >> mapping to http://purl.org/dc/terms/. I created my `creator` property as >> a Data Property and I attempted to make it a sub-property of >> `dct:creator` but when I attempt to do this, there is no `dct:creator` >> option in the dialog box. My expectation is that properties from the >> ontologies for which I've created prefix mappings would show up there. >> >> My research suggests that I must import the ontologies that I'd like to >> use this way. Is this correct? I found this SO answer describing the >> process: https://stackoverflow.com/a/44266590. Is this still the method >> I should use? >> >> Tim >> >> _______________________________________________ >> protege-user mailing list >> [email protected] >> https://mailman.stanford.edu/mailman/listinfo/protege-user >> > > _______________________________________________ > protege-user mailing [email protected]://mailman.stanford.edu/mailman/listinfo/protege-user > > _______________________________________________ > protege-user mailing list > [email protected] > https://mailman.stanford.edu/mailman/listinfo/protege-user > _______________________________________________ protege-user mailing list [email protected] https://mailman.stanford.edu/mailman/listinfo/protege-user