Three Useful Protege Tools - mdebellis/SemanticKG-Design GitHub Wiki
🧠 Three Protégé Tools You Should Know but May Not
First, for some reason GitHub is giving me grief with some of my images. Apologies that the last two are a bit distorted but I think the ideas are still clear.
This presents three tools that are very useful in Protégé but aren't all that obvious and that I didn't discuss in the Revised Pizza Tutorial but wish I had. If you are an experienced Protégé user you probably already know these but if you are new to it you may not. I'm going to use the StreamForge Data Catalog ontology for examples.
➤ Finding the IRI for an Entity Using Rename
I decided to use the StreamForge ontology for this example because it is a more realistic example of when you might need this tool. The StreamForge ontology reuses several ontologies: PROV, DCAT, Dublin Core, SULO, and SKOS. In addition, it is a combination of three new ontologies I defined on this foundation:
- The Document Ontology. This defines a basic document model for the RAG system that is integrated with the StreamForge knowledge graph. The two most important classes are the
Documentclass and theDocument_Chunkclass. The chunk class breaks each document down into 1-3 paragraphs of text. This is required because when generating vector embeddings, if your text string is too large (e.g., a 5 page document) your vector will be so generic that it won't be of much use. - The Data Product Ontology. This adds classes from Domain Driven Design and Data Mesh such as
Bounded_ContextandData_Product. - The StreamForge knowledge graph. I call this a knowledge graph rather than an ontology because it has almost no TBox entities. It builds on the TBox entities from the ontologies described above and creates example documents for the made-up video streaming company: StreamForge.
With all these different ontologies, once in a while I'll do a query and realize I have the wrong IRI and need to check it. This tool is perfect for that. Figure 1 shows some of the StreamForge Data Catalog classes:
Figure 1: StreamForge Classes
Note that the User class is highlighted. Suppose I wanted to get all the instances of this class. Is it in the StreamForge namespace or the Data Product name space? An argument could be made either way. On the one hand, things specific to a company should be in the file for that company. So since User can be considered a StreamForge concept it might be in that namespace. On the other hand, while many organizations don't have users, the concept of a User is so pervasive one could also make a case for it being in the Data Product ontology.
To check this is easy. First select the User class. Then do Refactor>Rename Entity. You'll see a box with the last part of the IRI which is just User so that's not much help. But if you check the Show Full IRI box in the lower right corner you can see the whole IRI and it is in the Data Product namespace. See Figure 2. Make sure to cancel so you don't change the value.
Figure 2: Using Refactor>Rename to See Full IRI
➤ Searching the Ontology
As ontologies get larger it gets difficult to remember all the entities. The search tool in Protégé is very useful for this. A subclass of User is Creator. Suppose I want to find all the entities that have "Creator" either as a label or any other property. Select the magnifying glass icon in the upper right corner. That will bring up a window where you can type a string and as you type, you will continually see results. The more you type the fewer results because you are narrowing down the search space. Figure 3 shows searching the StreamForge knowledge graph for any entity with "Creator" as a value for any property.
Figure 3: Using the Search Tool
Note all the check boxes at the top of this window. They enable you to broaden or constrain your search.
➤ Finding Where an Entity Is Used
Suppose I want to find if I've defined values for the object property has_from_context. First navigate to that property and select it. Then look to the right. There are usually two tabs visible when you click on an entity: **Annotations **and Usage. Annotations is on top by default so it is possible to ignore usage. Just click on the Usage tab and that will bring it to the top and you can see wherever the entity is used. Not only as property values but also in axioms or anything else. See Figure 5.
Figure 4: The Usage Tab