Hello Holger,
thanks for your quick response. I have downloaded the new API and it works
just fine. But i have another question.
How can  i insert a SPIN constraint dynamically in my ontology ? I have
tried the following:
I create a constraint, just like in the examples with:

...
String query = prefixes +
"CONSTRUCT { _:b0 bad:deviceIngressProtection ?value;" +
" rdfs:label 'the value should be between 20 an 30'} " +
"WHERE { ?dev rdf:type bad:Device ; bad:deviceIngressProtection ?value ." +
" FILTER ( ?value < 20 || ?value > 30) " +
"}";

Query arqQuery = ARQFactory.get().createQuery(model, query);
ARQ2SPIN arq2SPIN = new ARQ2SPIN(model);
Construct spinQuery = (Construct) arq2SPIN.createQuery(arqQuery, null);

//then i load my Onotology

File root = new File("ontologies");
String  dataURL = new File(root.getAbsolutePath() +
"/Thermokon_Easysens_Funkschalter_BJ_V1.owl").toURI().toString();
Reasoner reasoner = PelletReasonerFactory.theInstance().create();

 // create an empty model
   OntModel ontModel = ModelFactory.createOntologyModel(
PelletReasonerFactory.THE_SPEC );
   ontModel.read( dataURL );

//add the   model with the Constraint
ontModel.addl(model);
SPINModuleRegistry.get().registerAll(ontModel);

// let SPIN do its work
List<ConstraintViolation> cvs = SPINConstraints.check(ontModel, null);
System.out.println("Constraint violations:" + cvs.size());
for(ConstraintViolation cv : cvs) {
System.out.println(" - at " + SPINLabels.get().getLabel(cv.getRoot()) + ": "
+ cv.getRoot());
}


the Problem is that i don“t get any constrains violation  (cvs = 0).
Although when i run the query with ARQ I get 1. Could you tell me please
wich is the wright way to do this ? . Is it a problem, that the is Ontology
in rdf ?

Regards,
Rodolfo




2010/10/6 Holger Knublauch <[email protected]>:
> Hi Rodolfo,
>
> thanks a lot for this bug report. It was indeed a (simple) recursive loop.
Since this was a small but rather critical bug, I have just updated the SPIN
API that is on the web with a fix. The file has still the same version
number etc, but the infinite loop should be gone now. I plan to do a proper
release with a couple of new features in a few weeks after it went through
QA.
>
> Thanks again
> Holger
>
>
> On Oct 6, 2010, at 4:28 AM, [email protected] wrote:
>
>> Hello everyone,
>> I just downloaded the implementation of the SPIN API 1.1.2 and  when
>> i run the example KennedysInferencingAndConstraintsExample i get an
>> StackOverflowError. I haven't changed anything in the source and i
>> think the problem is in this piece of code:
>>
>> ...
>> // Run constraints on a single instance only
>>               Resource person = cvs.get(0).getRoot();
>>               List<ConstraintViolation> localCVS =
SPINConstraints.check(person,
>> null);
>>               System.out.println("Constraint violations for " +
>> SPINLabels.get().getLabel(person) + ": " + localCVS.size());
>>
>> i am using jena 2.6.3 and ARQ  2.8.5. I would be very thankful for any
>> help.
>>
>> Regards
>> Rodolfo
>>
>> Console output:
>>
>> Inferred triples: 136
>> Constraint violations:
>> - at spin:AskTemplates:
>> - at spin:UpdateTemplates:
>> - at spin:SelectTemplates:
>> - at spin:ConstructTemplates:
>> - at kennedys:JosephKennedy: age must be within a realistic range
>> - at kennedys:StephenSmith: Same-sex marriage not permitted (in this
>> model)
>> - at kennedys:JeanKennedy: Same-sex marriage not permitted (in this
>> model)
>> Exception in thread "main" java.lang.StackOverflowError
>>       at
>> org.topbraid.spin.constraints.SPINConstraints.check(SPINConstraints.java:
>> 259)
>>       at
>> org.topbraid.spin.constraints.SPINConstraints.check(SPINConstraints.java:
>> 259)
>> ....
>>
>> --
>> You received this message because you are subscribed to the Google
>> Group "TopBraid Suite Users", the topics of which include TopBraid
Composer,
>> TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
>> To post to this group, send email to
>> [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]<topbraid-users%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/topbraid-users?hl=en
>
> --
> You received this message because you are subscribed to the Google
> Group "TopBraid Suite Users", the topics of which include TopBraid
Composer,
> TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
> To post to this group, send email to
> [email protected]
> To unsubscribe from this group, send email to
> [email protected]<topbraid-users%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/topbraid-users?hl=en
>

-- 
You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion and SPIN.
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-users?hl=en

Reply via email to