All Projects → opensourceBIM → python-mvdxml

opensourceBIM / python-mvdxml

Licence: LGPL-3.0 license
A mvdXML checker and w3c SPARQL converter, as an IfcOpenShell submodule or stand-alone.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to python-mvdxml

Sample-Test-Files
Sample files of various formats and schema versions for testing implementations
Stars: ✭ 70 (+150%)
Mutual labels:  ifc, buildingsmart, industryfoundationclasses
pyfuseki
A library that uses Python to connect and manipulate Jena Fuseki, which provides sync and async methods.
Stars: ✭ 22 (-21.43%)
Mutual labels:  owl
NumLin
NumLin: Linear Types for Linear Algebra
Stars: ✭ 21 (-25%)
Mutual labels:  owl
LinkedDataHub
The Knowledge Graph notebook. Apache license.
Stars: ✭ 150 (+435.71%)
Mutual labels:  owl
COB
An experimental ontology containing key terms from Open Biological and Biomedical Ontologies (OBO)
Stars: ✭ 23 (-17.86%)
Mutual labels:  owl
obi
The Ontology for Biomedical Investigations
Stars: ✭ 49 (+75%)
Mutual labels:  owl
ont-api
ONT-API (OWL-API over Apache Jena)
Stars: ✭ 20 (-28.57%)
Mutual labels:  owl
walking-rdf-and-owl
Feature learning over RDF data and OWL ontologies
Stars: ✭ 41 (+46.43%)
Mutual labels:  owl
owl-verbalizer
OWL verbalizer: making machine-readable knowledge also human-readable
Stars: ✭ 31 (+10.71%)
Mutual labels:  owl
biolink-model
Schema and generated objects for biolink data model and upper ontology
Stars: ✭ 83 (+196.43%)
Mutual labels:  owl
V
OwlGaming roleplay script for RAGE Multiplayer on GTA 5.
Stars: ✭ 36 (+28.57%)
Mutual labels:  owl
OpenWare
Firmware for OWL devices
Stars: ✭ 23 (-17.86%)
Mutual labels:  owl
owl2neo4j
Convert OWL to labeled property graph and import into Neo4J
Stars: ✭ 42 (+50%)
Mutual labels:  owl
plant-trait-ontology
Explore the Plant Trait Ontology on the Planteome site.
Stars: ✭ 26 (-7.14%)
Mutual labels:  owl
eigen
Owl's OCaml Interface to Eigen3 C++ Library
Stars: ✭ 30 (+7.14%)
Mutual labels:  owl
Overwatch-League-API-Documentation
A community driven analysis of the Overwatch League API.
Stars: ✭ 43 (+53.57%)
Mutual labels:  owl
cell-ontology
An ontology of cell types
Stars: ✭ 75 (+167.86%)
Mutual labels:  owl
semantic-web
Storing ontologies/vocabularies from the web. Wish anybody can translate some of them.
Stars: ✭ 114 (+307.14%)
Mutual labels:  owl
OLGA
an Ontology SDK
Stars: ✭ 36 (+28.57%)
Mutual labels:  owl
knowledge-graph-change-language
Tools for working with KGCL
Stars: ✭ 14 (-50%)
Mutual labels:  owl

python-mvdxml

A mvdXML checker and w3c SPARQL converter, as an IfcOpenShell submodule or stand-alone.

WARNING: While this repository has many useful building blocks to build software around mvdXML and IFC, there are many mvdXML dialects and not all variants are likely to be fully supported.

Quickstart

Extraction

import ifcopenshell
from ifcopenshell.mvd import mvd

mvd_concept = mvd.open_mvd("examples/wall_extraction.mvdxml")
file = ifcopenshell.open("Duplex_A_20110505.ifc")

all_data = mvd.get_data(mvd_concept, file, spreadsheet_export=True)

non_respecting_entities = mvd.get_non_respecting_entities(file, all_data[1])
respecting_entities = mvd.get_respecting_entities(file, all_data[1])
# Create a new file
new_file = ifcopenshell.file(schema=file.schema)
proj = file.by_type("IfcProject")[0]
new_file.add(proj)

for e in respecting_entities:
    new_file.add(e)

new_file.write("new_file.ifc")
# Visualize results
mvd.visualize(file, non_respecting_entities)
Validation
import ifcopenshell

from ifcopenshell.mvd import mvd
from colorama import Fore
from colorama import Style

concept_roots = list(ifcopenshell.mvd.concept_root.parse(MVDXML_FILENAME))
file = ifcopenshell.open(IFC_FILENAME)

tt = 0 # total number of tests
ts = 0 # total number of successful tests

for concept_root in concept_roots:
    print("ConceptRoot: ", concept_root.entity)
    for concept in concept_root.concepts():
        tt = tt + 1
        print("Concept: ", concept.name)
        try:

            if len(concept.template().rules) > 1:
                attribute_rules = []
                for rule in concept.template().rules:
                    attribute_rules.append(rule)
                rules_root = ifcopenshell.mvd.rule("EntityRule", concept_root.entity, attribute_rules)
            else:
                rules_root = concept.template().rules[0]
            ts = ts + 1
            finst = 0 #failed instances

            for inst in file.by_type(concept_root.entity):
                try:
                    data = mvd.extract_data(rules_root, inst)
                    valid, output = mvd.validate_data(concept, data)
                    if not valid:
                        finst = finst + 1
                    print("[VALID]" if valid else Fore.RED +"[failure]"+Style.RESET_ALL, inst)
                    print(output)
                except Exception as e:
                    print(Fore.RED+"EXCEPTION: ", e, Style.RESET_ALL,inst)
                    print ()
            print (int(finst), "out of", int(len(file.by_type(concept_root.entity))), "instances failed the check")
            print ("---------------------------------")
        except Exception as e:
            print("EXCEPTION: "+Fore.RED,e,Style.RESET_ALL)
            print("---------------------------------")
    print("---------------------------------")
print("---------------------------------")

tf = tt-ts # total number of failed tests

print ("\nRESULTS OVERVIEW")
print ("Total number of tests: ",tt)
print ("Total number of executed tests: ", ts)
print ("Total number of failed tests: ", tf)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].