0

I recently started working with Linked Data and SPARQL. I've a dataset which contains unittext, indicating what kind of unit the property has (meters, kilograms and so on). The unit is a values which is inserted on the relationship between object and its quantitative property. In my RDF dataset the units are included in a blank node and indicated by https://schema.org/unitText.

An example of the data set is included below.

], [
a owl:Restriction ;
owl:minCardinality "0"^^xsd:nonNegativeInteger ;
owl:onProperty <https://someuri> ;
ns1:unitText "kg"

How can I select this property?

The query so far is:

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 skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX sh: <http://www.w3.org/ns/shacl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
select distinct ?label ?aspect ?datatype where {
?s rdfs:subClassOf/owl:onProperty ?aspect . 
?aspect rdf:type owl:ObjectProperty.
?aspect skos:prefLabel ?label .
?aspect rdfs:range ?datatype .

FILTER  EXISTS{ ?aspect rdfs:range ?datatype. }

VALUES ?datatype {
xsd:string
xsd:gYear
xsd:boolean
xsd:decimal
xsd:integer
xsd:date
}


}

The RDF dataset looks actually like this:

rdfs:subClassOf  [ a  owl:Restriction ; 
                      owl:minCardinality "0"^^xsd:nonNegativeInteger ;
                      owl:onProperty                 <someuri> ;
                      <https://schema.org/unitText>  "kg"
                 ] ;
Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
Sef
  • 85
  • 7
  • that is not enough information ... the data is incomplete or at least I don't know what input data is and what the query should return in the end ... just all unit texts? Unit text for a specific entity? etc ... also what did you try so far? – UninformedUser Mar 13 '21 at 11:28
  • without any reference to the other data it's a simple triple pattern `?s ns1:unitText ?unit .` in your SPARQL query. – UninformedUser Mar 13 '21 at 11:29
  • 1
    @UninformedUser: I've added some additional information. Hope this clarifies my question? – Sef Mar 13 '21 at 11:43
  • then make it `?s rdfs:subClassOf [owl:onProperty ?aspect ; ?unitText] .` instead of `?s rdfs:subClassOf/owl:onProperty ?aspect . ` – UninformedUser Mar 13 '21 at 13:45

0 Answers0