public class CODACore extends Object
Modifier and Type | Field and Description |
---|---|
private ComponentProvider |
componentProvider |
private org.eclipse.rdf4j.repository.RepositoryConnection |
connection |
private Map<String,Properties> |
converter2propertiesMap |
private CODAContext |
ctx |
private boolean |
debugMode |
(package private) DependsOnManager |
dependsOnManager |
private boolean |
feathPathInProjRulesValidated |
private org.apache.uima.cas.FSIterator<org.apache.uima.jcas.tcas.Annotation> |
iterAnnotation |
private org.apache.uima.jcas.JCas |
jcas |
private static org.slf4j.Logger |
logger |
private int |
maxNumAnswerPD |
private Map<String,Map<org.apache.commons.lang3.tuple.Pair<ProjectionOperator,Object>,org.eclipse.rdf4j.model.Value>> |
memoizedProjectionsMaps |
static String |
PLACEHOLDER_DEPENDS_REGEX |
static String |
PLACEHOLDER_DEPENDS_SYMBOL |
static String |
PLACEHOLDER_SYMBOL |
(package private) ProjectionRulesModel |
prModel |
private HashMap<String,ProjectionRulesDeciderInterface> |
projectionRulesDeciderMap |
private boolean |
useSuperTypesDefault |
private String |
VAR_SYMBOL |
Constructor and Description |
---|
CODACore(ComponentProvider componentProvider) |
Modifier and Type | Method and Description |
---|---|
ProjectionRulesModel |
addAllRulesFromDirectory(File dir,
boolean isRecursive)
Add all the ProjectionRules placed inside *.pr files in a give directory in the current
ProjectionRulesModel, if
isRecursive is set to true, then subdirectories are inspected as
well |
protected ProjectionRulesModel |
addAllRulesFromDirectory(File dir,
boolean isRecursive,
ParserPR parser) |
ProjectionRulesModel |
addProjectionRuleModel(File prFile)
Add the PEARL info from the input file into the current ProjectionRuleModel.
|
ProjectionRulesModel |
addProjectionRuleModel(File prFile,
boolean ruleShouldExists)
Add the PEARL info from the input file into the current ProjectionRuleModel.
|
ProjectionRulesModel |
addProjectionRuleModel(InputStream prInputStream)
Add the PEARL info from the input stream into the current ProjectionRuleModel.
|
ProjectionRulesModel |
addProjectionRuleModel(InputStream prInputStream,
boolean ruleShouldExists)
Add the PEARL info from the input stream into the current ProjectionRuleModel.
|
ProjectionRulesModel |
addProjectionRules(File prFile)
Add all the ProjectionRules placed inside prFile in a give directory in the current
ProjectionRulesModel
|
ProjectionRulesModel |
addProjectionRules(InputStream prInputStream)
Add all the ProjectionRules placed inside prInputStream in a give directory in the current
ProjectionRulesModel
|
private Annotation |
checkParamValueTypeCompliant(Annotation annotation,
Map<String,SingleTableValue> row,
String ruleId) |
void |
cleanProjectionRulesModel()
Clean the current ProjectionRulesModel
|
void |
clearMemoizedMap()
Clear the memoizedProjectionsMaps
|
void |
closeRepositoryConnection()
Close the RDFModel
|
private CODATriple |
constructCODATriple(GraphStruct graphStruct,
Map<String,SingleTableValue> row,
Map<String,org.eclipse.rdf4j.model.BNode> bnodeMap,
String ruleId,
boolean addNodeNamesInGraph) |
private String |
constructWhereOptional(OptionalGraphStruct optionaGraphStruct,
Map<String,SingleTableValue> row,
HashMap<String,org.eclipse.rdf4j.model.BNode> bnodeMap,
int indent) |
private String |
constructWhereQuery(Collection<GraphElement> whereList,
Map<String,SingleTableValue> row) |
private String |
constructWhereQuerySingleElemOfTriplePart(GraphSingleElement graphSingleElement,
Map<String,SingleTableValue> row,
HashMap<String,org.eclipse.rdf4j.model.BNode> bnodeMap) |
private String |
constructWhereQueryTriplePart(GraphStruct graphStruct,
Map<String,SingleTableValue> row,
HashMap<String,org.eclipse.rdf4j.model.BNode> bnodeMap) |
private void |
executeDFSA(RegexProjectionRule rpr,
StateFSA currentState,
int endLastUsedAnn,
boolean firstRun,
org.apache.uima.cas.FSIterator<org.apache.uima.jcas.tcas.Annotation> currentIterAnnotation,
org.apache.uima.jcas.tcas.Annotation currentAnnotation,
boolean useSuperTypes,
RegexResults regexResults,
List<RegexResults> regexResultsList) |
org.eclipse.rdf4j.model.Value |
executeLiteralConverter(ConverterMention converterMention,
Object inputValue,
String datatype,
String lang)
Executes a converter to generate a literal from an Object value.
|
org.eclipse.rdf4j.model.Value |
executeLiteralConverter(ConverterMention converterMention,
String datatype,
String lang)
Executes a converter to generate a literal from a
null value. |
org.eclipse.rdf4j.model.Value |
executeLiteralConverter(String converter,
String value,
String datatype,
String lang)
Executes a converter to generate a literal from an String value.
|
org.eclipse.rdf4j.model.Value |
executeProjectionOperator(ProjectionOperator projectionOperator)
Executes a projection operator to produce an RDF node (either a URI or a literal, depending the type of
projection operator).
|
org.eclipse.rdf4j.model.Value |
executeProjectionOperator(ProjectionOperator projectionOperator,
Object inputValue)
Executes a projection operator to produce an RDF node (either a URI or a literal, depending the type of
projection operator).
|
void |
executeProjectionRule(ProjectionRule pr,
org.apache.uima.jcas.tcas.Annotation annotation,
SuggOntologyCoda suggOntCoda,
boolean addNodeNamesInGraph,
boolean addNodeAssignmentMap)
Executes a projection rule
pr against an annotation storing the suggestions
in the provided strucuture. |
private void |
executeRegex(RegexProjectionRule rpr,
org.apache.uima.jcas.JCas jcas,
SuggOntologyCoda suggOntCoda,
org.apache.uima.cas.FSIterator<org.apache.uima.jcas.tcas.Annotation> iterAnnotation,
org.apache.uima.jcas.tcas.Annotation currentAnnotation,
boolean useSuperTypes,
boolean addNodeNamesInGraph) |
org.eclipse.rdf4j.model.IRI |
executeURIConverter(ConverterMention converterMention)
Executes a converter to generate a URI from a
null . |
org.eclipse.rdf4j.model.IRI |
executeURIConverter(ConverterMention converterMention,
Object inputValue)
Executes a converter to generate a URI from an Object value.
|
org.eclipse.rdf4j.model.Value |
executeURIConverter(String converter)
Executes a converter to generate a URI from a
null value. |
org.eclipse.rdf4j.model.Value |
executeURIConverter(String converter,
String inputValue)
Executes a converter to generate a URI from a String value.
|
private org.eclipse.rdf4j.model.Literal |
generateRDFLiteralFromGraphSingleElemLiteral(GraphSingleElemLiteral gseLiteral) |
private List<org.eclipse.rdf4j.model.Value> |
generateRDFNodeFromGraphSingleElementForRegex(GraphSingleElement gse,
RegexProjectionRule rpr,
RegexResults regexResults) |
private List<CODATriple> |
generateTriplesFromOptionalInRegex(RegexProjectionRule rpr,
OptionalGraphStruct ogs,
RegexResults regexResults,
boolean addNodeNamesInGraph) |
private void |
generateTriplesFromRegex(RegexProjectionRule rpr,
RegexResults regexResults,
org.apache.uima.jcas.JCas jcas,
SuggOntologyCoda suggOntCoda,
boolean addNodeNamesInGraph) |
CODAContext |
getCODAContext()
Get the CODA context
|
Collection<AnnotationDefinition> |
getDefinitionModel()
Get the AnnotationsDefinition Model
|
HashMap<String,ProjectionRulesDeciderInterface> |
getProjectionRulesDeciderMap()
This method get the Projection Rule Decider Annotation Map TODO check if it should still remain in this
version
|
ProjectionRulesModel |
getProjRuleModel()
Get the Projection Rule Model
|
private String |
getValueForWhere(org.eclipse.rdf4j.model.Value value) |
private org.eclipse.rdf4j.model.Value |
getValueOfGraph(Map<String,SingleTableValue> row,
GraphSingleElement graphSingleElement,
Map<String,org.eclipse.rdf4j.model.BNode> bnodeMap) |
void |
initialize(org.eclipse.rdf4j.repository.RepositoryConnection connection)
An overload of
initialize(RepositoryConnection, boolean) , with the third parameter set to
true . |
void |
initialize(org.eclipse.rdf4j.repository.RepositoryConnection connection,
boolean useSuperTypes)
Initializes the framework.
|
boolean |
isAnotherAnnotationPresent()
This method return true if there is another UIMA annotation in the cas, false otherwise
|
Collection<ConverterContractDescription> |
listConverterContracts()
Returns the descriptions of the currently known converter contracts.
|
Collection<ConverterDescription> |
listConverters()
Returns the descriptions of the currently known converters
|
void |
mergeProjectionRulesModels(ProjectionRulesModel prm1,
ProjectionRulesModel prm2)
add to the first ProjectionRulesModel
prm1 all the data from the second
ProjectionRulesModel prm1 |
ConverterMention |
parseConverterMention(String textualConverterMention,
Map<String,String> prefixMapping)
Parses a converter mention.
|
ProjectionOperator |
parseProjectionOperator(String textualProjectionOperator,
Map<String,String> prefixMapping)
Parses a projection operator.
|
private void |
printAllRegexElements(List<RegexResults> regexResultsList) |
(package private) List<SuggOntologyCoda> |
processAllAnnotation()
Processes all annotation found in the current CAS, and returns a list of the suggestions originate from
each annotation.
|
List<SuggOntologyCoda> |
processAllAnnotation(boolean useSuperTypes)
Processes all annotation found in the current CAS, and returns a list of the suggestions originated
from each annotation.
|
List<SuggOntologyCoda> |
processAllAnnotation(boolean addNodeAssignmentMap,
boolean addNodeNamesInGraph) |
List<SuggOntologyCoda> |
processAllAnnotation(boolean useSuperTypes,
boolean addNodeAssignmentMap,
boolean addNodeNamesInGraph)
Processes all annotation found in the current CAS, and returns a list of the suggestions originated
from each annotation.
|
SuggOntologyCoda |
processNextAnnotation()
Processes the next annotation and returns the suggestions originated from it.
|
SuggOntologyCoda |
processNextAnnotation(boolean useSuperTypes)
Processes the next annotation and returns the suggestions originated from it.
|
SuggOntologyCoda |
processNextAnnotation(boolean addNodeAssignmentMap,
boolean addNodeNamesInGraph) |
SuggOntologyCoda |
processNextAnnotation(boolean useSuperTypes,
boolean addNodeAssignmentMap,
boolean addNodeNamesInGraph)
Processes the next annotation and returns the suggestions originated from it.
|
private void |
removeDuplicate(List<CODATriple> suggestedTripleWithDuplicated,
List<CODATriple> suggestedTriple) |
private boolean |
resolveOptionalGraph(OptionalGraphStruct optionaGraphStruct,
List<CODATriple> optionalSuggestedTripleList,
Map<String,SingleTableValue> row,
Map<String,org.eclipse.rdf4j.model.BNode> bnodeMap,
ProjectionRule pr,
boolean addNodeNamesInGraph) |
private void |
setAllImplementedDependency() |
ProjectionRulesModel |
setAllProjectionRulelModelFromFileList(List<File> perFileList)
Add all PEARL info from the list of File into the current ProjectionRuleModel.
|
ProjectionRulesModel |
setAllProjectionRulelModelFromInputStreamList(List<InputStream> prInputSreamList)
Add all PEARL info from the list of InputStream into the current ProjectionRuleModel.
|
void |
setConverterProperties(String converter,
Properties properties)
Sets the properties associated with a converter.
|
void |
setGlobalContractBinding(String contract,
String converter)
Binds a contract to a converter (both indicated via their URIs).
|
void |
setJCas(org.apache.uima.jcas.JCas jcas,
boolean clearMemoizedMap)
Set the UIMA CAS containing all the UIMA annotation
|
void |
setMaxNumAnswerPD(int maxNumAnswerPD)
This method set the maximum number of hint that the Projection Disambiguation can return
|
ProjectionRulesModel |
setProjectionRulesModel(File prFile)
Sets the PEARL document that will drive the projection process.
|
ProjectionRulesModel |
setProjectionRulesModel(InputStream prInputStream)
Sets the PEARL document that will drive the projection process.
|
void |
setRepositoryConnection(org.eclipse.rdf4j.repository.RepositoryConnection connection)
Set the ontology connection
|
void |
setUseSuperTypes(boolean useSuperTypes)
Sets whether or not an annotation triggers a rule matching a super type
|
void |
stopAndClose()
Close the rdfModel and stop Felix
|
private final boolean debugMode
private final String VAR_SYMBOL
public static final String PLACEHOLDER_SYMBOL
public static final String PLACEHOLDER_DEPENDS_SYMBOL
public static final String PLACEHOLDER_DEPENDS_REGEX
private org.apache.uima.cas.FSIterator<org.apache.uima.jcas.tcas.Annotation> iterAnnotation
private org.apache.uima.jcas.JCas jcas
private org.eclipse.rdf4j.repository.RepositoryConnection connection
private boolean feathPathInProjRulesValidated
private CODAContext ctx
private boolean useSuperTypesDefault
private HashMap<String,ProjectionRulesDeciderInterface> projectionRulesDeciderMap
private int maxNumAnswerPD
ProjectionRulesModel prModel
DependsOnManager dependsOnManager
private static org.slf4j.Logger logger
private ComponentProvider componentProvider
private Map<String,Properties> converter2propertiesMap
private Map<String,Map<org.apache.commons.lang3.tuple.Pair<ProjectionOperator,Object>,org.eclipse.rdf4j.model.Value>> memoizedProjectionsMaps
public CODACore(ComponentProvider componentProvider)
public void initialize(org.eclipse.rdf4j.repository.RepositoryConnection connection, boolean useSuperTypes)
connection
- a RepositoryConnection to an ontologyuseSuperTypes
- tells an annotation triggers a rule matching a super typeprivate void setAllImplementedDependency()
public void setUseSuperTypes(boolean useSuperTypes)
useSuperTypes
- public void initialize(org.eclipse.rdf4j.repository.RepositoryConnection connection)
initialize(RepositoryConnection, boolean)
, with the third parameter set to
true
.connection
- public ProjectionRulesModel setProjectionRulesModel(File prFile) throws PRParserException
prFile
- PRParserException
public ProjectionRulesModel setProjectionRulesModel(InputStream prInputStream) throws PRParserException
prInputStream
- PRParserException
public ProjectionRulesModel addProjectionRuleModel(File prFile) throws PRParserException
prFile
- PRParserException
public ProjectionRulesModel addProjectionRuleModel(File prFile, boolean ruleShouldExists) throws PRParserException
prFile
- ruleShouldExists
- PRParserException
public ProjectionRulesModel addProjectionRuleModel(InputStream prInputStream) throws PRParserException
prInputStream
- PRParserException
public ProjectionRulesModel addProjectionRuleModel(InputStream prInputStream, boolean ruleShouldExists) throws PRParserException
prInputStream
- PRParserException
public ProjectionRulesModel setAllProjectionRulelModelFromFileList(List<File> perFileList) throws PRParserException
perFileList
- PRParserException
public ProjectionRulesModel setAllProjectionRulelModelFromInputStreamList(List<InputStream> prInputSreamList) throws PRParserException
prInputSreamList
- PRParserException
public ProjectionRulesModel addAllRulesFromDirectory(File dir, boolean isRecursive) throws NotDirectoryException, PRParserException
isRecursive
is set to true, then subdirectories are inspected as
welldir
- the start directory where to look for *pr filesisRecursive
- true if subdirectories should be used as wellNotDirectoryException
PRParserException
protected ProjectionRulesModel addAllRulesFromDirectory(File dir, boolean isRecursive, ParserPR parser) throws NotDirectoryException, PRParserException
public ProjectionRulesModel addProjectionRules(InputStream prInputStream) throws DuplicateRuleIdException, PRParserException
prInputStream
- DuplicateRuleIdException
PRParserException
public ProjectionRulesModel addProjectionRules(File prFile) throws DuplicateRuleIdException, PRParserException
prFile
- DuplicateRuleIdException
PRParserException
public void mergeProjectionRulesModels(ProjectionRulesModel prm1, ProjectionRulesModel prm2) throws DuplicateRuleIdException
prm1
all the data from the second
ProjectionRulesModel prm1
prm1
- prm1
- DuplicateRuleIdException
public void cleanProjectionRulesModel()
public void setJCas(org.apache.uima.jcas.JCas jcas, boolean clearMemoizedMap)
jcas
- the jcas that will be setpublic void clearMemoizedMap()
public void setGlobalContractBinding(String contract, String converter)
contract
- converter
- public Collection<ConverterContractDescription> listConverterContracts()
public Collection<ConverterDescription> listConverters()
public void setConverterProperties(String converter, Properties properties)
converter
- properties
- public void stopAndClose() throws org.eclipse.rdf4j.repository.RepositoryException
org.eclipse.rdf4j.repository.RepositoryException
public void setRepositoryConnection(org.eclipse.rdf4j.repository.RepositoryConnection connection)
connection
- the ontology modelpublic void closeRepositoryConnection() throws org.eclipse.rdf4j.repository.RepositoryException
org.eclipse.rdf4j.repository.RepositoryException
public CODAContext getCODAContext()
public ProjectionRulesModel getProjRuleModel()
public Collection<AnnotationDefinition> getDefinitionModel()
public HashMap<String,ProjectionRulesDeciderInterface> getProjectionRulesDeciderMap()
public boolean isAnotherAnnotationPresent()
public void setMaxNumAnswerPD(int maxNumAnswerPD)
maxNumAnswerPD
- the maximum number of hint that the Projection Disambiguation can returnList<SuggOntologyCoda> processAllAnnotation() throws ComponentProvisioningException, ConverterException, org.eclipse.rdf4j.query.UnsupportedQueryLanguageException, org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException, org.eclipse.rdf4j.query.QueryEvaluationException, DependencyException, RDFModelNotSetException, ProjectionRuleModelNotSet, UnassignableFeaturePathException, UnsupportedTypeInParamDefinitionException, TypeOfParamInAnnotationWrongTypeException, ConfidenceNotDoubleNumException, ConfidenceValueNotAcceptableException, ConfidenceGenericErrorException, PlaceholderValueWrongTypeForParamInAnnotationException, ValueNotPresentDueToConfigurationException
ComponentProvisioningException
ConverterException
org.eclipse.rdf4j.query.UnsupportedQueryLanguageException
org.eclipse.rdf4j.query.MalformedQueryException
org.eclipse.rdf4j.query.QueryEvaluationException
DependencyException
RDFModelNotSetException
ProjectionRuleModelNotSet
UnassignableFeaturePathException
org.eclipse.rdf4j.repository.RepositoryException
UnsupportedTypeInParamDefinitionException
TypeOfParamInAnnotationWrongTypeException
ConfidenceNotDoubleNumException
ConfidenceValueNotAcceptableException
ConfidenceGenericErrorException
PlaceholderValueWrongTypeForParamInAnnotationException
ValueNotPresentDueToConfigurationException
public List<SuggOntologyCoda> processAllAnnotation(boolean useSuperTypes) throws ComponentProvisioningException, ConverterException, org.eclipse.rdf4j.query.UnsupportedQueryLanguageException, org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException, org.eclipse.rdf4j.query.QueryEvaluationException, DependencyException, RDFModelNotSetException, ProjectionRuleModelNotSet, UnassignableFeaturePathException, UnsupportedTypeInParamDefinitionException, TypeOfParamInAnnotationWrongTypeException, ConfidenceNotDoubleNumException, ConfidenceValueNotAcceptableException, ConfidenceGenericErrorException, PlaceholderValueWrongTypeForParamInAnnotationException, ValueNotPresentDueToConfigurationException
useSuperTypes
- tells whether or not an annotation triggers a rule matching a supertype (overriding the
value passed to initialize(RepositoryConnection, boolean)
or
setUseSuperTypes(boolean)
ComponentProvisioningException
ConverterException
org.eclipse.rdf4j.query.UnsupportedQueryLanguageException
org.eclipse.rdf4j.query.MalformedQueryException
org.eclipse.rdf4j.query.QueryEvaluationException
DependencyException
RDFModelNotSetException
ProjectionRuleModelNotSet
UnassignableFeaturePathException
org.eclipse.rdf4j.repository.RepositoryException
UnsupportedTypeInParamDefinitionException
TypeOfParamInAnnotationWrongTypeException
ConfidenceNotDoubleNumException
ConfidenceValueNotAcceptableException
ConfidenceGenericErrorException
PlaceholderValueWrongTypeForParamInAnnotationException
ValueNotPresentDueToConfigurationException
public List<SuggOntologyCoda> processAllAnnotation(boolean addNodeAssignmentMap, boolean addNodeNamesInGraph) throws ComponentProvisioningException, ConverterException, org.eclipse.rdf4j.query.UnsupportedQueryLanguageException, org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException, org.eclipse.rdf4j.query.QueryEvaluationException, DependencyException, RDFModelNotSetException, ProjectionRuleModelNotSet, UnassignableFeaturePathException, UnsupportedTypeInParamDefinitionException, TypeOfParamInAnnotationWrongTypeException, ConfidenceNotDoubleNumException, ConfidenceValueNotAcceptableException, ConfidenceGenericErrorException, PlaceholderValueWrongTypeForParamInAnnotationException, ValueNotPresentDueToConfigurationException
ComponentProvisioningException
ConverterException
org.eclipse.rdf4j.query.UnsupportedQueryLanguageException
org.eclipse.rdf4j.repository.RepositoryException
org.eclipse.rdf4j.query.MalformedQueryException
org.eclipse.rdf4j.query.QueryEvaluationException
DependencyException
RDFModelNotSetException
ProjectionRuleModelNotSet
UnassignableFeaturePathException
UnsupportedTypeInParamDefinitionException
TypeOfParamInAnnotationWrongTypeException
ConfidenceNotDoubleNumException
ConfidenceValueNotAcceptableException
ConfidenceGenericErrorException
PlaceholderValueWrongTypeForParamInAnnotationException
ValueNotPresentDueToConfigurationException
public List<SuggOntologyCoda> processAllAnnotation(boolean useSuperTypes, boolean addNodeAssignmentMap, boolean addNodeNamesInGraph) throws ComponentProvisioningException, ConverterException, org.eclipse.rdf4j.query.UnsupportedQueryLanguageException, org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException, org.eclipse.rdf4j.query.QueryEvaluationException, DependencyException, RDFModelNotSetException, ProjectionRuleModelNotSet, UnassignableFeaturePathException, UnsupportedTypeInParamDefinitionException, TypeOfParamInAnnotationWrongTypeException, ConfidenceNotDoubleNumException, ConfidenceValueNotAcceptableException, ConfidenceGenericErrorException, PlaceholderValueWrongTypeForParamInAnnotationException, ValueNotPresentDueToConfigurationException
useSuperTypes
- tells whether or not an annotation triggers a rule matching a supertype (overriding the
value passed to initialize(RepositoryConnection, boolean)
or
setUseSuperTypes(boolean)
addNodeAssignmentMap
- tells whether to add the nodeAssignmentMap to each SuggOntologyCoda or notaddNodeNamesInGraph
- tells whether to add the the nodeNameInGraph to each CODATriple in each SuggOntologyCoda
or notComponentProvisioningException
ConverterException
org.eclipse.rdf4j.query.UnsupportedQueryLanguageException
org.eclipse.rdf4j.query.MalformedQueryException
org.eclipse.rdf4j.query.QueryEvaluationException
DependencyException
RDFModelNotSetException
ProjectionRuleModelNotSet
UnassignableFeaturePathException
org.eclipse.rdf4j.repository.RepositoryException
UnsupportedTypeInParamDefinitionException
TypeOfParamInAnnotationWrongTypeException
ConfidenceNotDoubleNumException
ConfidenceValueNotAcceptableException
ConfidenceGenericErrorException
PlaceholderValueWrongTypeForParamInAnnotationException
ValueNotPresentDueToConfigurationException
public SuggOntologyCoda processNextAnnotation() throws ComponentProvisioningException, ConverterException, org.eclipse.rdf4j.query.UnsupportedQueryLanguageException, org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException, org.eclipse.rdf4j.query.QueryEvaluationException, DependencyException, RDFModelNotSetException, ProjectionRuleModelNotSet, UnassignableFeaturePathException, UnsupportedTypeInParamDefinitionException, TypeOfParamInAnnotationWrongTypeException, ConfidenceNotDoubleNumException, ConfidenceValueNotAcceptableException, ConfidenceGenericErrorException, PlaceholderValueWrongTypeForParamInAnnotationException, ValueNotPresentDueToConfigurationException
ComponentProvisioningException
ConverterException
org.eclipse.rdf4j.query.UnsupportedQueryLanguageException
org.eclipse.rdf4j.query.MalformedQueryException
org.eclipse.rdf4j.query.QueryEvaluationException
DependencyException
RDFModelNotSetException
ProjectionRuleModelNotSet
UnassignableFeaturePathException
org.eclipse.rdf4j.repository.RepositoryException
UnsupportedTypeInParamDefinitionException
TypeOfParamInAnnotationWrongTypeException
ConfidenceNotDoubleNumException
ConfidenceValueNotAcceptableException
ConfidenceGenericErrorException
PlaceholderValueWrongTypeForParamInAnnotationException
ValueNotPresentDueToConfigurationException
public SuggOntologyCoda processNextAnnotation(boolean useSuperTypes) throws ComponentProvisioningException, ConverterException, org.eclipse.rdf4j.query.UnsupportedQueryLanguageException, org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException, org.eclipse.rdf4j.query.QueryEvaluationException, DependencyException, RDFModelNotSetException, ProjectionRuleModelNotSet, UnassignableFeaturePathException, UnsupportedTypeInParamDefinitionException, TypeOfParamInAnnotationWrongTypeException, ConfidenceNotDoubleNumException, ConfidenceValueNotAcceptableException, ConfidenceGenericErrorException, PlaceholderValueWrongTypeForParamInAnnotationException, ValueNotPresentDueToConfigurationException
useSuperTypes
- tells whether or not an annotation triggers a rule matching a supertype (overriding the
value passed to initialize(RepositoryConnection, boolean)
or
setUseSuperTypes(boolean)
ComponentProvisioningException
ConverterException
org.eclipse.rdf4j.query.UnsupportedQueryLanguageException
org.eclipse.rdf4j.query.MalformedQueryException
org.eclipse.rdf4j.query.QueryEvaluationException
DependencyException
RDFModelNotSetException
ProjectionRuleModelNotSet
UnassignableFeaturePathException
org.eclipse.rdf4j.repository.RepositoryException
UnsupportedTypeInParamDefinitionException
TypeOfParamInAnnotationWrongTypeException
ConfidenceNotDoubleNumException
ConfidenceValueNotAcceptableException
ConfidenceGenericErrorException
PlaceholderValueWrongTypeForParamInAnnotationException
ValueNotPresentDueToConfigurationException
public SuggOntologyCoda processNextAnnotation(boolean addNodeAssignmentMap, boolean addNodeNamesInGraph) throws ComponentProvisioningException, ConverterException, org.eclipse.rdf4j.query.UnsupportedQueryLanguageException, org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException, org.eclipse.rdf4j.query.QueryEvaluationException, DependencyException, RDFModelNotSetException, ProjectionRuleModelNotSet, UnassignableFeaturePathException, UnsupportedTypeInParamDefinitionException, TypeOfParamInAnnotationWrongTypeException, ConfidenceNotDoubleNumException, ConfidenceValueNotAcceptableException, ConfidenceGenericErrorException, PlaceholderValueWrongTypeForParamInAnnotationException, ValueNotPresentDueToConfigurationException
ComponentProvisioningException
ConverterException
org.eclipse.rdf4j.query.UnsupportedQueryLanguageException
org.eclipse.rdf4j.repository.RepositoryException
org.eclipse.rdf4j.query.MalformedQueryException
org.eclipse.rdf4j.query.QueryEvaluationException
DependencyException
RDFModelNotSetException
ProjectionRuleModelNotSet
UnassignableFeaturePathException
UnsupportedTypeInParamDefinitionException
TypeOfParamInAnnotationWrongTypeException
ConfidenceNotDoubleNumException
ConfidenceValueNotAcceptableException
ConfidenceGenericErrorException
PlaceholderValueWrongTypeForParamInAnnotationException
ValueNotPresentDueToConfigurationException
public SuggOntologyCoda processNextAnnotation(boolean useSuperTypes, boolean addNodeAssignmentMap, boolean addNodeNamesInGraph) throws ComponentProvisioningException, ConverterException, org.eclipse.rdf4j.query.UnsupportedQueryLanguageException, org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.MalformedQueryException, org.eclipse.rdf4j.query.QueryEvaluationException, DependencyException, RDFModelNotSetException, ProjectionRuleModelNotSet, UnassignableFeaturePathException, UnsupportedTypeInParamDefinitionException, TypeOfParamInAnnotationWrongTypeException, ConfidenceNotDoubleNumException, ConfidenceValueNotAcceptableException, ConfidenceGenericErrorException, PlaceholderValueWrongTypeForParamInAnnotationException, ValueNotPresentDueToConfigurationException
useSuperTypes
- tells whether or not an annotation triggers a rule matching a supertype (overriding the
value passed to initialize(RepositoryConnection, boolean)
or
setUseSuperTypes(boolean)
ComponentProvisioningException
ConverterException
org.eclipse.rdf4j.query.UnsupportedQueryLanguageException
org.eclipse.rdf4j.query.MalformedQueryException
org.eclipse.rdf4j.query.QueryEvaluationException
DependencyException
RDFModelNotSetException
ProjectionRuleModelNotSet
UnassignableFeaturePathException
org.eclipse.rdf4j.repository.RepositoryException
UnsupportedTypeInParamDefinitionException
TypeOfParamInAnnotationWrongTypeException
ConfidenceNotDoubleNumException
ConfidenceValueNotAcceptableException
ConfidenceGenericErrorException
PlaceholderValueWrongTypeForParamInAnnotationException
ValueNotPresentDueToConfigurationException
public void executeProjectionRule(ProjectionRule pr, org.apache.uima.jcas.tcas.Annotation annotation, SuggOntologyCoda suggOntCoda, boolean addNodeNamesInGraph, boolean addNodeAssignmentMap) throws ComponentProvisioningException, ConverterException, org.eclipse.rdf4j.repository.RepositoryException, org.eclipse.rdf4j.query.QueryEvaluationException, DependencyException, UnsupportedTypeInParamDefinitionException, TypeOfParamInAnnotationWrongTypeException, ConfidenceNotDoubleNumException, ConfidenceValueNotAcceptableException, ConfidenceGenericErrorException, PlaceholderValueWrongTypeForParamInAnnotationException, ValueNotPresentDueToConfigurationException
pr
against an annotation
storing the suggestions
in the provided strucuture.pr
- annotation
- suggOntCoda
- ComponentProvisioningException
ConverterException
org.eclipse.rdf4j.query.QueryEvaluationException
DependencyException
org.eclipse.rdf4j.repository.RepositoryException
UnsupportedTypeInParamDefinitionException
TypeOfParamInAnnotationWrongTypeException
ConfidenceNotDoubleNumException
ConfidenceValueNotAcceptableException
ConfidenceGenericErrorException
PlaceholderValueWrongTypeForParamInAnnotationException
ValueNotPresentDueToConfigurationException
private boolean resolveOptionalGraph(OptionalGraphStruct optionaGraphStruct, List<CODATriple> optionalSuggestedTripleList, Map<String,SingleTableValue> row, Map<String,org.eclipse.rdf4j.model.BNode> bnodeMap, ProjectionRule pr, boolean addNodeNamesInGraph) throws UnsupportedTypeInParamDefinitionException, TypeOfParamInAnnotationWrongTypeException, ConfidenceNotDoubleNumException, ConfidenceValueNotAcceptableException, ConfidenceGenericErrorException, PlaceholderValueWrongTypeForParamInAnnotationException
private CODATriple constructCODATriple(GraphStruct graphStruct, Map<String,SingleTableValue> row, Map<String,org.eclipse.rdf4j.model.BNode> bnodeMap, String ruleId, boolean addNodeNamesInGraph) throws UnsupportedTypeInParamDefinitionException, TypeOfParamInAnnotationWrongTypeException, ConfidenceValueNotAcceptableException, ConfidenceNotDoubleNumException, ConfidenceGenericErrorException, PlaceholderValueWrongTypeForParamInAnnotationException
private Annotation checkParamValueTypeCompliant(Annotation annotation, Map<String,SingleTableValue> row, String ruleId) throws UnsupportedTypeInParamDefinitionException, ConfidenceNotDoubleNumException, PlaceholderValueWrongTypeForParamInAnnotationException, TypeOfParamInAnnotationWrongTypeException
private org.eclipse.rdf4j.model.Value getValueOfGraph(Map<String,SingleTableValue> row, GraphSingleElement graphSingleElement, Map<String,org.eclipse.rdf4j.model.BNode> bnodeMap)
private String constructWhereQuery(Collection<GraphElement> whereList, Map<String,SingleTableValue> row)
private String constructWhereOptional(OptionalGraphStruct optionaGraphStruct, Map<String,SingleTableValue> row, HashMap<String,org.eclipse.rdf4j.model.BNode> bnodeMap, int indent)
private String constructWhereQueryTriplePart(GraphStruct graphStruct, Map<String,SingleTableValue> row, HashMap<String,org.eclipse.rdf4j.model.BNode> bnodeMap)
private String constructWhereQuerySingleElemOfTriplePart(GraphSingleElement graphSingleElement, Map<String,SingleTableValue> row, HashMap<String,org.eclipse.rdf4j.model.BNode> bnodeMap)
private String getValueForWhere(org.eclipse.rdf4j.model.Value value)
private void removeDuplicate(List<CODATriple> suggestedTripleWithDuplicated, List<CODATriple> suggestedTriple)
private org.eclipse.rdf4j.model.Literal generateRDFLiteralFromGraphSingleElemLiteral(GraphSingleElemLiteral gseLiteral)
private void executeRegex(RegexProjectionRule rpr, org.apache.uima.jcas.JCas jcas, SuggOntologyCoda suggOntCoda, org.apache.uima.cas.FSIterator<org.apache.uima.jcas.tcas.Annotation> iterAnnotation, org.apache.uima.jcas.tcas.Annotation currentAnnotation, boolean useSuperTypes, boolean addNodeNamesInGraph) throws ComponentProvisioningException, ConverterException
private void executeDFSA(RegexProjectionRule rpr, StateFSA currentState, int endLastUsedAnn, boolean firstRun, org.apache.uima.cas.FSIterator<org.apache.uima.jcas.tcas.Annotation> currentIterAnnotation, org.apache.uima.jcas.tcas.Annotation currentAnnotation, boolean useSuperTypes, RegexResults regexResults, List<RegexResults> regexResultsList)
private void generateTriplesFromRegex(RegexProjectionRule rpr, RegexResults regexResults, org.apache.uima.jcas.JCas jcas, SuggOntologyCoda suggOntCoda, boolean addNodeNamesInGraph) throws ComponentProvisioningException, ConverterException
private List<CODATriple> generateTriplesFromOptionalInRegex(RegexProjectionRule rpr, OptionalGraphStruct ogs, RegexResults regexResults, boolean addNodeNamesInGraph) throws ComponentProvisioningException, ConverterException
private List<org.eclipse.rdf4j.model.Value> generateRDFNodeFromGraphSingleElementForRegex(GraphSingleElement gse, RegexProjectionRule rpr, RegexResults regexResults) throws ComponentProvisioningException, ConverterException
private void printAllRegexElements(List<RegexResults> regexResultsList)
public org.eclipse.rdf4j.model.Value executeLiteralConverter(String converter, String value, String datatype, String lang) throws ComponentProvisioningException, ConverterException
null
, it is passed as-is to the converter: it is a responsibility of the client to assure
that the converter is compatible with null
values, or to avoid the invocation of this
operation with a null
value. Either datatype
or lang
should be
not null
.converter
- a converter mention, possibly including additional argumentsvalue
- a converter mention, possibly including additional argumentsdatatype
- lang
- ComponentProvisioningException
ConverterException
public org.eclipse.rdf4j.model.Value executeLiteralConverter(ConverterMention converterMention, String datatype, String lang) throws ComponentProvisioningException, ConverterException
null
value. It is a responsibility of
the client to assure that the converter is compatible with null
values. Either
datatype
or lang
should be not null
.converterMention
- a converter mention, possibly including additional argumentsdatatype
- lang
- ComponentProvisioningException
ConverterException
public org.eclipse.rdf4j.model.Value executeLiteralConverter(ConverterMention converterMention, Object inputValue, String datatype, String lang) throws ComponentProvisioningException, ConverterException
null
, it is passed as-is to the converter: it is a responsibility of the client to assure
that the converter is compatible with null
values, or to avoid the invocation of this
operation with a null
value. Either datatype
or lang
should be
not null
.converterMention
- a converter mention, possibly including additional argumentsinputValue
- a converter mention, possibly including additional argumentsdatatype
- lang
- ComponentProvisioningException
ConverterException
public org.eclipse.rdf4j.model.Value executeURIConverter(String converter, String inputValue) throws ComponentProvisioningException, ConverterException
null
,
it is passed as-is to the converter: it is a responsibility of the client to assure that the converter
is compatible with null
values, or to avoid the invocation of this operation with a
null
value.converter
- the identifier of a converter (or an implemented contract)inputValue
- the input valueComponentProvisioningException
ConverterException
public org.eclipse.rdf4j.model.Value executeURIConverter(String converter) throws ComponentProvisioningException, ConverterException
null
value. It is a responsibility of the
client to assure that the converter is compatible with null
values.converter
- the identifier of a converter (or an implemented contract)ComponentProvisioningException
ConverterException
public org.eclipse.rdf4j.model.IRI executeURIConverter(ConverterMention converterMention) throws ComponentProvisioningException, ConverterException
null
. It is a responsibility of the client
to assure that the converter is compatible with null
values.converterMention
- a converter mention, possibly including additional argumentsComponentProvisioningException
ConverterException
public org.eclipse.rdf4j.model.IRI executeURIConverter(ConverterMention converterMention, Object inputValue) throws ComponentProvisioningException, ConverterException
null
, it is passed as-is to the converter: it is a responsibility of the client to assure that the
converter is compatible with null
values, or to avoid the invocation of this operation
with a null
value.converterMention
- a converter mention, possibly including additional argumentsinputValue
- the input valueComponentProvisioningException
ConverterException
public org.eclipse.rdf4j.model.Value executeProjectionOperator(ProjectionOperator projectionOperator, Object inputValue) throws ComponentProvisioningException, ConverterException
null
, it is passed as-is to the converter:
it is a responsibility of the client to assure that the converter is compatible with null
values, or to avoid the invocation of this operation with a null
value.projectionOperator
- a projection operator, including an node type, optional information specific to a given
type, and a list of conveter mentionsinputValue
- the input valueComponentProvisioningException
ConverterException
public org.eclipse.rdf4j.model.Value executeProjectionOperator(ProjectionOperator projectionOperator) throws ComponentProvisioningException, ConverterException
null
: it is a responsibility of the client to
assure that the converter is compatible with null
values, or to avoid the invocation of
this operation with a null
value.projectionOperator
- a projection operator, including an node type, optional information specific to a given
type, and a list of conveter mentionsComponentProvisioningException
ConverterException
public ConverterMention parseConverterMention(String textualConverterMention, Map<String,String> prefixMapping) throws PRParserException
ConverterArgumentExpression.isConstant()
); therefore, placeholders can not be
used as argument expressions. The prefix mapping should be not null
; however,
Collections.emptyMap()
can be used to create an empty map when no prefix should be used. Given
a prefixMapping, a map suitable as an argument to this
method can be obtained via PrefixMapping#getNamespacePrefixMapping()
textualConverterMention
- prefixMapping
- PRParserException
public ProjectionOperator parseProjectionOperator(String textualProjectionOperator, Map<String,String> prefixMapping) throws PRParserException
uri
or
literal
), optionally followed by node specific information (e.g. language tag or
datatype), and a list of converter mentions.
The textual projection operator can only include constant argument expressions (see
ConverterArgumentExpression.isConstant()
); therefore, placeholders can not be used as argument
expressions. The prefix mapping should be not null
; however,
Collections.emptyMap()
can be used to create an empty map when no prefix should be used. Given
a prefixMapping, a map suitable as an argument to this
method can be obtained via PrefixMapping#getNamespacePrefixMapping()
textualProjectionOperator
- prefixMapping
- PRParserException
Copyright © 2022 ART Group, University of Rome, Tor Vergata. All rights reserved.