IfcDoc.FormatOWL.FormatDefinedFull C# (CSharp) Méthode

FormatDefinedFull() public méthode

public FormatDefinedFull ( DocDefined docDefined, bool fullListing ) : string
docDefined DocDefined
fullListing bool
Résultat string
        public string FormatDefinedFull(DocDefined docDefined, bool fullListing)
        {
            StringBuilder sb = new StringBuilder();

            string defined = ToOwlClass(docDefined.DefinedType);

            if (docDefined.Aggregation != null)
            {
                string aggtype = docDefined.Aggregation.GetAggregation().ToString().ToLower();

                if (docDefined.Aggregation.GetAggregation() == DocAggregationEnum.SET)
                {
                    //IfcPropertySetDefinitionSet

                    sb.AppendLine("ifc:" + docDefined.Name);
                    sb.AppendLine("\trdf:type owl:Class ;");

                    //TODO:: Add (SELECT) parent classes

                    sb.AppendLine("\trdfs:subClassOf ");
                    sb.AppendLine("\t\t[ ");
                    sb.AppendLine("\t\t\trdf:type owl:Restriction ;");
                    sb.AppendLine("\t\t\towl:allValuesFrom " + defined + " ;");
                    sb.AppendLine("\t\t\towl:onProperty expr:hasSet");
                    sb.AppendLine("\t\t] ;");
                    sb.AppendLine("\t" + "rdfs:subClassOf ");
                    sb.AppendLine("\t\t" + "[");
                    sb.AppendLine("\t\t\t" + "rdf:type owl:Restriction ;");
                    sb.AppendLine("\t\t\t" + "owl:minQualifiedCardinality \"" + 1
                        + "\"^^xsd:nonNegativeInteger ;");
                    sb.AppendLine("\t\t\towl:onProperty expr:hasSet ;");
                    sb.AppendLine("\t\t\t" + "owl:onClass " + defined);
                    sb.AppendLine("\t\t] .");
                    sb.AppendLine();
                }
                else if (docDefined.Aggregation.GetAggregation() == DocAggregationEnum.LIST || docDefined.Aggregation.GetAggregation() == DocAggregationEnum.ARRAY)
                {

                    //Console.Out.WriteLine("defined type --" + docDefined.Aggregation.GetAggregation() + "-- : " + docDefined.Name);

                    int mincard = 0;
                    if (docDefined.Aggregation.AggregationLower != null)
                        mincard = Int32.Parse(docDefined.Aggregation.AggregationLower);
                    int maxcard = 0;
                    if (String.IsNullOrEmpty(docDefined.Aggregation.AggregationUpper) ||
                       !Int32.TryParse(docDefined.Aggregation.AggregationUpper, out maxcard))
                        maxcard = 0;

                    if (docDefined.Aggregation.GetAggregation() == DocAggregationEnum.ARRAY)
                    {
                        mincard = maxcard - mincard + 1;
                        maxcard = mincard;
                    }

                    sb.AppendLine("ifc:" + docDefined.Name);
                    sb.AppendLine("\trdf:type owl:Class ;");
                    sb.Append("\trdfs:subClassOf " + defined + "_List ");

                    //check for cardinality restrictions and add if available
                    string cards = "";
                    if (docDefined.Aggregation.GetAggregationNestingLower() >= 1)
                        cards += WriteMinCardRestr(defined + "_List", "hasNext", mincard, false);
                    if (docDefined.Aggregation.GetAggregationNestingUpper() > 1)
                        cards += WriteMaxCardRestr(defined + "_EmptyList", "hasNext", maxcard, false);
                    cards += ".";
                    sb.AppendLine(cards);
                    sb.AppendLine();

                    if (fullListing)
                    {
                        sb.AppendLine(createListClass(defined));
                    }
                }
            }
            else
            {
                sb.AppendLine("ifc:" + docDefined.Name);
                sb.AppendLine("\trdf:type owl:Class ;");

                sb.AppendLine("\trdfs:subClassOf " + defined + " .");
                sb.AppendLine();

                if (docDefined.Length > 0 || docDefined.Length < 0 || docDefined.Aggregation != null)
                {
                    //TODO: possibly add restrictions here

                    //TYPE IfcGloballyUniqueId = STRING(22) FIXED;
                    //END_TYPE;

                    //TYPE IfcIdentifier = STRING(255);
                    //END_TYPE;

                    //TYPE IfcLabel = STRING(255);
                    //END_TYPE;
                }
            }

            return sb.ToString();
        }