I'm using Stardog Studio (online) to query an ontology developed as part of a research project. I have a series of queries that I use to answer specific questions. I want to further refine the results of my queries so it only includes the results that are under a specific sub-class of the ontology. However, I can't find where I should be looking in the Stardog documentation to figure out how to do this or what commands can help me do this.
I do see that the particular elements I want are in the CSV file (using run to file). And I know that these elements are all subclasses of a particular class in my ontology. So they are there, they are in the results. So I'm not sure how this is called but I want to get only the answers that correspond to the particular leaves of a specific branch of the ontology if this makes sense.
prefix stardogapi: <tag:stardog:api:>
select ?entity ?doc ?mention ?type ?label where
{
?doc stardogapi:property:textMatch
"System Security Analyst" ,
"Application isolation will limit what other processes and system features the exploited target can access.",
"Web Application Firewalls may be used to limit exposure of applications to prevent exploit traffic from reaching the application.",
"Segment externally facing servers and services from the rest of the network with a DMZ or on separate hosting infrastructure.",
"Use least privilege for service accounts will limit what permissions the exploited process gets on the rest of the system.",
"Regularly scan externally facing systems for vulnerabilities and establish procedures to rapidly patch systems when critical vulnerabilities are discovered through scanning and through public disclosure.",
"Regularly scan externally facing systems for vulnerabilities and establish procedures to rapidly patch systems when critical vulnerabilities are discovered through scanning and through public disclosure.".
graph ?doc
{
?doc stardog:docs:hasEntity ?entity .
?entity <http://purl.org/dc/terms/references> ?mention
}
?mention a ?type ; rdfs:label ?label
}
Order by ?doc
I'm hoping to have a result that would only have the last column (label) would match the labels in a specific 'branch' of my ontology, which contains work roles. Of course, this is the ontology that is loaded in the Stardog database.
Try changing your ?mentino a ?type clause to ?mention rdf:subClassOf <branchRootClass>. You most likely will need to turn on reasoning.
Did you want the full text search evaluated as an 'or' or an 'and' over those terms? It may be more efficient to evaluate that with a single argument textMatch and use Lucene operators rather than separate calls.
The IRI I show here is the root class of the subclass from where I what to limit the answers from. Maybe this information will help to help me... When I run the query as before I get 633 results, including the results where the label is in the group I want, being under the subclass mentioned above.
select ?entity ?doc ?mention ?type ?label where
{
?doc stardogapi:property:textMatch
"System Security Analyst" ,
"Application isolation will limit what other processes and system features the exploited target can access.",
"Web Application Firewalls may be used to limit exposure of applications to prevent exploit traffic from reaching the application.",
"Segment externally facing servers and services from the rest of the network with a DMZ or on separate hosting infrastructure.",
"Use least privilege for service accounts will limit what permissions the exploited process gets on the rest of the system.",
"Regularly scan externally facing systems for vulnerabilities and establish procedures to rapidly patch systems when critical vulnerabilities are discovered through scanning and through public disclosure.",
"Regularly scan externally facing systems for vulnerabilities and establish procedures to rapidly patch systems when critical vulnerabilities are discovered through scanning and through public disclosure.".