That’s it 😊 thx. Still trying to understand why...because they are “bound together”?
Dr. ir. H.M. (Michel) Böhms Senior Data Scientist T +31888663107 M +31630381220 E [email protected]<mailto:[email protected]> Location<https://www.google.com/maps/place/TNO+-+Locatie+Delft+-+Stieltjesweg/@52.000788,4.3745183,17z/data=!3m1!4b1!4m5!3m4!1s0x47c5b58c52869997:0x56681566be3b8c88!8m2!3d52.000788!4d4.376707> [cid:[email protected]]<http://www.tno.nl/> This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages. Van: [email protected] <[email protected]> Namens Richard Cyganiak Verzonden: Wednesday, November 20, 2019 2:46 PM Aan: topbraid-users list <[email protected]> Onderwerp: Re: [topbraid-users] contsruct query question for sheets I think the OPTIONAL needs to surround all three lines: OPTIONAL { ?unitCell ss:row 1 . ?unitCell ss:column ?y . ?unitCell ss:cellContents ?unit } and same for the datatype. Richard On 20 Nov 2019, at 13:34, 'Bohms, H.M. (Michel)' via TopBraid Suite Users <[email protected]<mailto:[email protected]>> wrote: Hmmmm PREFIX ss: <http://www.topbraidcomposer.org/owl/2006/08/spreadsheets.owl#<http://www.topbraidcomposer.org/owl/2006/08/spreadsheets.owl>> PREFIX bsc: <https://w3id.org/def/basicsemantics-owl-complex#<https://w3id.org/def/basicsemantics-owl-complex>> CONSTRUCT { ?uri a bsc:PropertyDef . } WHERE { ?dataCell ss:row ?x . ?dataCell ss:column ?y . ?dataCell ss:cellContents ?dataValue . ?propertyCell ss:row 0 . ?propertyCell ss:column ?y . ?propertyCell ss:cellContents ?property . ?unitCell ss:row 1 . ?unitCell ss:column ?y . OPTIONAL { ?unitCell ss:cellContents ?unit } ?datatypeCell ss:row 2 . ?datatypeCell ss:column ?y . OPTIONAL {?datatypeCell ss:cellContents ?datatype } BIND (iri(concat("http://www.topbraidcomposer.org/owl/2006/08/spreadsheets.owl#<http://www.topbraidcomposer.org/owl/2006/08/spreadsheets.owl>",?property)) AS ?uri ) FILTER ( ?x > 2)} Gives me only instances for property names (first row, row 0) for which there are units defined in second row 1. I thought that putting optional there would give them all..... Adding OPTIONAL also for the general ?dataCell ss:cellContents ?dataValue . does not help Where is my thinking wrong? Thx Michel Dr. ir. H.M. (Michel) Böhms Senior Data Scientist T +31888663107 M +31630381220 E [email protected]<mailto:[email protected]> Location<https://www.google.com/maps/place/TNO+-+Locatie+Delft+-+Stieltjesweg/@52.000788,4.3745183,17z/data=!3m1!4b1!4m5!3m4!1s0x47c5b58c52869997:0x56681566be3b8c88!8m2!3d52.000788!4d4.376707> <image001.gif><http://www.tno.nl/> This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages. Van: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>> Namens Richard Cyganiak Verzonden: Tuesday, November 19, 2019 10:11 AM Aan: topbraid-users list <[email protected]<mailto:[email protected]>> CC: Bektas, K.E. (Esra) <[email protected]<mailto:[email protected]>> Onderwerp: Re: [topbraid-users] contsruct query question for sheets On 19 Nov 2019, at 08:12, 'Bohms, H.M. (Michel)' via TopBraid Suite Users <[email protected]<mailto:[email protected]>> wrote: ?dataCell ss:row ?x ?dataCell ss :column ?y. ?dataCell ss:cellContents ?dataValue ?propertyCell ss:row 1. ?propertyCell ss :column ?y. ?propertyCell ss:cellContents ?propertyValue ?unitCell ss:row 1. ?unitCell ss :column ?y. ?unitCell ss:cellContents ?unitValue ?datatypeCell ss:row 1. ?datatypeCell ss :column ?y. ?datatypeCell ss:cellContents ?datatypeValue FILTER (?x > 3) This looks good, except you need 1/2/3 for the three ss:row patterns instead of the 1/1/1 you have there. Despite your hints I struggle with the actual construct part (instantiation of the row-instances). Try doing a simple SELECT first, with this graph pattern instead of the ... part: SELECT ?x ?propertyValue ?dataValue ?unitValue ?datatypeValue WHERE { ... } Each result row should now have all the ingredients that you need to construct one triple. The next step is to turn it into a CONSTRUCT: CONSTRUCT { ?s ?p ?o } WHERE { ... BIND (subjectExpr AS ?s) BIND (predicateExpr AS ?p) BIND (objectExpr AS ?o) } But the three xxxExpr parts still need to be replaced with real expressions that create the appropriate RDF nodes. Something like: subjectExpr: IRI(CONCAT(STR(<http://example.com/item/>, STR(?x))) predicateExpr: IRI(CONCAT(STR(<http://example.com/property/>, STR(?propertyValue))) objectExpr: STRDT(?dataValue, xsd:string) These should work as a starting point, but the real expressions are probably going to be more complicated than that. The objectExpr will need to do something appropriate with ?unitValue and ?datatypeValue. If the expressions become too complicated, it might be best to turn the expressions into SPIN functions. That way, the complexity is contained in one place, and the SPIN function can be re-used in other queries. If extra triples are needed in the output, like an rdf:type triple for each subject, then it's probably easiest to make a separate query that produces only those extra triples. Hope that helps, Richard -- 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 [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/9E0CA9F7-2D4D-4604-9164-4FD010B8866B%40topquadrant.com<https://groups.google.com/d/msgid/topbraid-users/9E0CA9F7-2D4D-4604-9164-4FD010B8866B%40topquadrant.com?utm_medium=email&utm_source=footer>. -- 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 [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/4d94a0d7d16948c7914f9c3ac03657cb%40tno.nl<https://groups.google.com/d/msgid/topbraid-users/4d94a0d7d16948c7914f9c3ac03657cb%40tno.nl?utm_medium=email&utm_source=footer>. -- 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 [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/77F21491-7E6A-46A3-90EC-B9832883A709%40topquadrant.com<https://groups.google.com/d/msgid/topbraid-users/77F21491-7E6A-46A3-90EC-B9832883A709%40topquadrant.com?utm_medium=email&utm_source=footer>. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/97739fde12a94b4c9b92378a97b798af%40tno.nl.
