跳至正文
OpenAgentSkill
浏览已开放 · 目录记录日期 2026-11-21 · 自动更新和账户服务暂时关闭。
设计与 UI

fuxi-engineer

Use FuXi for various semantic web reasoning needs (RDF, RDFS, OWL, RIF, SPARQL)

OpenLinkSoftware · 已有静态检查记录

安装与使用

运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。

npx skills add OpenLinkSoftware/ai-agent-skills --skill fuxi-engineer

技能说明


name: fuxi-engineer compatibility: opencode description: Use FuXi for various semantic web reasoning needs (RDF, RDFS, OWL, RIF, SPARQL)

Use FuXi for semantic web reasoning (RDF, OWL, SPARQL)

FuXi is a Python bi-directional reasoning engine (forward/bottom-up + backward/top-down) companion to RDFLib.

What I do

  • Try steps of reasoning and generation of proofs
  • Add annotations to OWL ontologies
  • Summarizing an OWL ontology using InfixOWL API
  • Performing theorem proving services
  • Make use of QLever for SPARQL interlocution with ontologies and/or rules
  • Use robot to validate if an ontology is in the OWL 2 RL profile (and therefore can be used with DLP)
  • Use riot to convert between RDF formats

When to Use This Skill

  • When you need to interpret an OWL ontology rule file
  • When you need to answer SPARQL queries
  • When you need to add annotations to OWL ontology using InfixOWL API

Basic Principles

The best format for OWL ontologies is OWL/RDF/XML, for compatibility with ontology tools such as protege.
When verbalizing or serializing OWL for human eyes or reviewing narrative readability, the preferred syntax is Manchester OWL (OWL/RDF/XML):

from rdflib import Graph
from fuxi.cli.renderers import _render_man_owl as render_man_owl
from fuxi.Syntax.InfixOWL import all_classes, all_properties
ontology_graph = Graph().parse("ontology.owl")

for p in all_properties(ontology_graph):
    print(p.identifier, list(p.label))
    print(repr(p))
for c in all_classes(ontology_graph):
    print(c.__repr__(True))

Otherwise, turtle is the preferred format for RDF/XML if it has no rules or N3 if it does. SPARQL files should be managed in separate .rq files.

Some core RDF vocabularies to re-use whenever possible:

If there is a need to query over a large RDF dataset, have decent performance, etc., then use QLever (see QLever Documentation: Quickstart) and various examples of configuration files to see how RDF can be loaded into it and queried efficiently via its configuration file format.

Use named graphs and named graph pattern matching to take advantage of the fact that RDF graphs are excellent for logical grouping of common content in the same way that files and directories are useful for grouping content by common criteria and the naming conventions can be useful in sorting and filtering.

Installation

Use uv whenever possible (see https://github.com/uv-python/uv)

uv pip install fuxi          # or: uv pip install -e ".[dev]"

Using robot

Checking if an ontology is in the OWL 2 RL profile (or give an error otherwise):

robot validate-profile --profile RL  --input  /path/to/ontology.owl

Or that it is in OWL 2 DL:

robot validate-profile --profile DL  --input  /path/to/ontology.owl 
OWL 2 DL Profile Report: [Ontology and imports closure in profile]

CLI subcommands

CommandPurpose
fuxi.core facts.n3Forward chaining, RETE diagnostics
fuxi.proof --why='Q' facts.n3BFP query answering, proof/SIP graphs
fuxi.owl --dlp onto.ttlOWL→DLP, ontology reasoning

Common flags: --rules PATH, --output FORMAT, --ns PREFIX=URI, --why "SPARQL", --method {naive,bfp}.

Output formats: n3, nt, xml, conflict, rif, man-owl, adornment (adorned rules), pml (proof serialization), proof-graph-svg/png, rete-network-svg/png, sip-collection-svg/png.

Example of running individual OWL test as command-line:

$ fuxi.owl --method=bfp --dlp --hybrid \
           --ns eg=http://example.net/vocab# \
           --ns your=http://example.net/vocab# \
           --why "ASK { eg:bob your:isBrotherOf eg:joe }" \
           --output proof-graph-svg https://www.w3.org/2002/03owlt/inverseOf/premises001

--hybrid should be used for small, given fact graphs but not large SPARQL services. Use --ns to bind prefixes. Use --output to specify output formats (such as 'sip-collection-svg', for example)

Combining RDF/XML output from fuxi with other tools

You can convert the serialization of a proof graph to PML RDF/XML to turtle using riot:

$ fuxi.proof --method=bfp --dlp --hybrid \
             --ns eg=http://example.net/vocab# \
             --ns your=http://example.net/vocab# \
             --why "ASK { eg:bob your:isBrotherOf eg:joe }" \
             --output pml test/OWL/inverseOf/premises001.rdf | \
  JENA_HOME=/opt/apache-jena JAVA_HOME=/usr/lib/jvm/java-21-openjdk-amd64 PATH="$PATH:$JENA_HOME/bin" riot \
      --syntax=rdfxml \
      --output=turtle -

Programmatic API (canonical pipeline)

from rdflib import Graph, Namespace
from fuxi.Rete.RuleStore import setup_rule_store
from fuxi.cli.shared import _extract_goals, _compute_derived_predicates
from fuxi.SPARQL.utilities import owl_entailment_regime_graph, sparql_interlocution
from fuxi.DLP.DLNormalization import normal_form_reduction

fact_graph = Graph().parse("onto.ttl", format="turtle")
normal_form_reduction(fact_graph)
ns_binds = dict(fact_graph.namespaces())
_, _, network = setup_rule_store(make_network=True)
dlp = list(network.setup_description_logic_programming(
    fact_graph, add_pd_semantics=False, construct_network=False))
goals = _extract_goals("SELECT ?x WHERE { ... }", ns_binds)
derived_
阅读完整来源 ↗