BIMserver icon indicating copy to clipboard operation
BIMserver copied to clipboard

Query multiple objects, by their name and type

Open muren400 opened this issue 4 years ago • 5 comments

Hi,

I'm not sure if this is a bug or if it's supposed to work this way.

When querying objects by their type, I get all the objects of a specific type.

For Example, the following query would give me all IfcPropertySingleValue objects:

{
  "type": "IfcPropertySingleValue"
}

But when also querying for the name, I only get a single result, even though, there are more than one object with that type and name:

{
  "type": "IfcPropertySingleValue",
  "name": "foo bar"
}

Is it supposed to only return a single object? And if so, is it possible, to query more than one object by type and name?

Thanks, Andreas

muren400 avatar Jul 15 '21 15:07 muren400

I think it should work the way you expect it to work, returning all objects with that combination of type and name. See also #826 (which, however, was not reproduced and investigated back then due to lack of example data, I think). I will have to look through the code to see if, for example, the name attribute of IfcRoot is treated separately and it does not work for IfcProperty or the like. Can you share a minimal sample file for testing?

hlg avatar Jul 15 '21 16:07 hlg

I can reproduce the behaviour for this example file: https://raw.githubusercontent.com/buildingSMART/Sample-Test-Files/master/IFC%202x3/Duplex%20Apartment/Duplex_A_20110907.ifc

with this query:

{
  "type": "IfcPropertySingleValue",
  "name": "Classification Description"
}

To me it looks like the problem is located in QueryNamesAndTypesStackFrame.java. The method getOidOfGuidAlternative(...) only returns a single ObjectIdentifier for the given name and type.

Rather than fetching the first result by calling databaseInterface.get(...)

byte[] firstDuplicate = databaseInterface.get(indexTableName, valueBuffer.array());

It should fetch all the results by using databaseInterface.getDuplicates(...) and then return a list of ObjectIdentifiers.

List<byte[]> duplicates = databaseInterface.getDuplicates(indexTableName, valueBuffer.array());

muren400 avatar Jul 16 '21 10:07 muren400

Thanks for the sample.

I think you may be right: The class QueryNamesAndTypesStackFrame looks like a literal copy of QueryGuidsAndTypesStackFrame which indeed wouldn't have multiple results for the same parameter.

hlg avatar Jul 16 '21 21:07 hlg