Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove run ROBOT mesure on full ontology #135

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
67 changes: 40 additions & 27 deletions util/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,41 +342,54 @@ def load_yaml(filepath):
return data


def robot_prepare_ontology(o_path, o_out_path, o_metrics_path, base_iris, make_base, robot_prefixes={}, robot_opts="-v"):
logging.info(f"Preparing {o_path} for dashboard.")

callstring = ['robot', 'merge', '-i', o_path]

def robot_prepare_ontology(
o_path,
o_out_path,
o_metrics_path,
base_iris,
make_base,
robot_prefixes=None,
robot_opts="-v"
anitacaron marked this conversation as resolved.
Show resolved Hide resolved
):
"""
Run ROBOT mesure on the base, but generate it first if not available
"""
logging.info("Preparing %s for dashboard.", o_path)
anitacaron marked this conversation as resolved.
Show resolved Hide resolved

callstring = ["robot", "merge", "-i", o_path]

if robot_opts:
anitacaron marked this conversation as resolved.
Show resolved Hide resolved
callstring.append(f"{robot_opts}")

### Measure stuff
callstring.extend(['measure'])
for prefix in robot_prefixes:
callstring.extend(['--prefix', f"{prefix}: {robot_prefixes[prefix]}"])
callstring.extend(['--metrics', 'extended-reasoner','-f','yaml','-o',o_metrics_path])

## Extract base

if robot_prefixes is None:
robot_prefixes = {}

# Extract base if not available
if make_base:
callstring.extend(['remove'])
callstring.extend(["remove"])
for s in base_iris:
callstring.extend(['--base-iri',s])
callstring.extend(["--axioms", "external", "--trim", "false", "-p", "false"])

### Measure stuff on base
callstring.extend(['measure'])
callstring.extend(["--base-iri", s])
callstring.extend(
["--axioms", "external", "--trim", "false", "-p", "false"]
)

# Measure stuff
callstring.extend(["measure"])
for prefix in robot_prefixes:
callstring.extend(['--prefix', f"{prefix}: {robot_prefixes[prefix]}"])
callstring.extend(['--metrics', 'extended-reasoner','-f','yaml','-o',f"{o_metrics_path}.base.yml"])

## Output
callstring.extend(['merge', '--output', o_out_path])
callstring.extend(["--prefix", f"{prefix}: {robot_prefixes[prefix]}"])
callstring.extend(
["--metrics", "extended-reasoner", "-f", "yaml", "-o", o_metrics_path]
)

# Output
callstring.extend(["merge", "--output", o_out_path])
logging.info(callstring)

try:
check_call(callstring)
except Exception as e:
raise Exception(f"Preparing {o_path} for dashboard failed...", e)
except Exception:
logging.error("Preparing %s for dashboard failed...", o_path)


def count_up(dictionary, value):
if value not in dictionary:
Expand Down
Loading