[x3d-public] X3D Ontology: initial SPARQL query for MetadataSet structures

Jakub Flotyński flotynski at kti.ue.poznan.pl
Fri Apr 2 01:05:28 PDT 2021


Hi Don,

I think that using RDF collection for this purpose is fine because:

1) Collections are closed, so we can infer that there are no other 
values except the explicitly given ones,

2) The order of values matters,

even if the SPARQL syntax is clumsy:/

Best regards
Jakub

W dniu 02.04.2021 o 06:20, Don Brutzman pisze:
> Hi Jakub. Following the path as discussed in last few calls about X3D 
> Ontology, have crafted an initial query for MetadataSet structures.
>
> * 
> https://www.web3d.org/x3d/content/semantics/examples/MetadataNodeExamples.x3d
>
> * 
> https://www.web3d.org/x3d/content/semantics/examples/MetadataNodeExamples.ttl
>
> * 
> https://www.web3d.org/x3d/content/semantics/queries/DocumentMetadataValues.rq.txt
>
> This is quite simple, it is not looking at hierarchical structure at 
> all.  So far so good.
>
> Still having difficulty with numeric arrays.  As you are likely aware, 
> the RDF data model doesn't do well with arrays.  Thus SPARQL query for 
> array structures like
>
> <MetadataFloat containerField='value' name='coefficients' 
> value='3.141592653 2.7128 1 0'/>
>
> :MetadataFloat_2_2_1_1_4 a owl:NamedIndividual, x3do:MetadataFloat ;
>   x3do:hasParent :NestedMetadataSetNode ;
>   x3do:name 'coefficients' ;
>   x3do:value ( 3.141592653 2.7128 1 0 ) .
>
> have to recurse across array elements one at a time before turning 
> them into strings, otherwise no value is returned (even when converted 
> to string).
>
> The pattern "x3do:value/rdf:rest*/rdf:first" and corresponding results 
> follow.  Visible at least, but clumsy and a bit misleading.
>
> ================================================================================ 
>
>
> # DocumentMetadataValues.rq    Query to list all values found in 
> Metadata nodes.
>
> SELECT ?ID ?nodeType ?name ((?value1) AS ?value) ?reference
>
> WHERE
> {
>     ?metadataNode a ?nodeType1 .
>
>     ?nodeType1    rdfs:subClassOf x3do:X3DMetadataObject .
>
>     OPTIONAL { ?metadataNode x3do:name ?name1      . }
>     OPTIONAL { ?metadataNode x3do:value/rdf:rest*/rdf:first 
> ?value1     . }
>     OPTIONAL { ?metadataNode x3do:reference ?reference1 . }
>
>     BIND (strafter(xsd:string(?metadataNode),"#") AS ?ID) # DEF if 
> available, otherwise assigned identifier
>     BIND (strafter(xsd:string(?nodeType1),"#")    AS ?nodeType)
>     BIND (str(?name1)       AS    ?name)
> #   BIND (?value1           AS    ?value)     # evaluates value1, 
> converts to string
>     BIND (str(?reference1)  AS    ?reference)
> }
> ORDER by ASC(?ID) # alphabetize, approximately
>
> # TODO non-string values
>
> ###############################################
> ---------------------------------------------------------------------------------------------------------------------------------------------------- 
>
> | ID                            | nodeType          | 
> name                         | value       | 
> reference                                       |
> ==================================================================================================================================================== 
>
> | "MetadataFloat_2_2_1_1_4"     | "MetadataFloat"   | 
> "coefficients"               | 2.7128 
> |                                                 |
> | "MetadataFloat_2_2_1_1_4"     | "MetadataFloat"   | 
> "coefficients"               | 3.141592653 
> |                                                 |
> | "MetadataFloat_2_2_1_1_4"     | "MetadataFloat"   | 
> "coefficients"               | 0 
> |                                                 |
> | "MetadataFloat_2_2_1_1_4"     | "MetadataFloat"   | 
> "coefficients"               | 1 
> |                                                 |
> | "MetadataString_2_1"          | "MetadataString"  | 
> "TestRootMetadataNode"       | 
> |                                                 |
> | "MyMetadataBooleanNode"       | "MetadataBoolean" | "Coin 
> Flip"                  | false       | "MetadataBoolean allowed in X3D 
> v3.3 and later" |
> | "MyMetadataBooleanNode"       | "MetadataBoolean" | "Coin 
> Flip"                  | true        | "MetadataBoolean allowed in X3D 
> v3.3 and later" |
> | "MyMetadataBooleanNode"       | "MetadataBoolean" | "Coin 
> Flip"                  | true        | "MetadataBoolean allowed in X3D 
> v3.3 and later" |
> | "MyMetadataBooleanNode"       | "MetadataBoolean" | "Coin 
> Flip"                  | false       | "MetadataBoolean allowed in X3D 
> v3.3 and later" |
> | "MyMetadataDoubleNode"        | "MetadataDouble"  | 
> "Metadata_name"              | 3.141592658 | "SomeReferenceStandard 
> 1.2.3c"                  |
> | "MyMetadataDoubleNode"        | "MetadataDouble"  | 
> "Metadata_name"              | 2.71812181  | "SomeReferenceStandard 
> 1.2.3c"                  |
> | "MyMetadataFloatNode"         | "MetadataFloat"   | 
> "Metadata_name"              | 6.023e+23   | "SomeReferenceStandard 
> 1.2.3c"                  |
> | "MyMetadataFloatNode"         | "MetadataFloat"   | 
> "Metadata_name"              | 9.8         | "SomeReferenceStandard 
> 1.2.3c"                  |
> | "MyMetadataFloatNode-USE-1"   | "MetadataFloat" 
> |                              | 
> |                                                 |
> | "MyMetadataIntegerNode"       | "MetadataInteger" | 
> "Metadata_name"              | 6           | "SomeReferenceStandard 
> 1.2.3c"                  |
> | "MyMetadataIntegerNode"       | "MetadataInteger" | 
> "Metadata_name"              | 28          | "SomeReferenceStandard 
> 1.2.3c"                  |
> | "MyMetadataIntegerNode"       | "MetadataInteger" | 
> "Metadata_name"              | 496         | "SomeReferenceStandard 
> 1.2.3c"                  |
> | "MyMetadataIntegerNode-USE-1" | "MetadataInteger" 
> |                              | 
> |                                                 |
> | "MyMetadataSetNode"           | "MetadataSet"     | 
> "Metadata_name"              |             | "SomeReferenceStandard 
> 1.2.3c"                  |
> | "MyMetadataStringNode"        | "MetadataString"  | 
> "Metadata_name"              |             | "SomeReferenceStandard 
> 1.2.3c"                  |
> | "MyMetadataStringNode-USE-1"  | "MetadataString" 
> |                              | 
> |                                                 |
> | "NestedMetadataSetNode"       | "MetadataSet"     | 
> "TestNestedMetadataSetNodes" | 
> |                                                 |
> ---------------------------------------------------------------------------------------------------------------------------------------------------- 
>
>
> I'll be studying our references further, especially Bob DuCharme's 
> blog on RDF lists and SPARQL.  Perhaps the recursive split of the 
> floats can be turned into a concatenation of multiple string values, 
> will see.
>
> * https://www.web3d.org/x3d/content/semantics/semantics.html#References
>
> * Bob DuCharme's weblog, 21 April 2014, RDF lists and SPARQL
>   http://www.snee.com/bobdc.blog/2014/04/rdf-lists-and-sparql.html
>
> and maybe
>
> * Andy Seaborne 2011 blog entry, Updating RDF Lists with SPARQL
> http://seaborne.blogspot.com/2011/03/updating-rdf-lists-with-sparql.html
>
> Current impression: we may be able to be able to display list (array) 
> values but operations appear to be difficult.
>
> all the best, Don

Nadawcą korespondencji i jednocześnie administratorem Państwa danych osobowych jest Uniwersytet Ekonomiczny w Poznaniu, al. Niepodległości 10, 61-875 Poznań, z którym można skontaktować się listownie lub poprzez wiadomość e-mail - rodo at ue.poznan.pl
Państwa dane osobowe przetwarzane będą w celu prowadzenia niniejszej korespondencji i przez czas jej trwania. Przysługuje Państwu prawo dostępu do danych, ich sprostowania, ograniczenia przetwarzania, usunięcia, żądania sprzeciwu wobec przetwarzania oraz wniesienia skargi do Prezesa Urzędu Ochrony Danych Osobowych. Szczegółowe informacje na temat ochrony danych osobowych dostępne są w Polityce prywatności: https://ue.poznan.pl/pl/polityka-prywatnosci,c12767/




More information about the x3d-public mailing list