- 
                Notifications
    
You must be signed in to change notification settings  - Fork 666
 
GH-3473: Identify spatial objects by properties instead of types. #3480
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
Conversation
| 
           Converted to draft because there are more instances in GenericPropertyFunction that rely on explicit types, such as: Lines 147 to 151 in c2d1a89 
 I am looking into consolidating this into a separate set of methods that check whether resources are features or geometries and then retrieve the appropriate literal. Perhaps even an interface that let's one choose whether to classify resources by types or by properties.  | 
    
1623501    to
    1a9c030      
    Compare
  
            
          
                ...osparql/src/main/java/org/apache/jena/geosparql/geo/topological/GenericPropertyFunction.java
          
            Show resolved
            Hide resolved
        
      1a9c030    to
    82ef78d      
    Compare
  
    | 
           So benchmark results with this PR on a test dataset with 80K geometries are pretty much consistent with what was there before. A slight performance increase is seen on virtual inferences - most likely because because lookups by type (e.g. geo:Geometry) in addition would also have to scan all triples by which that type could be inferred. The new code just checks the properties directly. The benchmark is compatible with jena-5.5.0 and thus adds type Geometry triples which with the now no core are longer needed. Plain geo:asWKT, geo:asGML or geo:hasSerialization is now sufficient.  | 
    
7939dec    to
    45c7236      
    Compare
  
    | 
           The code itself ready for review. I will do a round of testing on our deployment for whether this reveals any issues and report back. [Update] looked fine.  | 
    
| 
           Hm, similar access patterns (e.g. the check for Geometry type triples) are used in SpatialIndexUtils, GenericSpatialPropertyFunction, SpatialObjectAccess. While at it, I'll consolidate this in one place.  | 
    
b4be7e7    to
    a3c54a3      
    Compare
  
    | 
           The code is now consolidated.  | 
    
| return new GraphRDFS(base, setup); | ||
| } | ||
| 
               | 
          ||
| @Override | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I read the code on main:
find() ->
find() in DatasetGraphWrapper ->
default method DatasetGraph.find() ->
find(Node.ANY, Node.ANY, Node.ANY, Node.ANY);
so this is not necessary.
And Node.ANY is better than null 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The default find() method of DatasetGraphWrapper goes to the delegated dataset which does not have the inferences - so DatasetGraphRDFS does have to override it to use findInf. I'll add a test case.
jena/jena-arq/src/main/java/org/apache/jena/sparql/core/DatasetGraphWrapper.java
Lines 195 to 197 in 29e8a56
| @Override | |
| public Iterator<Quad> find() | |
| { return getR().find(); } | 
Node.ANY
Agreed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added test case (fails without the fix) and switched to Node.ANY.
| } | ||
| } | ||
| 
               | 
          ||
| /** Atomic compute. */ | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't I seen these Context changes in another of your PRs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's part of the ExecTracker PR #3184 - but it also fits here where it is easier to review due to the size of the PR :)
12b04ae    to
    51f0600      
    Compare
  
    …PropertyFunction; Spatial Indexer UI: Replace without selection clears index.
51f0600    to
    59897bf      
    Compare
  
    
GitHub issue resolved #3473
Pull request Description: In
jena-geosparql, replaced all lookups of spatial objects by type with lookups by the corresponding relevant properties. E.g. instead of searching for instances of typegeo:Geometry, instances withgeo:asWKT,geo:asGMLandgeo:hasSerializationproperties are looked for.Consolidated all vocabulary-based graph access into
AccessGeoSPARQLandAccessWGS84classes.Added benchmark. No performance issues revealed. Detailed results in this thread.
Spatial Indexer UI: Replace mode with no selected graphs clears the index
Added
computeIfAbsent/Presentmethods toContext.Fixed missing override of
DatasetGraphRDFS.find()Fixed possible resource leaks by changing
forEachRemainingtoforEachwhich closes the iterator after use. Credits to @SimonBin for spotting this.GenericPropertyFunctiontests are covered by existing test suiteBy submitting this pull request, I acknowledge that I am making a contribution to the Apache Software Foundation under the terms and conditions of the Contributor's Agreement.
See the Apache Jena "Contributing" guide.