【问题标题】:Extract a representative subset of an xml file for parser testing提取 xml 文件的代表性子集以进行解析器测试
【发布时间】:2015-12-11 13:03:10
【问题描述】:

我有一个相当长的 xml/rdf/owl 文件,我需要将其解析为一组我正在使用的字典。为了能够在将来对我的解析器进行单元测试,我需要提取 xml 文件的代表性子集,而不会破坏 xml/rdf/owl 堆栈语法。

有没有比手动从真实解析文件中复制元素更好的方法?

【问题讨论】:

    标签: xml rdf owl


    【解决方案1】:

    使用 Protégé 编辑器的解决方案 1

    您可以使用Protégé Refactor -> Copy/move/delete axioms... 菜单项选择子集并将其导出到新文件。

    使用 Pellet 推理器的解决方案 2

    您可以使用Pellet reasoner 的提取功能。这允许您根据断言的类型提取子集。

    PelletExtractInferences: Extract a set of inferences from an ontology
    
    Usage: pellet extract [options] <file URI>...
    
    Argument description:
    
    --help, -h 
         Print this message 
    
    --verbose, -v 
         Print full stack trace for errors. 
    
    --config, -C (configuration file) 
         Use the selected configuration file 
    
    --statements, -s (Space separated list surrounded by quotes) 
         Statements to extract. The option accepts all axioms of the OWL functional 
         syntax plus some additional ones. Valid arguments are: [DefaultStatements, 
         AllClass, AllIndividual, AllProperty, AllStatements, 
         AllStatementsIncludingJena, ClassAssertion, ComplementOf, 
         DataPropertyAssertion, DifferentIndividuals, DirectClassAssertion, 
         DirectSubClassOf, DirectSubPropertyOf, DisjointClasses, 
         DisjointProperties, EquivalentClasses, EquivalentProperties, 
         InverseProperties, ObjectPropertyAssertion, PropertyAssertion, 
         SameIndividual, SubClassOf, SubPropertyOf]. Example: "DirectSubClassOf 
         DirectSubPropertyOf" (Default: DefaultStatements) 
    
    --loader, -l (Jena | OWLAPI | OWLAPIv3 | KRSS) 
         Use Jena, OWLAPI, OWLAPIv3 or KRSS to load the ontology (Default: 
         OWLAPIv3) 
    
    --ignore-imports 
         Ignore imported ontologies 
    
    --input-format (RDF/XML | Turtle | N-Triples) 
         Format of the input file (valid only for the Jena loader). Default 
         behaviour is to guess the input format based on the file extension. 
    

    【讨论】:

    • 听起来不错,在哪里可以找到文档和使用示例?
    • Protégé 的使用相当直观。 Pellet 的使用需要一些命令行操作。运行pellet help 获取帮助。询问您是否遇到问题。
    • 好的,首先,如何安装颗粒?
    • 我以前用过 protege,但我不知道他们添加了子集提取。这实际上是一件非常好的事情,谢谢。
    • 我认为,最好提出一个新问题,详细说明这个问题。
    猜你喜欢
    • 1970-01-01
    • 2011-10-23
    • 2023-03-17
    • 2019-06-20
    • 1970-01-01
    • 2019-06-05
    • 1970-01-01
    • 1970-01-01
    • 2021-01-26
    相关资源
    最近更新 更多