Hi Jeff,
I am afraid this is a bug in Jena. Calling Model.qnameFor() on an
OntModel will also use a default namespace from imported models -
clearly it should only use the default namespace of the first (base)
Model. I have worked around this issue in other places and need to
check what I can do to work around this bug in the SPIN API as well
(StringPrintContext.printURIResource is the culprit).
Thanks for reporting this
Holger
On Apr 6, 2009, at 1:19 PM, Schmitz, Jeffrey A wrote:
>
> Hello
>
> On a related problem when using an "instance" model that imports a
> "class" model where I have a spin:rule defined, I'm seeing some
> weirdness in the namespace prefix used in the spin:rule.
>
> When looking at it in my "class" model (Relex.owl) the query looks
> like below:
>
> CONSTRUCT {
> ?this Relex:failureRate ?rate .
> }
> WHERE {
> ?this Relex:ratio ?ratio .
> ?this Relex:refsSystem ?system .
> ?system Relex:failureRate ?sysRate .
> LET (?rate := SpinLib:ratioToRate(?ratio, ?sysRate)) .
> }
>
> However, when I look at the same query from the context of an
> "instance" model that imports Relex.owl, the spin:rule changes to
> look like below:
>
> CONSTRUCT {
> ?this Relex:failureRate ?rate .
> }
> WHERE {
> ?this Relex:ratio ?ratio .
> ?this Relex:refsSystem ?system .
> ?system Relex:failureRate ?sysRate .
> LET (?rate := :ratioToRate(?ratio, ?sysRate)) .
> }
>
> As you can see, for some reason the namespace prefix is getting
> stripped off the ratioToRate function. When I try to then run
> inferences on the instance model, I get an "Unresolved prefixed
> name: :ratioToRate" error. Any ideas on why the prefix may be
> getting stripped off like that when viewed/ran in the context of the
> instance model? FWIW, The instance ontology doesn't have a Default
> Namespace defined for it.
>
> Thanks,
> Jeff
>
>
>
>
> -----Original Message-----
> From: Scott Henninger [mailto:[email protected]]
> Sent: Friday, April 03, 2009 2:11 PM
> To: TopBraid Composer Users
> Subject: [tbc-users] Re: SPIN Inference with import
>
>
> Jeff; In Composer create a new file (does not need to be a SPIN
> file) and import spinsquare. Any instances you add will be added to
> that file, but as long as they are instances of, e.g.,
> spinsquare:Rectangle, the SPIN rules will apply.
>
> Insofar as the import statement is concerned, the below n3 file is
> missing the import comment:
> # imports: http://topbraid.org/examples/spinsquare
>
> ...also a good idea to include the base URI comment, e.g.:
> # baseURI: http://SupportQuestions.com/unnamed0
>
> -- Scott
>
> On Apr 3, 1:41 pm, Jeff <[email protected]> wrote:
>> hello,
>> Using the spinsquare.n3 model I'm able to get the rectangle area
>> inference to work correctly. However, I would like to be able to
>> create an "instance" model that imports the spinsquare model, add
>> instances of Rectangle to the instance model and get the SPIN area
>> inference to work on all the instance model rectangles by running the
>> topSPIN inferences on the instance model. Is there a way to do this?
>> I have tried but can't seem to get it to work, neither in code nor in
>> Topbraid composer. Below I've pasted my instance model in full.
>> It's
>> interesting that the namespaces for the spin models weren't created,
>> even though I did explicitly import them all.
>>
>> @prefix spinsquare: <http://topbraid.org/examples/spinsquare#> .
>> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
>> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
>> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
>> @prefix owl: <http://www.w3.org/2002/07/owl#> .
>> @prefix : <http://topbraid.org/examples/spinsquareinst#> .
>>
>> spinsquare:TestInstRectangle
>> a spinsquare:Rectangle ;
>> rdfs:label "Test rectangle"^^xsd:string ;
>> spinsquare:height 6 ;
>> spinsquare:width 8 .
>>
>> <http://topbraid.org/examples/spinsquareinst>
>> a owl:Ontology ;
>> owl:imports <http://topbraid.org/examples/spinsquare> ,
>> <http://
>> spinrdf.org/spin> , <http://spinrdf.org/sp> , <http://spinrdf.org/
>> spl> , <http://www.boeing.com/IVHM/SpinLib.owl> ;
>> owl:versionInfo "Created with TopBraid Composer"^^xsd:string .
>>
>> Thanks,
>> Jeff
>
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TopBraid Composer Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-composer-users?hl=en
-~----------~----~----~----~------~----~------~--~---