opensourceBIM / BIMserver

The open source BIMserver platform
GNU Affero General Public License v3.0
1.55k stars 608 forks source link

Improve the query language #680

Open rubendel opened 6 years ago

rubendel commented 6 years ago

The includes should be added on a per-field basis instead of for all fields, this way we can also show better warnings on non-existing combinations.

Proposal (modified "AllWallIncludingWindowsAndDoors" example query in BIMvie.ws)

{
   "version":3, // New version
   "type":{ // Basic query, all IfcWalls + subtypes
      "name":"IfcWall",
      "includeAllSubTypes":true
   },
   "field":{ // For every object returned in this query part, follow the HasOpenings field
      "name":"HasOpenings",
      "include":{ // For every object found in the HasOpenings reference, include the following
         "type":"IfcRelVoidsElement", // But only if it's type is IfcRelVoidsElement
         "field":{ // Etcetera
            "name": "RelatedOpeningElement",
            "include":{
               "type":"IfcOpeningElement",
               "field":{
                  "name":"HasFillings",
                  "include":{
                     "type":"IfcRelFillsElement",
                     "field":{
                        "name":"RelatedBuildingElement"
                     }
                  }
               }
            }
         }
      }
   }
}

With this new structure it would in theory be possible to also support the old style queries with the same version of BIMserver. It would just look at the type of the "field"/"fields" references (object or text).

rubendel commented 6 years ago

One downside of this approach is that when using predefined includes, you now all of a sudden need to know/lookup the field name. For example, previously it was easy to add an include that would include all decomposition, but now you'd have to add a field "Decomposes" and add an include to that...