On 12/12/13 20:02, Diogo FC Patrao wrote:
Hi Andy.

Thanks for clarifying the whole process. What I was originally trying to do
was to load recruit.owl, which includes recruit_cid10.owl and a couple of
others.

So, when I loaded recruit.owl directly by ja:externalContent, and specified
the other ontologies location on the document mapper, it worked.

Another detail: when the file specified is not found, the error raised is
the same as when there's no document mapper defined, so that was
misleading. Below's the working assembler file, for the record.

But one more question: can document map handle a mapping like, all URIs
starting by http://etc.com/tada/.* can be found in file:/tmp/.* ?

Try lm:prefix / lm:altPrefix

Only exact and prefix mapping is provided, not regex/replace.

        Andy


---

@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .

@prefix dm:         <http://jena.hpl.hp.com/schemas/2003/03/ont-manager#> .
@prefix lm:         <http://jena.hpl.hp.com/2004/08/location-mapping#> .

[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
tdb:GraphTDB rdfs:subClassOf ja:Model .

<#dataset> rdf:type ja:RDFDataset ;
        ja:defaultGraph <#infModel>;
.

<#mapper>
#
# WON'T WORK => SPECIFY THE FULL FILE URI, WITH FILE: AND
#
#          lm:mapping [ lm:name "
http://cipe.accamargo.org.br/ontologias/recruit_2.owl"; ; lm:altName
"./recruit_2.owl" ];


# this maps one uri to one file
           lm:mapping [ lm:name "
http://cipe.accamargo.org.br/ontologias/recruit_2.owl"; ; lm:altName
"file:/home/users/djogo/Desktop/teste_document_manager_jena/recruit_2.owl"
];

.

<#document-manager-example> a ja:DocumentManager;
         ja:fileManager [ ja:locationMapper <#mapper> ];
.


<#myOntModelSpec> a ja:OWL_MEM_MICRO_RULE_INF;
         ja:documentManager <#document-manager-example>;
.

<#infModel> a ja:OntModel ;
         ja:ontModelSpec <#myOntModelSpec>;
         ja:baseModel [a ja:MemoryModel;
#
# the first ontology must be loaded by externalContent
#
                 ja:content [ ja:externalContent
<file:/home/users/djogo/Desktop/teste_document_manager_jena/recruit.owl> ];
         ]
.


--
diogo patrão




On Thu, Dec 12, 2013 at 3:59 PM, Andy Seaborne <[email protected]> wrote:

What I think is happening is the following:


<#infModel> a ja:OntModel ;
          ja:ontModelSpec <#myOntModelSpec>;
           ja:baseModel [a ja:MemoryModel;
                  ja:content [ ja:externalContent <
http://cipe.accamargo.org.br/ontologias/recruit_cid10.owl> ];
          ] .

To create this, the assembler engine has to:

1/ Create the base model, including the content
2/ Create the ontModelSpec
3/ join the two together in an OntModel.

1 and 2 can happen in either order in theory.

The code happens to do:

         Model baseModel = getBase( a, root, mode );
         OntModelSpec oms = getOntModelSpec( a, root );


The ontModelSpec filemanger will not be active for the ja:externalContent.
  It's part of the ontModelSpec so it applies to everything the base mode
refers to but not to the base model itself.

What you can do about it:

Simple solution:
Name the file directly in ja:externalContent

(I don't think an assembler can set the idea of a global FileManager from
within the assembler description itself.

         Andy


On 11/12/13 12:39, Diogo FC Patrao wrote:

Hello

Any news on that?

All help would be appreciated.

Thanks!



--
diogo patrão




On Mon, Dec 9, 2013 at 11:29 AM, Diogo FC Patrao <[email protected]
wrote:

  My bad. Now I tried:

<#myOntModelSpec> a ja:OWL_MEM_MICRO_RULE_INF;
          ja:documentManager <#document-manager-example>;
.

<#infModel> a ja:OntModel ;
          ja:ontModelSpec <#myOntModelSpec>;
           ja:baseModel [a ja:MemoryModel;
                  ja:content [ ja:externalContent <
http://cipe.accamargo.org.br/ontologias/recruit_cid10.owl> ];
          ] .


and still got the error:

djogo@crimson:~/teste_fuseki/jena-fuseki-1.0.0$ ./fuseki-server
--desc=../my_config.ttl /ds
11:28:04 INFO  Server               :: Dataset from assembler
com.hp.hpl.jena.assembler.exceptions.AssemblerException: caught:
java.net.UnknownHostException: cipe.accamargo.org.br
    doing:
      root: 55bafed85fe34e81fe9d0930aede4ade with type:
http://jena.hpl.hp.com/2005/11/Assembler#ContentItem assembler class:
class com.hp.hpl.jena.assembler.assemblers.ContentAssembler
      root: ba019b2:142d78b0f45:-7ffd with type:
http://jena.hpl.hp.com/2005/11/Assembler#Content assembler class: class
com.hp.hpl.jena.assembler.assemblers.ContentAssembler
      root: 5f99eb18ae66b9b5486fa2179904d207 with type:
http://jena.hpl.hp.com/2005/11/Assembler#MemoryModel assembler class:
class com.hp.hpl.jena.assembler.assemblers.MemoryModelAssembler
      root: file:///home/users/djogo/teste_fuseki/my_config.ttl#infModel
with type: http://jena.hpl.hp.com/2005/11/Assembler#OntModel assembler
class: class com.hp.hpl.jena.assembler.assemblers.OntModelAssembler
      root: file:///home/users/djogo/teste_fuseki/my_config.ttl#dataset
with
type: http://jena.hpl.hp.com/2005/11/Assembler#RDFDataset assembler
class: class com.hp.hpl.jena.sparql.core.assembler.DatasetAssembler

at
com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$PlainAssemblerGroup.
openBySpecificType(AssemblerGroup.java:138)
   at
com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$
PlainAssemblerGroup.open(AssemblerGroup.java:117)
at
com.hp.hpl.jena.assembler.assemblers.AssemblerGroup$
ExpandingAssemblerGroup.open(AssemblerGroup.java:81)
   at
com.hp.hpl.jena.assembler.assemblers.AssemblerBase.open(
AssemblerBase.java:52)





--
diogo patrão




On Fri, Dec 6, 2013 at 6:50 PM, Andy Seaborne <[email protected]> wrote:

  On 06/12/13 19:16, Diogo FC Patrao wrote:

  <#infModel> a ja:OntModel ;
          ja:ontModelSpec ja:OWL_MEM_MICRO_RULE_INF;
          ja:baseModel [a ja:MemoryModel;
                   ja:content [ ja:externalContent <
http://cipe.accamargo.org.br/ontologias/recruit_cid10.owl> ];
] .


This isn't connected to the <#myOntModelSpec> and hence not to the
location mapper.

          Andy








Reply via email to