FactEngine for Services
FactEngine for Services is a suite of DLLs (Direct Link Libraries) that can be used to execute FactEngine queries against a database separately from Boston, as in from a web services.
Operational Steps
1. Create a FactEngine object instance.
'FactEngine Connection
Public prFactEngine As New FactEngineForServices.FactEngine.Base
2. Connect to an instance of the Boston database.
'Connect to the Boston database
Dim lbBostonConnectionSuccessful = prFactEngine.OpenBostonDatabase(My.Settings.BostonDatabaseConnectionString)
3. Get the list of Models in the Boston database.
Dim larModels = FactEngineForServices.TableModel.GetModels
4. Get the Model that you want to work with:
Dim lrModel As FBM.Model
lrModel = prApplication.Models.Find(Function(x) x.Name = "University")
5. Set default FactEngine parameters for the Model:
lrModel.FactEngineUserDateTimeFormat = "DD/MM/YYYY"
lrModel.FactEngineDefaultQueryResultLimit = 100
6. Set the working Model for the FactEngine object:
prFactEngine.SetWorkingModel(lrModel)
Public prWorkingModel As FBM.Model = lrModel
7. Establish a FactEngine Query Language processor:
Public prFEQLProcessor As FactEngineForServices.FEQL.Processor
prFEQLProcessor As New FactEngineForServices.FEQL.Processor(prWorkingModel)
8. Set defaults for the FEQLProcessor object instance:
'Define the path to the English Wordnet files, for use in Natural Language transformations
prFEQLProcessor.WordNetDictionaryEnglishPath = ".\wordnet\"
9. Execute a FEQL query and return a Recordset:
Dim lrRecordset As New FactEngineForServices.ORMQL.Recordset
Dim lrFEQLTokenType As FEQL.TokenType = Nothing
Dim lrFEQLParseTree As FEQL.ParseTree = Nothing
lrRecordset = prFEQLProcessor.ProcessFEQLStatement(lsQuery, lrFEQLTokenType, lrFEQLParseTree)
10. Convert a natural language query to a FEQL (FactEngine Query Language) query:
Dim lsFEQL as String = ""
lsFEQL = Me.FEQLProcessor.PerformTransformationsOnNLQuery(lsNaturalLanguageQuery)