In order to run these examples, make sure that the default corpus is populated as described in Installation guide.
Constructing semantic queries
To construct a valid semantic query, after creating the query, you have to add at least one variable along with its class. As shown below, class names are relevant to the PROTON namespace used.
Adding name and pattern restrictions
To add a name restriction, you have to specify a triple (variable - comparison style - value). For more details, please see JavaDoc about comparison styles.
To add a pattern restriction, you have to specify a triple (variable1 - relation - variable2). For more details on the specifics of these relations, please explore KIM Ontology.
Using complex restrictions
Complex restriction are actually two or more attribute restrictions for the same variable. Let's say we want to get all documents created between 2001 and 2005. In order to do this, we should create a new ComplexAttributeRestriction object and set two AttributeRestriction s inside it.
Please, refer to API documentation for more information about ComplexAttributerestriction objects.
Executing queries and processing results
Depending on what you want to achieve, there are three different ways to execute semantic queries and process results.
You can find out more about how to search and process search results in the scenarios that follow ( Searching for Entities and Searching for Documents ).