Search code examples
owlowl-api

SQL Like in OWL API for data properties


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


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)