[ 
https://issues.apache.org/jira/browse/JENA-280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14259251#comment-14259251
 ] 

Bruno P. Kinoshita commented on JENA-280:
-----------------------------------------

For the record, here is the code in that gist.

XML:

{noformat}
<rdf:RDF
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
    xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
    xmlns:owl="http://www.w3.org/2002/07/owl#"; >
<owl:Class rdf:about="http://dbpedia.org/class/yago/Album106591815"/>
<owl:Class 
rdf:about="http://dbpedia.org/class/yago/HostCitiesOfTheCommonwealthGames"/>
<owl:ObjectProperty rdf:about="http://dbpedia.org/property/after";>      
<rdfs:domain>
<owl:Class>
<owl:unionOf rdf:parseType="Collection">
<owl:Class rdf:about="http://dbpedia.org/class/yago/Album106591815"/>
</owl:unionOf>
</owl:Class>
</rdfs:domain>
</owl:ObjectProperty>
</rdf:RDF>
{noformat}

Full code:

{noformat}
package com.tupilabs.jena;

import java.io.StringReader;
import java.util.Iterator;

import com.hp.hpl.jena.ontology.OntClass;
import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntModelSpec;
import com.hp.hpl.jena.ontology.OntTools;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.util.iterator.ExtendedIterator;

public class Tests102 {

        public static final String SOURCE = "<?xml version=\"1.0\"?>\n"
                        + "<rdf:RDF\n"
                        + "    
xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n";
                        + "    
xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"\n";
                        + "    xmlns:owl=\"http://www.w3.org/2002/07/owl#\"; >\n"
                        + "<owl:Class 
rdf:about=\"http://dbpedia.org/class/yago/Album106591815\"/>\n"
                        + "<owl:Class 
rdf:about=\"http://dbpedia.org/class/yago/HostCitiesOfTheCommonwealthGames\"/>\n"
                        + "<owl:ObjectProperty 
rdf:about=\"http://dbpedia.org/property/after\";>      \n"
                        + "<rdfs:domain>\n"
                        + "<owl:Class>\n"
                        + "<owl:unionOf rdf:parseType=\"Collection\">\n"
                        + "<owl:Class 
rdf:about=\"http://dbpedia.org/class/yago/Album106591815\"/>\n"
                        + "</owl:unionOf>\n" + "</owl:Class>\n" + 
"</rdfs:domain>\n"
                        + "</owl:ObjectProperty>\n" + "</rdf:RDF>";

        public static void main(String[] args) {
                System.out.println(SOURCE);
                OntModel m = ModelFactory
                                
.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
                m.read(new StringReader(SOURCE), "RDF/XML");

                for (ExtendedIterator<OntClass> i = 
m.listHierarchyRootClasses(); i
                                .hasNext();) {
                        System.out.println("LHRC -> " + i.next());
                }

                OntModel base = 
ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM,
                                m.getBaseModel());
                for (Iterator<OntClass> i = OntTools.namedHierarchyRoots(base)
                                .iterator(); i.hasNext();) {
                        System.out.println("NHR -> " + i.next());
                }
        }

}
{noformat}

Looks like the behavior persists with the code in the trunk.

{noformat}
LHRC -> c38a4ee:14a8919b767:-7ffc
LHRC -> http://dbpedia.org/class/yago/HostCitiesOfTheCommonwealthGames
NHR -> http://dbpedia.org/class/yago/HostCitiesOfTheCommonwealthGames
NHR -> http://dbpedia.org/class/yago/Album106591815
{noformat}


> OntTools.nameHierarchyRoots gives wrong answer when reasoner attached
> ---------------------------------------------------------------------
>
>                 Key: JENA-280
>                 URL: https://issues.apache.org/jira/browse/JENA-280
>             Project: Apache Jena
>          Issue Type: Bug
>          Components: Ontology API
>            Reporter: Ian Dickinson
>            Assignee: Ian Dickinson
>
> See https://gist.github.com/3143188 for setup



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to