chenhuiyc
chenhuiyc

Reputation: 1

How to load axioms inferred from protege and filter them by using OWL api

I'm using a plugin for protege named DLMiner to reason hypotheses. want I want is to select these hypotheses that contain some class or relationship.

for example, there are two hypotheses:

Client SubClassOf isOwnerof some Account

Loan SubClassof isLoanOf some owl:Thing

and I want hypotheses that contain Client, so the first one should be selected. besides, there are some metrics (assumption, lift, precision,support) about each hypotheses, and I want these metrics can be also selected.

following is a sample contain two hypotheses:

<?xml version="1.0"?>
<rdf:RDF xmlns="http://owl.cs.man.ac.uk/dlminer_6020e73c-5d3e-434a-9172-924d14f4e948#"
     xml:base="http://owl.cs.man.ac.uk/dlminer_6020e73c-5d3e-434a-9172-924d14f4e948"
     xmlns:owl="http://www.w3.org/2002/07/owl#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:www="http://www.dlminer.io#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
    <owl:Ontology rdf:about="http://owl.cs.man.ac.uk/dlminer_6020e73c-5d3e-434a-9172-924d14f4e948"/>



    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Annotation properties
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->




    <!-- http://www.dlminer.io#assumption -->

    <owl:AnnotationProperty rdf:about="http://www.dlminer.io#assumption"/>



    <!-- http://www.dlminer.io#lift -->

    <owl:AnnotationProperty rdf:about="http://www.dlminer.io#lift"/>



    <!-- http://www.dlminer.io#precision -->

    <owl:AnnotationProperty rdf:about="http://www.dlminer.io#precision"/>



    <!-- http://www.dlminer.io#support -->

    <owl:AnnotationProperty rdf:about="http://www.dlminer.io#support"/>



    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Object Properties
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->




    <!-- http://www.owl-ontologies.com/unnamed.owl#hasLoan -->

    <owl:ObjectProperty rdf:about="http://www.owl-ontologies.com/unnamed.owl#hasLoan"/>



    <!-- http://www.owl-ontologies.com/unnamed.owl#hasStatementIssuanceFrequency -->

    <owl:ObjectProperty rdf:about="http://www.owl-ontologies.com/unnamed.owl#hasStatementIssuanceFrequency"/>



    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Classes
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->




    <!-- http://www.owl-ontologies.com/unnamed.owl#Account -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#Account">
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasStatementIssuanceFrequency"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#StatementIssuanceFrequencyValue"/>
            </owl:Restriction>
        </rdfs:subClassOf>
    </owl:Class>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Account"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasStatementIssuanceFrequency"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#StatementIssuanceFrequencyValue"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">3.7477272727272726</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1.0</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">2200.0</www:support>
    </owl:Axiom>



    <!-- http://www.owl-ontologies.com/unnamed.owl#Running -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#Running"/>



    <!-- http://www.owl-ontologies.com/unnamed.owl#StatementIssuanceFrequencyValue -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#StatementIssuanceFrequencyValue"/>



    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // General axioms
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->

    <owl:Axiom>
        <owl:annotatedSource>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasLoan"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Running"/>
                <rdfs:subClassOf>
                    <owl:Restriction>
                        <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasStatementIssuanceFrequency"/>
                        <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#StatementIssuanceFrequencyValue"/>
                    </owl:Restriction>
                </rdfs:subClassOf>
            </owl:Restriction>
        </owl:annotatedSource>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasStatementIssuanceFrequency"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#StatementIssuanceFrequencyValue"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">3.7477272727272726</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1.0</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">201.0</www:support>
    </owl:Axiom>
</rdf:RDF>



<!-- Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi -->

so, if the focus terms is "Account", I want the print content is:

Account SubClassOf hasStatementIssuanceFrequency some StatementIssuanceFrequencyValue Support: 2200, Assumption:0, Precision:1.

I have tried to use Jena to achieve my goal but I can just pick out the hypotheses I need by analysis the relationship between triple. however, I can't match the metrics with hypothesis, because I found that the reading order is random. I'm not sure if this is some sort of jena reading rule.

so, I wonder whether I can achieve my goal by using OWL api, I would appreciate it if you could provide me with a complete example. thx

another sample:

<?xml version="1.0"?>
<rdf:RDF xmlns="http://owl.cs.man.ac.uk/dlminer_2ff7f586-ee56-400a-89a9-936c6d890678#"
     xml:base="http://owl.cs.man.ac.uk/dlminer_2ff7f586-ee56-400a-89a9-936c6d890678"
     xmlns:owl="http://www.w3.org/2002/07/owl#"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:www="http://www.dlminer.io#"
     xmlns:xml="http://www.w3.org/XML/1998/namespace"
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
    <owl:Ontology rdf:about="http://owl.cs.man.ac.uk/dlminer_2ff7f586-ee56-400a-89a9-936c6d890678"/>



    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Annotation properties
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->




    <!-- http://www.dlminer.io#assumption -->

    <owl:AnnotationProperty rdf:about="http://www.dlminer.io#assumption"/>



    <!-- http://www.dlminer.io#lift -->

    <owl:AnnotationProperty rdf:about="http://www.dlminer.io#lift"/>



    <!-- http://www.dlminer.io#precision -->

    <owl:AnnotationProperty rdf:about="http://www.dlminer.io#precision"/>



    <!-- http://www.dlminer.io#support -->

    <owl:AnnotationProperty rdf:about="http://www.dlminer.io#support"/>



    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Object Properties
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->




    <!-- http://www.owl-ontologies.com/unnamed.owl#IsLoanOf -->

    <owl:ObjectProperty rdf:about="http://www.owl-ontologies.com/unnamed.owl#IsLoanOf"/>



    <!-- http://www.owl-ontologies.com/unnamed.owl#hasLoanStatusValue -->

    <owl:ObjectProperty rdf:about="http://www.owl-ontologies.com/unnamed.owl#hasLoanStatusValue"/>



    <!-- http://www.owl-ontologies.com/unnamed.owl#hasStatementIssuanceFrequency -->

    <owl:ObjectProperty rdf:about="http://www.owl-ontologies.com/unnamed.owl#hasStatementIssuanceFrequency"/>



    <!-- http://www.owl-ontologies.com/unnamed.owl#isCreditCardOf -->

    <owl:ObjectProperty rdf:about="http://www.owl-ontologies.com/unnamed.owl#isCreditCardOf"/>



    <!-- http://www.owl-ontologies.com/unnamed.owl#isOwnerOf -->

    <owl:ObjectProperty rdf:about="http://www.owl-ontologies.com/unnamed.owl#isOwnerOf"/>



    <!-- 
    ///////////////////////////////////////////////////////////////////////////////////////
    //
    // Classes
    //
    ///////////////////////////////////////////////////////////////////////////////////////
     -->




    <!-- http://www.owl-ontologies.com/unnamed.owl#Account -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#Account">
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasStatementIssuanceFrequency"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#StatementIssuanceFrequencyValue"/>
            </owl:Restriction>
        </rdfs:subClassOf>
    </owl:Class>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Account"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasStatementIssuanceFrequency"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#StatementIssuanceFrequencyValue"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">3.7477272727272726</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1.0</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">2200.0</www:support>
    </owl:Axiom>



    <!-- http://www.owl-ontologies.com/unnamed.owl#Classic -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#Classic">
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#isCreditCardOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </rdfs:subClassOf>
    </owl:Class>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Classic"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#isCreditCardOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">19.67780429594272</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1.0</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">302.0</www:support>
    </owl:Axiom>



    <!-- http://www.owl-ontologies.com/unnamed.owl#Client -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#Client">
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#isOwnerOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </rdfs:subClassOf>
    </owl:Class>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Client"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#isOwnerOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">15.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">3.7223476297968396</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.9932279909706546</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">2200.0</www:support>
    </owl:Axiom>



    <!-- http://www.owl-ontologies.com/unnamed.owl#CreditCard -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#CreditCard">
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#isCreditCardOf"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Client"/>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#isCreditCardOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </rdfs:subClassOf>
    </owl:Class>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#CreditCard"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#isCreditCardOf"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Client"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">19.67780429594272</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1.0</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">419.0</www:support>
    </owl:Axiom>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#CreditCard"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#isCreditCardOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">19.67780429594272</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1.0</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">419.0</www:support>
    </owl:Axiom>



    <!-- http://www.owl-ontologies.com/unnamed.owl#Loan -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#Loan">
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#IsLoanOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </rdfs:subClassOf>
    </owl:Class>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Loan"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#IsLoanOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">28.139931740614337</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1.0</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">293.0</www:support>
    </owl:Axiom>



    <!-- http://www.owl-ontologies.com/unnamed.owl#LoanStatusValue -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#LoanStatusValue"/>



    <!-- http://www.owl-ontologies.com/unnamed.owl#OKRunningLoan -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#OKRunningLoan">
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#IsLoanOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasLoanStatusValue"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#LoanStatusValue"/>
            </owl:Restriction>
        </rdfs:subClassOf>
    </owl:Class>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#OKRunningLoan"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#IsLoanOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">28.139931740614337</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1.0</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">182.0</www:support>
    </owl:Axiom>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#OKRunningLoan"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasLoanStatusValue"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#LoanStatusValue"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">28.139931740614337</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1.0</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">182.0</www:support>
    </owl:Axiom>



    <!-- http://www.owl-ontologies.com/unnamed.owl#OKStatus -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#OKStatus"/>



    <!-- http://www.owl-ontologies.com/unnamed.owl#Running -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#Running">
        <rdfs:subClassOf rdf:resource="http://www.owl-ontologies.com/unnamed.owl#OKRunningLoan"/>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#IsLoanOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasLoanStatusValue"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#OKStatus"/>
            </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasLoanStatusValue"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </rdfs:subClassOf>
    </owl:Class>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Running"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget rdf:resource="http://www.owl-ontologies.com/unnamed.owl#OKRunningLoan"/>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">19.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">41.01990049751244</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.9054726368159204</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">182.0</www:support>
    </owl:Axiom>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Running"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#IsLoanOf"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">28.139931740614337</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1.0</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">201.0</www:support>
    </owl:Axiom>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Running"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasLoanStatusValue"/>
                <owl:someValuesFrom rdf:resource="http://www.owl-ontologies.com/unnamed.owl#OKStatus"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">19.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">28.494740040256733</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.9054726368159204</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">182.0</www:support>
    </owl:Axiom>
    <owl:Axiom>
        <owl:annotatedSource rdf:resource="http://www.owl-ontologies.com/unnamed.owl#Running"/>
        <owl:annotatedProperty rdf:resource="http://www.w3.org/2000/01/rdf-schema#subClassOf"/>
        <owl:annotatedTarget>
            <owl:Restriction>
                <owl:onProperty rdf:resource="http://www.owl-ontologies.com/unnamed.owl#hasLoanStatusValue"/>
                <owl:someValuesFrom rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
            </owl:Restriction>
        </owl:annotatedTarget>
        <www:assumption rdf:datatype="http://www.w3.org/2001/XMLSchema#double">0.0</www:assumption>
        <www:lift rdf:datatype="http://www.w3.org/2001/XMLSchema#double">28.139931740614337</www:lift>
        <www:precision rdf:datatype="http://www.w3.org/2001/XMLSchema#double">1.0</www:precision>
        <www:support rdf:datatype="http://www.w3.org/2001/XMLSchema#double">201.0</www:support>
    </owl:Axiom>



    <!-- http://www.owl-ontologies.com/unnamed.owl#StatementIssuanceFrequencyValue -->

    <owl:Class rdf:about="http://www.owl-ontologies.com/unnamed.owl#StatementIssuanceFrequencyValue"/>
</rdf:RDF>



<!-- Generated by the OWL API (version 4.5.9.2019-02-01T07:24:44Z) https://github.com/owlcs/owlapi -->


Upvotes: 0

Views: 311

Answers (1)

ssz
ssz

Reputation: 835

Using OWL-API(v5.1.11) and ManchesterOWLSyntaxOWLObjectRendererImpl from owlapi-parsers, the following way is working for me:

        OWLOntologyManager m = OntManagers.createOWL();
        OWLOntology o = m.loadOntologyFromOntologyDocument(data);
        OWLClass c = m.getOWLDataFactory().getOWLClass("http://www.owl-ontologies.com/unnamed.owl#Account");
        OWLAxiom a = o.axioms(c)
                .filter(x -> AxiomType.SUBCLASS_OF.equals(x.getAxiomType()))
                .sorted() // to have the same order every time
                .findFirst()
                .orElseThrow(AssertionError::new);
        OWLObjectRenderer r = new ManchesterOWLSyntaxOWLObjectRendererImpl();
        String res = r.render(a) + " " + a.annotations()
                .map(x -> x.getProperty().getIRI().getShortForm() + ": " +
                        x.getValue().asLiteral().orElseThrow(AssertionError::new).parseDouble())
                .collect(Collectors.joining(", "));
        System.out.println(res);

The output:

Account SubClassOf hasStatementIssuanceFrequency some StatementIssuanceFrequencyValue assumption: 0.0, lift: 3.7477272727272726, precision: 1.0, support: 2200.0

Note that ManchesterOWLSyntaxOWLObjectRendererImpl is not part of public interfaces, and therefore may be changed, so it is better to write your own OWLObjectRenderer or another way to make String representation of desired axiom.

Upvotes: 1

Related Questions