Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPARQL path query for the following resources #16

Open
fils opened this issue Oct 28, 2022 · 3 comments
Open

SPARQL path query for the following resources #16

fils opened this issue Oct 28, 2022 · 3 comments
Assignees

Comments

@fils
Copy link
Collaborator

fils commented Oct 28, 2022

Resource reference
https://reference.geoconnex.us/collections/gages/items/1009257?f=jsonld

find all resources that have similar path to this
10:15
linearElement (the mainstem one in particular)

image

@fils
Copy link
Collaborator Author

fils commented Nov 16, 2022

SPARQL query for review

PREFIX hyf: <https://www.opengis.net/def/schema/hy_features/hyf/>

select ?le ?relsubjects  where { 
    <https://geoconnex.us/ref/gages/1118104> hyf:referencedPosition ?rp .
    ?rp hyf:HY_IndirectPosition ?ip .
    ?ip hyf:linearElement ?le .
    BIND (?le as ?target)
    ?relsubjects hyf:referencedPosition ?rp2 .
    ?rp2 hyf:HY_IndirectPosition ?ip2.
    ?ip2 hyf:linearElement ?target .
} 

Need to connect this to the output in something like https://search.geoconnex.us/?search=Lake+site+01554469

@fils
Copy link
Collaborator Author

fils commented Nov 16, 2022

Query that collects mainstem results:

PREFIX hyf: <https://www.opengis.net/def/schema/hy_features/hyf/>

select * where { 
    ?relsubjects hyf:referencedPosition ?rp .
    ?rp hyf:HY_IndirectPosition ?ip .
    ?ip hyf:linearElement <https://geoconnex.us/ref/mainstems/324976> .
}  

@fils fils self-assigned this Nov 18, 2022
@fils
Copy link
Collaborator Author

fils commented Nov 18, 2022

version of the query with the WKT for gage and mainstem (need to not replicate the mainstem each row)

PREFIX hyf: <https://www.opengis.net/def/schema/hy_features/hyf/>
PREFIX schema: <https://schema.org/>
PREFIX geo: <http://www.opengis.net/ont/geosparql#>

select DISTINCT ?mainstem ?gage ?name ?gwkt ?mswkt where {
    <https://geoconnex.us/ref/gages/1118104> hyf:referencedPosition ?rp .
    ?rp hyf:HY_IndirectPosition ?ip .
    ?ip hyf:linearElement ?mainstem .
    BIND (?mainstem as ?target)
    ?gage hyf:referencedPosition ?rp2 .
    ?rp2 hyf:HY_IndirectPosition ?ip2.
    ?ip2 hyf:linearElement ?target .
    ?mainstem schema:name ?name .
    ?mainstem geo:hasGeometry ?msgeom .
    ?msgeom geo:asWKT ?mswkt .
    ?gage geo:hasGeometry ?ggeom .
    ?ggeom geo:asWKT ?gwkt
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant