Hey Holger,

thanks! Now it works. I'm still struggling to understand the problem you 
are explaining, but however, I need to have a closer look on that.

Thanks again.
Simon

Am Freitag, 29. Mai 2015 08:51:23 UTC+2 schrieb Holger Knublauch:
>
> I have changed your function so that it no longer relies on ?this, but 
> instead takes it as an argument. (I should have never allowed this 
> convention to have an implicit binding). I believe is has the side effect 
> that Jena (when executed outside of TBC) applies some FILTER reordering 
> because it doesn't believe it depends on ?this, and then executes your 
> function with ?this unbound. Attached is a version that works for me.
>
> Holger
>
>
> On 5/28/2015 20:28, Simon Schlosser wrote:
>  
> Hi Holger, 
>
>  please find attached a .ttl that can be directly imported into TBC where 
> it shows the correct behavior (e.g. delete the legal form property and a 
> violation is shown otherwise not). And second, a small Java app using the 
> Spin API where violations are identified, although the property exists.
>
>  Best,
> Simon
>
> Am Donnerstag, 28. Mai 2015 02:10:15 UTC+2 schrieb Holger Knublauch: 
>
> Hi Simon,
>
> so do you have it running OK within TBC, and the problem is only in the 
> SPIN API? Or does it work in neither. Sorry, but I'd need minimal complete 
> files that I could run within TBC to help further. You have pasted various 
> snippets - can you turn them into attachments that I can open with TBC?
>
> Thanks
> Holger
>
>
> On 5/28/2015 8:06, Simon Schlosser wrote:
>  
> Hmm.. unfortunately the problem is not really solved! The system functions 
> were seemingly not the problem as I wrote above.  
>
> Adding a second instance e.g. 
>   <http://corporate-data-league.ch/metadata/BP_2> 
> <http://corporate-data-league.ch/metadata/BP_2>
>         a       
> <http://corporate-data-league.ch/metadata/Category-3ABusiness_Partner> 
> <http://corporate-data-league.ch/metadata/Category-3ABusiness_Partner> ;
>         <http://corporate-data-league.ch/metadata/Property-3ALegal_form> 
> <http://corporate-data-league.ch/metadata/Property-3ALegal_form>
>                  
> <http://corporate-data-league.ch/metadata/Aktiengesellschaft> 
> <http://corporate-data-league.ch/metadata/Aktiengesellschaft> .
>  
> to the already existing <metadata/1236> (the legal form property is 
> uncommented) leads again to the not expected behavior. For both, the 
> property does exist (=there is no violation) but the output is 
>
>   Inferred triples: 0
> Validating provided data ... 
> All constraint violations:
>  - at <http://corporate-data-league.ch/metadata/BP_2> 
> <http://corporate-data-league.ch/metadata/BP_2>: Business Partner has no 
> legal form
>  - at <http://corporate-data-league.ch/metadata/1236> 
> <http://corporate-data-league.ch/metadata/1236>: Business Partner has no 
> legal form
>  
> I have no idea why the second "instance" causes this problem. Any ideas?
>
> Thanks,
> Simon
>
>
> Am Mittwoch, 27. Mai 2015 22:46:58 UTC+2 schrieb Simon Schlosser: 
>
> Hi Holger, 
>
>  danke! You're making a great job!
>
>  It seems the problem were the missing system functions. Using a 
> MultiUnion made it run in a minimalistic example. I document it below as 
> I've not found such an example already. Hopefully, it helps somebody in 
> future.
>
>  However, in my real project it does not work yet. But knowing that it 
> should run does definitely help me... need to check it in detail. 
>
>  All the best,
> Simon
>
>   public class InvestigateCardinalityFunction
> {
>     static long pre;
>     static long post;
>
>      public static void main(String[] args)
>     {
>         pre = System.currentTimeMillis();
>
>          // Register system functions (such as sp:gt (>))
>         SPINModuleRegistry.get().init();
>
>          // Add business rules
>         Model myModel = ModelFactory.createDefaultModel();
>         myModel.read("data/instanceWithConstraintAndFunction.ttl", 
> FileUtils.langTurtle);
>
>          // Create Model for the base graph with its imports
>         MultiUnion union = new MultiUnion(new Graph[] {
>                 myModel.getGraph(),
>                 SPL.getModel().getGraph(),
>                 SPIN.getModel().getGraph(),
>                 SP.getModel().getGraph()
>         });
>         Model unionModel = ModelFactory.createModelForGraph(union);
>
>          // Create OntModel with imports
>         OntModel ontModel = 
> JenaUtil.createOntologyModel(OntModelSpec.OWL_MEM, unionModel);
>
>          // Add empty model for storing inferences
>         Model newTriples = ModelFactory.createDefaultModel();
>         ontModel.addSubModel(newTriples);
>
>          // Run all inferences
>         SPINInferences.run(ontModel, newTriples, null, null, false, null);
>         System.out.println("Inferred triples: " + newTriples.size());
>
>          // Register locally defined functions
>         SPINModuleRegistry.get().registerAll(ontModel, null);
>
>          System.out.println("Validating provided data ... ");
>         List<ConstraintViolation> cvs = SPINConstraints.check(unionModel, 
> null);
>
>          System.out.println("All constraint violations:");
>         for (ConstraintViolation cv : cvs)
>         {
>             System.out.println(" - at " + 
> SPINLabels.get().getLabel(cv.getRoot()) + ": " + cv.getMessage());
>         }
>
>          post = System.currentTimeMillis();
>         System.out.println("Time needed: " + ((post - pre) / 1000) + " 
> sec");
>
>      }
>
>  }
>
>   
>  @prefix owl: <http://www.w3.org/2002/07/owl#> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix sp: <http://spinrdf.org/sp#> .
> @prefix spin: <http://spinrdf.org/spin#> .
> @prefix spl: <http://spinrdf.org/spl#> .
> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
>
>  
>  <http://corporate-data-league.ch/metadata>
>   spin:imports <http://spinrdf.org/spin>  .
>
>  <http://corporate-data-league.ch/metadata/1236>
>         a       <
> http://corporate-data-league.ch/metadata/Category-3ABusiness_Partner> ;
>         <http://corporate-data-league.ch/metadata/Property-3AAddress>
>                 <http://corporate-data-league.ch/metadata/ADDR1_ID> ;
>         <
> http://corporate-data-league.ch/metadata/Property-3ABusiness_partner_name>
>                 <
> http://corporate-data-league.ch/metadata/Simon_Schlosser_Test_AG> .
>                 
>  # If comment is not removed a constraint violation should be found       
>         
>  #       <http://corporate-data-league.ch/metadata/Property-3ALegal_form>
>  #               <
> http://corporate-data-league.ch/metadata/Aktiengesellschaft> .
>  
>                    
> <http://corporate-data-league.ch/metadata/ADDR1_ID>
>         a       <
> http://corporate-data-league.ch/metadata/Category-3AAddress> ;
>         <http://corporate-data-league.ch/metadata/Property-3ACountry>
>                 <http://corporate-data-league.ch/metadata/Germany> .
>
>  <http://corporate-data-league.ch/metadata/Category-3ABusiness_Partner>
>                                   spin:constraint   [ a             
> sp:Construct ;
>                             sp:templates  ( [ sp:object     
> spin:ConstraintViolation ;
>                                              sp:predicate  rdf:type ;
>                                               sp:subject    _:b1
>                                     
>
> ...

-- 
You received this message because you are subscribed to the Google Group 
"TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), Reference Data Manager (RDM), TopBraid Composer, TopBraid Live, 
TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to topbraid-users@googlegroups.com
--- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to topbraid-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to