ontocast.cli.serve
¶
OntoCast API server implementation.
This module provides a web server implementation for the OntoCast framework using Robyn. It exposes REST API endpoints for processing documents and extracting semantic triples with ontology assistance.
The server supports: - Health check endpoint (/health) - Service information endpoint (/info) - Document processing endpoint (/process) - Multiple input formats (JSON, multipart/form-data) - Streaming workflow execution - Comprehensive error handling and logging
The server integrates with the OntoCast workflow graph to process documents through the complete pipeline: chunking, ontology selection, fact extraction, and aggregation.
Example
python -m ontocast.cli.serve --env-path .env --working-directory ./work
calculate_recursion_limit(max_visits, head_chunks=None)
¶
Calculate the recursion limit based on max_visits and head_chunks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_visits
|
int
|
Maximum number of visits allowed per node |
required |
head_chunks
|
Optional[int]
|
Optional maximum number of chunks to process |
None
|
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Calculated recursion limit |
Source code in ontocast/cli/serve.py
run(env_path, ontology_directory, working_directory, input_path, head_chunks, max_visits, logging_level, clean)
¶
Main entry point for the OntoCast server/CLI. If FUSEKI_URI and FUSEKI_AUTH are set in the environment, Fuseki will be used as the triple store backend (preferred). If NEO4J_URI and NEO4J_AUTH are set in the environment, Neo4j will be used as the triple store backend (if Fuseki not available). Otherwise, the filesystem backend is used.
If --clean is set, the triple store (Neo4j or Fuseki) will be initialized as clean (all data deleted on startup).
Source code in ontocast/cli/serve.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
|