You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by barkat abdelbasset <ba...@gmail.com> on 2011/03/26 03:25:58 UTC

Fwd: help

Hi
I want to ask about
        OntModel model =
ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
         model.read
why model.read necessite internet connection
thank you
-- 
B A ELBASSET

Re: Fwd: help

Posted by barkat abdelbasset <ba...@gmail.com>.
this is the all source
 String path = new File("").getAbsolutePath();
        String monontologie = ("file:" + path + "/pizza.owl");
        OntModel model =
ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
        InputStream reader = FileManager.get().open("file:" + path +
"/pizza.owl");
        if (reader == null) {
            throw new IllegalArgumentException("File: " + monontologie + "
not found");
        }
        model.read(reader,"file:" + path + "/pizza.owl","");
        Iterator<OntClass> i =
model.listHierarchyRootClasses().filterDrop(new Filter<OntClass>() {

            @Override
            public boolean accept(OntClass r) {
                return r.isAnon();
            }
        });
thank you

On Sat, Mar 26, 2011 at 11:48 AM, Ian Dickinson <ia...@epimorphics.com> wrote:

> Hello barkat,
>
>
> On 26/03/11 02:25, barkat abdelbasset wrote:
>
>> Hi
>> I want to ask about
>>         OntModel model =
>> ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
>>          model.read
>> why model.read necessite internet connection
>>
>
> I'm going to have to take a guess here, since you don't really provide
> enough information, but there are two possibilities. First, if you call
> something like:
>
> model.read( "http://example.com/ontology/foo" );
>
> then an HTTP get will be needed to retrieve the document from that URL.
>
> Second possibility is that your ontology is being read from local disk,
> hence not requiring Internet access, but the ontology has one or more
> imported ontologies. E.g:
>
> <owl:Ontology rdf:about="">
>  <owl:imports rdf:resource="http://example.com/ontology/foo" />
> </owl:Ontology>
>
> In this case, if you do not want the imported documents to be read
> automatically, set the import-documents flag to false:
>
>    model.getDocumentManager().setProcessImports( false );
>
> before you call model.read().
>
> If neither of these explanations are helpful, you'll need to provide more
> information about your problem.
>
> Ian
>
>
> --
> ____________________________________________________________
> Ian Dickinson                   Epimorphics Ltd, Bristol, UK
> mailto:ian@epimorphics.com        http://www.epimorphics.com
> cell: +44-7786-850536              landline: +44-1275-399069
> ------------------------------------------------------------
> Epimorphics Ltd.  is a limited company registered in England
> (no. 7016688). Registered address: Court Lodge, 105 High St,
>              Portishead, Bristol BS20 6PT, UK
>
>


-- 
B A ELBASSET

Re: Fwd: help

Posted by Ian Dickinson <ia...@epimorphics.com>.
Hello barkat,

On 26/03/11 02:25, barkat abdelbasset wrote:
> Hi
> I want to ask about
>          OntModel model =
> ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM);
>           model.read
> why model.read necessite internet connection

I'm going to have to take a guess here, since you don't really provide 
enough information, but there are two possibilities. First, if you call 
something like:

model.read( "http://example.com/ontology/foo" );

then an HTTP get will be needed to retrieve the document from that URL.

Second possibility is that your ontology is being read from local disk, 
hence not requiring Internet access, but the ontology has one or more 
imported ontologies. E.g:

<owl:Ontology rdf:about="">
   <owl:imports rdf:resource="http://example.com/ontology/foo" />
</owl:Ontology>

In this case, if you do not want the imported documents to be read 
automatically, set the import-documents flag to false:

     model.getDocumentManager().setProcessImports( false );

before you call model.read().

If neither of these explanations are helpful, you'll need to provide 
more information about your problem.

Ian


-- 
____________________________________________________________
Ian Dickinson                   Epimorphics Ltd, Bristol, UK
mailto:ian@epimorphics.com        http://www.epimorphics.com
cell: +44-7786-850536              landline: +44-1275-399069
------------------------------------------------------------
Epimorphics Ltd.  is a limited company registered in England
(no. 7016688). Registered address: Court Lodge, 105 High St,
               Portishead, Bristol BS20 6PT, UK