BHoM / RDF_Prototypes

Research project of the Cluster of Excellence "Integrative Computational Design and Construction for Architecture" (IntCDC) https://www.intcdc.uni-stuttgart.de/ **Project Name**: Knowledge Representation for Multi-Disciplinary Co-Design of Buildings. https://www.intcdc.uni-stuttgart.de/research/research-projects/rp-20/
GNU Lesser General Public License v3.0
9 stars 4 forks source link

Conversion from TTL to BHoM Custom Object #12

Closed DiellzaElshani closed 2 years ago

DiellzaElshani commented 2 years ago

Description:

Conversion from TTL to BHoM Custom Object

image

alelom commented 2 years ago

I had a quick test using RDFDotNet reading the TTL exports we have. The TTL was read successfully. For example:

Column randomColumn = BH.Engine.RDF.Testing.Create.RandomObject<Column>();
List<IObject> objectList = new List<IObject>() { randomColumn };
string TTLGraph = objectList.TTLGraph(new OntologySettings(), new LocalRepositorySettings());

Graph rdfColumnGraph = new Graph();
StringParser.Parse(rdfColumnGraph, TTLGraph);

However, RDFDotNet does not seem to be as feature-rich as I expected. This can be seen by analysing the rdfColumnGraph variable in the example above. Everything is returned as a generic "graph" with a flat list of Nodes and a flat list of Triples. There is no distinction between triples (Data Properties vs Object Properties) or nodes (Classes or Data Types). Even the title, prefixes and annotation properties are all bundled together in the same "Nodes" list!

Even if we use RDFDotNet to read the TTL, we still have to do a lot of manual legwork to put together the needed information and construct a corresponding CSharp BHoM object.

For this reason, I've set a size:XL tag on this issue. Even if we limit this feature to only return BHoM CustomObjects, it's a big work.

alelom commented 2 years ago

With a bit of work, I was able to use RDFDotNet. There was indeed a way to get more info out of a read TTL file, which consisted in parsing it into an OntologyGraph object. Some data mapping and the read seems to work fine.

Closed with https://github.com/BHoM/RDF_Prototypes/commit/22f24387a002c8cf9a551bebd45bb7a85a2976c8 and previous commits.