Question

In OWL API, classes may have data properties. For e.g. a class may have a date property hasCommonName "Something". In OWL API, is there any facility like the SQL like which allows querying for classes that hasCommonName containing the word "Some", just like SQL like behave

Was it helpful?

Solution

You can use regular expressions to identify the things you need. Consider the following knowledge base:

DataProperty: hasCommonName

Individual: foo

Facts:  
 hasCommonName "Something"

You can retrieve the individual foo by using the following class expression: hasCommonName some string[pattern "Some.*"]. The string[pattern "Some.*"] specifies the pattern to be matched. Warning, currently not supported by all reasoners (works for Hermit 1.3.7)

OTHER TIPS

You need to look at some SPARQL tutorials. You can write something like this:

SELECT * WHERE
{
  ?pizza rdfs:subClassof [
  owl:onProperty :hasTopping;
  owl:someValuesFrom :TomatoTopping ] .
}

Basically, you need to define the correct predicate based on your restriction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top