Skip to main content

Concepts API

The Concepts API allows you to manage and execute Vadalog concepts within projects. This is one of the core APIs for working with logical reasoning and data analysis.

Run Concept

Execute a concept with specified parameters. This is the main endpoint for running Vadalog logic.

HTTP Request

POST /api/v1/concepts/{workspace_id}/{project_id}/run

Parameters

ParameterTypeRequiredDescription
workspace_idstringYesThe workspace ID (in URL path)
project_idstringYesThe project ID (in URL path)
concept_namestringYesName of the concept to execute
paramsobjectNoParameters to pass to the concept
force_rerunbooleanNoForce re-execution (default: true)
persist_outputsbooleanNoPersist execution outputs (default: false)
project_scopestringNoProject scope (default: "user")
step_by_stepbooleanNoEnable step-by-step execution (default: false)
materialize_intermediate_conceptsbooleanNoMaterialize intermediate results (default: false)

cURL Example

curl -X POST "https://platform.prometheux.ai/jarvispy/my-org/my-user/api/v1/concepts/workspace_id/1921d58a6g2/run" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiJ9uMmVIoNF4TNx25UeSKF0ewTo7KtnufYyZSX9OaKsyu0" \
-d '{
"concept_name": "shortest_routes"
}'

Python Example

import requests

def run_concept(base_url, token, workspace_id, project_id, concept_name,
params=None, force_rerun=True, persist_outputs=False,
project_scope="user", step_by_step=False,
materialize_intermediate_concepts=False):
"""Execute a concept in a project."""
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}

data = {
"concept_name": concept_name,
"params": params or {},
"force_rerun": force_rerun,
"persist_outputs": persist_outputs,
"project_scope": project_scope,
"step_by_step": step_by_step,
"materialize_intermediate_concepts": materialize_intermediate_concepts
}

url = f"{base_url}/concepts/{workspace_id}/{project_id}/run"
response = requests.post(url, headers=headers, json=data)
return response.json()

# Usage
result = run_concept(
base_url,
token,
"workspace_id",
"1921d58a6g2",
"ordered_bom",
params={"limit": 100}
)
print(f"Concept executed: {result['message']}")
print(f"Results: {result['data']}")

Response

{
"data": {
"execution_id": "exec_12345",
"results": [...],
"execution_time": 1.23,
"rows_processed": 1500
},
"message": "Concept executed successfully",
"status": "success"
}

Save Concept

Save or update a concept with Vadalog logic and optional Python scripts.

HTTP Request

POST /api/v1/concepts/{workspace_id}/{project_id}/save

Parameters

ParameterTypeRequiredDescription
workspace_idstringYesThe workspace ID (in URL path)
project_idstringYesThe project ID (in URL path)
concept_logicstringYesVadalog program/annotations
scopestringNoConcept scope (default: "user")
python_scriptsobjectNoPython scripts as name->code pairs

cURL Example

curl -X POST "https://platform.prometheux.ai/jarvispy/my-org/my-user/api/v1/concepts/workspace_id/1921d58a6g2/save" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{
"concept_logic": "@input(\"products\").\n@output(\"ordered_products\").\nordered_products(Product, Price) :- products(Product, Price), Price > 100.",
"scope": "user",
"python_scripts": {
"data_processor": "def process_data(df):\n return df.sort_values(\"price\")"
}
}'

Python Example

def save_concept(base_url, token, workspace_id, project_id, concept_logic, 
scope="user", python_scripts=None):
"""Save a concept with Vadalog logic."""
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}

data = {
"concept_logic": concept_logic,
"scope": scope,
"python_scripts": python_scripts or {}
}

url = f"{base_url}/concepts/{workspace_id}/{project_id}/save"
response = requests.post(url, headers=headers, json=data)
return response.json()

# Usage
vadalog_code = """
@input("products").
@output("ordered_products").
ordered_products(Product, Price) :- products(Product, Price), Price > 100.
"""

python_scripts = {
"data_processor": "def process_data(df):\n return df.sort_values('price')"
}

result = save_concept(base_url, token, "workspace_id", "1921d58a6g2",
vadalog_code, python_scripts=python_scripts)
print(result['message'])

List Concepts

List all concepts in a project.

HTTP Request

GET /api/v1/concepts/{workspace_id}/{project_id}/list?scope=user

Parameters

ParameterTypeRequiredDescription
workspace_idstringYesThe workspace ID (in URL path)
project_idstringYesThe project ID (in URL path)
scopestringNoConcept scope (default: "user")

cURL Example

curl -X GET "https://platform.prometheux.ai/jarvispy/my-org/my-user/api/v1/concepts/workspace_id/1921d58a6g2/list?scope=user" \
-H "Authorization: Bearer YOUR_JWT_TOKEN"

Python Example

def list_concepts(base_url, token, workspace_id, project_id, scope="user"):
"""List all concepts in a project."""
headers = {"Authorization": f"Bearer {token}"}
params = {"scope": scope}

url = f"{base_url}/concepts/{workspace_id}/{project_id}/list"
response = requests.get(url, headers=headers, params=params)
return response.json()

# Usage
concepts = list_concepts(base_url, token, "workspace_id", "1921d58a6g2")
for concept in concepts['data']:
print(f"Concept: {concept['predicate_name']} ({concept['row_count']} rows)")

Cleanup Concepts

Delete concepts from a project.

HTTP Request

POST /api/v1/concepts/{workspace_id}/{project_id}/cleanup

Parameters

ParameterTypeRequiredDescription
workspace_idstringYesThe workspace ID (in URL path)
project_idstringYesThe project ID (in URL path)
scopestringNoConcept scope (default: "user")
concept_namesarrayNoSpecific concept names to delete (if not provided, deletes all)

cURL Example

curl -X POST "https://platform.prometheux.ai/jarvispy/my-org/my-user/api/v1/concepts/workspace_id/1921d58a6g2/cleanup" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{
"scope": "user",
"concept_names": ["ordered_bom", "product_analysis"]
}'

Python Example

def cleanup_concepts(base_url, token, workspace_id, project_id, 
scope="user", concept_names=None):
"""Delete concepts from a project."""
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}

data = {"scope": scope}
if concept_names:
data["concept_names"] = concept_names

url = f"{base_url}/concepts/{workspace_id}/{project_id}/cleanup"
response = requests.post(url, headers=headers, json=data)
return response.json()

# Usage
# Delete specific concepts
result = cleanup_concepts(base_url, token, "workspace_id", "1921d58a6g2",
concept_names=["ordered_bom", "product_analysis"])

# Delete all concepts
result = cleanup_concepts(base_url, token, "workspace_id", "1921d58a6g2")
print(result['message'])

Rename Concept

Rename an existing concept.

HTTP Request

POST /api/v1/concepts/{workspace_id}/{project_id}/rename

Parameters

ParameterTypeRequiredDescription
workspace_idstringYesThe workspace ID (in URL path)
project_idstringYesThe project ID (in URL path)
namestringYesCurrent concept name
new_namestringYesNew concept name
scopestringNoConcept scope (default: "user")

cURL Example

curl -X POST "https://platform.prometheux.ai/jarvispy/my-org/my-user/api/v1/concepts/workspace_id/1921d58a6g2/rename" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_JWT_TOKEN" \
-d '{
"name": "old_concept_name",
"new_name": "new_concept_name",
"scope": "user"
}'

Python Example

def rename_concept(base_url, token, workspace_id, project_id, 
old_name, new_name, scope="user"):
"""Rename a concept."""
headers = {
"Authorization": f"Bearer {token}",
"Content-Type": "application/json"
}

data = {
"name": old_name,
"new_name": new_name,
"scope": scope
}

url = f"{base_url}/concepts/{workspace_id}/{project_id}/rename"
response = requests.post(url, headers=headers, json=data)
return response.json()

# Usage
result = rename_concept(base_url, token, "workspace_id", "1921d58a6g2",
"old_concept_name", "new_concept_name")
print(result['message'])