();
117 | if (this.getValue() instanceof Vector) {
118 | Vector values = (Vector) getValue();
119 | for (int i = 0; i < values.size(); i++) {
120 | String stringVal = (String) values.get(i);
121 | if (stringVal.startsWith("#")) {
122 | ModelPopulation pop = this.getAttributeOf().getModel();
123 | list.add(pop.getEntity(new Integer(stringVal.substring(1, stringVal.length()))));
124 | }
125 | }
126 | } else if (this.value instanceof String) {
127 | String stringVal = (String) value;
128 | if (stringVal.startsWith("#")) {
129 | ModelPopulation pop = this.getAttributeOf().getModel();
130 | list.add(pop.getEntity(new Integer(stringVal.substring(1, stringVal.length()))));
131 | }
132 |
133 | }
134 | return list;
135 | }
136 |
137 | /**
138 | * gets the type information of this attribute such as
139 | * "ENTITY_INSTANCE_NAME", "REAL" etc
140 | *
141 | * @return the String value of an instance name
142 | */
143 | public String getP21Header() {
144 | return p21Header;
145 | }
146 |
147 | public void setP21Header(String header) {
148 | p21Header = header;
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/express/population/EntityInstance.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.express.population;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | import java.util.ArrayList;
21 | import java.util.HashMap;
22 |
23 | import nl.tue.buildingsmart.schema.EntityDefinition;
24 |
25 | /**
26 | * @author Jakob Beetz j.beetz@tue.nl
27 | *
28 | * The EntityInstance gives access to an EXPRESS entity instance
29 | * generated i.e. by reading in a SPFF / p21 file.
30 | *
31 | *
32 | * Depending on the type of the EntityInstance that can be retrieved
33 | * with the getEntityDefinition() function, the attributes can be
34 | * retrieved as an ArrayList or by their name.
35 | *
36 | *
37 | *
38 | * Member functions that have a "BN" in their name, e.g.
39 | * "getAttributeValueBN" take a string argument to get a certain
40 | * attribute value by its name according to the schema definition.
41 | * (Roughly oriented at SDAI)
42 | *
43 | */
44 | public class EntityInstance {
45 | private int id; // the #number of the part 21 file this instance is
46 | // identified with
47 | private EntityDefinition entDef;
48 | private ArrayList attributes;
49 | private ArrayList references;
50 | private HashMap attributeMap;
51 | private int numAttribues = 0;
52 | private ModelPopulation model;
53 |
54 | public EntityInstance(ModelPopulation model, int id) {
55 | this.setId(id);
56 | setModel(model);
57 | attributes = new ArrayList();
58 | references = new ArrayList();
59 | attributeMap = new HashMap();
60 | }
61 |
62 | /**
63 | * disscuraged to call this and operate on the attributes
64 | * directly
65 | *
66 | * @return the list of attributes for this EntityInstance
67 | */
68 | public ArrayList getAttributes() {
69 | return attributes;
70 | }
71 |
72 | public void addAttribute(AttributeInstance attribute) {
73 | attributes.add(attribute);
74 | attribute.setAttributeOf(this);
75 | attributeMap.put(attribute.getAttributeType().getName(), attribute);
76 | numAttribues = attributes.size();
77 | }
78 |
79 | public void setAttributes(ArrayList attributes) {
80 | this.attributes = attributes;
81 | for (int i = 0; i < attributes.size(); i++) {
82 | attributeMap.put(attributes.get(i).getAttributeType().getName(), attributes.get(i));
83 | }
84 |
85 | }
86 |
87 | public EntityDefinition getEntityDefinition() {
88 | return entDef;
89 | }
90 |
91 | public void setEntityDefinition(EntityDefinition entDef) {
92 | this.entDef = entDef;
93 | }
94 |
95 | public int getId() {
96 | return id;
97 | }
98 |
99 | public void setId(int id) {
100 | this.id = id;
101 | }
102 |
103 | public ArrayList getReferneces() {
104 | return references;
105 | }
106 |
107 | public void addReference(EntityInstance instance) {
108 | references.add(instance);
109 | }
110 |
111 | public void setReferneces(ArrayList referneces) {
112 | this.references = referneces;
113 | }
114 |
115 | /**
116 | * get an attribute of this EntityInstance by its name an return its value
117 | * as an Object. Possible object types include EntityInstance, literal
118 | * values or aggregate types.
119 | *
120 | * @param attributeName
121 | * @return the value of the attribute as an object
122 | */
123 | public Object getAttributeValueBN(String attributeName) {
124 | /*
125 | * boolean found = false; AttributeInstance attrib = null;
126 | * Iterator attribIter=attributes.iterator(); while
127 | * (!found && attribIter.hasNext()){ attrib = attribIter.next(); if
128 | * (attrib.getAttributeType().getName().equals(attributeName)) found =
129 | * true;
130 | *
131 | * }
132 | */
133 |
134 | AttributeInstance attrib = attributeMap.get(attributeName);
135 | if (attrib != null)
136 | return attrib.getValue();
137 | else
138 | return null;
139 |
140 | }
141 |
142 | /**
143 | * get an attribute value by its name and return the value as a string
144 | *
145 | * @param attributeName
146 | * @return a string representation of the Value of the attribute
147 | */
148 | public String getAttributeValueBNasString(String attributeName) {
149 | return (String) getAttributeValueBN(attributeName);
150 |
151 | }
152 |
153 | /**
154 | * get the number of attributes of this instance
155 | *
156 | * @return the number of attributes
157 | */
158 | public int getNumAttribues() {
159 | return numAttribues;
160 | }
161 |
162 | /**
163 | * Try to get the attribute by its name and return it as an EntityInstance
164 | *
165 | * @param attributeName
166 | * @return the EntityInstance or null if its not an EntityInstance but a
167 | * e.g. a literal or an Aggregate
168 | */
169 | public EntityInstance getAttributeValueBNasEntityInstance(String attributeName) {
170 | AttributeInstance attr = attributeMap.get(attributeName);
171 | // if (attr.hasEntityInstanceValue())
172 | if (attr != null)
173 | return attr.getEntityInstanceValue();
174 | else
175 | return null;
176 | }
177 |
178 | /**
179 | * @param attributeName
180 | * the case-sensitive name of the AttributeInstance to retrieve
181 | * @return
182 | */
183 | public ArrayList getAttributeValueBNasEntityInstanceList(String attributeName) {
184 | AttributeInstance attr = attributeMap.get(attributeName);
185 | if (attr != null)
186 | return attr.getEntityList();
187 | else
188 | return null;
189 | }
190 |
191 | public ModelPopulation getModel() {
192 | return model;
193 | }
194 |
195 | public void setModel(ModelPopulation model) {
196 | this.model = model;
197 | }
198 | }
199 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/express/population/ModelPopulation.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.express.population;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | import java.io.FileInputStream;
21 | import java.nio.file.Path;
22 | import java.util.HashMap;
23 | import java.util.Iterator;
24 | import java.util.Vector;
25 |
26 | import org.slf4j.Logger;
27 | import org.slf4j.LoggerFactory;
28 |
29 | import nl.tue.buildingsmart.schema.EntityDefinition;
30 | import nl.tue.buildingsmart.schema.SchemaDefinition;
31 |
32 | @SuppressWarnings("all")
33 | public class ModelPopulation {
34 |
35 | private static final Logger LOGGER = LoggerFactory.getLogger(ModelPopulation.class);
36 | private HashMap instances;
37 | // hashmap of all instances sorted by type name;
38 | private HashMap> typeNameMap;
39 | private SchemaDefinition schema;
40 | private Part21Parser parser;
41 | private Path schemaFile;
42 | private String entityPrefixString = "ENTITY_";
43 |
44 | public ModelPopulation(FileInputStream input) {
45 |
46 | parser = new Part21Parser(input);
47 |
48 | }
49 |
50 | public SchemaDefinition getSchema() {
51 | return schema;
52 | }
53 |
54 | public void setSchema(SchemaDefinition schema) {
55 | this.schema = schema;
56 | if (this.parser != null)
57 | this.parser.setSchema(schema);
58 | }
59 |
60 | public Path getSchemaFile() {
61 | return schemaFile;
62 | }
63 |
64 | public void setSchemaFile(Path schemaFile) {
65 | this.schemaFile = schemaFile;
66 | parser.setSchemaFile(schemaFile);
67 | }
68 |
69 | public void load() {
70 | try {
71 | parser.setModel(this);
72 | parser.init();
73 | parser.syntax();
74 | this.setInstances(parser.getInstances());
75 | buildTypeNameMap();
76 |
77 | } catch (ParseException e) {
78 | // TODO Auto-generated catch block
79 | LOGGER.error("", e);
80 | }
81 | }
82 |
83 | public HashMap getInstances() {
84 | return instances;
85 | }
86 |
87 | public void setInstances(HashMap instances) {
88 | this.instances = instances;
89 | }
90 |
91 | public EntityInstance getEntity(Integer id) {
92 | return instances.get(id);
93 | }
94 |
95 | private void buildTypeNameMap() {
96 | typeNameMap = new HashMap>();
97 | for (Iterator instKeyIter = instances.keySet().iterator(); instKeyIter.hasNext();) {
98 | EntityInstance inst = instances.get(instKeyIter.next());
99 |
100 | String typeName = inst.getEntityDefinition().getName();
101 | if (!typeNameMap.containsKey(typeName)) {
102 | typeNameMap.put(typeName, new Vector());
103 | }
104 | typeNameMap.get(typeName).add(inst);
105 | }
106 | }
107 |
108 | public Vector getInstancesOfType(String typeName) {
109 | return getInstancesOfType(typeName, false);
110 | }
111 |
112 | /**
113 | * Given an (abstract) supertype recursively descends down the subtype axis
114 | * until the first layer first layer of concrete types is found and returns
115 | * all instances
116 | *
117 | * @param typeName
118 | * the (abstract) type name
119 | * @return a vector of EntityInstances of possible various (concrete) types
120 | */
121 | public Vector getInstancesOfFirstNonAbstractTypes(String typeName) {
122 | Vector instances = new Vector();
123 | EntityDefinition ent = schema.getEnitiesBN().get(typeName.toUpperCase());
124 | if (!ent.isInstantiable()) {
125 | for (EntityDefinition subEnt : ent.getSubtypes()) {
126 | Vector tmp = getInstancesOfFirstNonAbstractTypes(subEnt.getName());
127 | instances.addAll(tmp);
128 | }
129 |
130 | } else {
131 | Vector tmp = getInstancesOfType(ent.getName());
132 | instances.addAll(tmp);
133 |
134 | }
135 |
136 | return instances;
137 | }
138 |
139 | public Vector getInstancesOfType(String typeName, boolean includeSubClasses) {
140 | // get the direct instances
141 | System.out.println("checking:" + typeName);
142 | // typeName=typeName.toUpperCase();
143 | Vector instances = typeNameMap.get(typeName);
144 | if (includeSubClasses) {
145 | // recurse into subtypes and get respective instances
146 | EntityDefinition ent = schema.getEnitiesBN().get(typeName.toUpperCase());
147 | for (EntityDefinition subClass : ent.getSubtypes()) {
148 | Vector subClassInstances = getInstancesOfType(subClass.getName(), includeSubClasses);
149 | if (subClassInstances != null) {
150 | if (instances == null)
151 | instances = new Vector();
152 | instances.addAll(subClassInstances);
153 | }
154 | }
155 | }
156 |
157 | if (instances == null)
158 | instances = new Vector();
159 | return instances;
160 | }
161 |
162 | public String getEntityPrefix() {
163 | // TODO Auto-generated method stub
164 | return entityPrefixString;
165 | }
166 | }
167 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/express/population/ParseException.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.express.population;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class ParseException extends Exception {
21 |
22 | private static final long serialVersionUID = 1835959973347942267L;
23 |
24 | /**
25 | * This constructor is used by the method "generateParseException" in the
26 | * generated parser. Calling this constructor generates a new object of this
27 | * type with the fields "currentToken", "expectedTokenSequences", and
28 | * "tokenImage" set. The boolean flag "specialConstructor" is also set to
29 | * true to indicate that this constructor was used to create this object.
30 | * This constructor calls its super class with the empty string to force the
31 | * "toString" method of parent class "Throwable" to print the error message
32 | * in the form: ParseException: {@literal}
33 | */
34 | public ParseException(Token currentTokenVal, int[][] expectedTokenSequencesVal, String[] tokenImageVal) {
35 | super("");
36 | specialConstructor = true;
37 | currentToken = currentTokenVal;
38 | expectedTokenSequences = expectedTokenSequencesVal;
39 | tokenImage = tokenImageVal;
40 | }
41 |
42 | /**
43 | * The following constructors are for use by you for whatever purpose you
44 | * can think of. Constructing the exception in this manner makes the
45 | * exception behave in the normal way - i.e., as documented in the class
46 | * "Throwable". The fields "errorToken", "expectedTokenSequences", and
47 | * "tokenImage" do not contain relevant information. The JavaCC generated
48 | * code does not use these constructors.
49 | */
50 |
51 | public ParseException() {
52 | super();
53 | specialConstructor = false;
54 | }
55 |
56 | public ParseException(String message) {
57 | super(message);
58 | specialConstructor = false;
59 | }
60 |
61 | /**
62 | * This variable determines which constructor was used to create this object
63 | * and thereby affects the semantics of the "getMessage" method (see below).
64 | */
65 | protected boolean specialConstructor;
66 |
67 | /**
68 | * This is the last token that has been consumed successfully. If this
69 | * object has been created due to a parse error, the token followng this
70 | * token will (therefore) be the first error token.
71 | */
72 | public Token currentToken;
73 |
74 | /**
75 | * Each entry in this array is an array of integers. Each array of integers
76 | * represents a sequence of tokens (by their ordinal values) that is
77 | * expected at this point of the parse.
78 | */
79 | public int[][] expectedTokenSequences;
80 |
81 | /**
82 | * This is a reference to the "tokenImage" array of the generated parser
83 | * within which the parse error occurred. This array is defined in the
84 | * generated ...Constants interface.
85 | */
86 | public String[] tokenImage;
87 |
88 | /**
89 | * This method has the standard behavior when this object has been created
90 | * using the standard constructors. Otherwise, it uses "currentToken" and
91 | * "expectedTokenSequences" to generate a parse error message and returns
92 | * it. If this object has been created due to a parse error, and you do not
93 | * catch it (it gets thrown from the parser), then this method is called
94 | * during the printing of the final stack trace, and hence the correct error
95 | * message gets displayed.
96 | */
97 | public String getMessage() {
98 | if (!specialConstructor) {
99 | return super.getMessage();
100 | }
101 | String expected = "";
102 | int maxSize = 0;
103 | for (int i = 0; i < expectedTokenSequences.length; i++) {
104 | if (maxSize < expectedTokenSequences[i].length) {
105 | maxSize = expectedTokenSequences[i].length;
106 | }
107 | for (int j = 0; j < expectedTokenSequences[i].length; j++) {
108 | expected += tokenImage[expectedTokenSequences[i][j]] + " ";
109 | }
110 | if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
111 | expected += "...";
112 | }
113 | expected += eol + " ";
114 | }
115 | String retval = "Encountered \"";
116 | Token tok = currentToken.next;
117 | for (int i = 0; i < maxSize; i++) {
118 | if (i != 0)
119 | retval += " ";
120 | if (tok.kind == 0) {
121 | retval += tokenImage[0];
122 | break;
123 | }
124 | retval += add_escapes(tok.image);
125 | tok = tok.next;
126 | }
127 | retval += "\" at line " + currentToken.next.beginLine + ", column " + currentToken.next.beginColumn;
128 | retval += "." + eol;
129 | if (expectedTokenSequences.length == 1) {
130 | retval += "Was expecting:" + eol + " ";
131 | } else {
132 | retval += "Was expecting one of:" + eol + " ";
133 | }
134 | retval += expected;
135 | return retval;
136 | }
137 |
138 | /**
139 | * The end of line string for this machine.
140 | */
141 | protected String eol = System.getProperty("line.separator", "\n");
142 |
143 | /**
144 | * Used to convert raw characters to their escaped version when these raw
145 | * version cannot be used as part of an ASCII string literal.
146 | */
147 | protected String add_escapes(String str) {
148 | StringBuffer retval = new StringBuffer();
149 | char ch;
150 | for (int i = 0; i < str.length(); i++) {
151 | switch (str.charAt(i)) {
152 | case 0:
153 | continue;
154 | case '\b':
155 | retval.append("\\b");
156 | continue;
157 | case '\t':
158 | retval.append("\\t");
159 | continue;
160 | case '\n':
161 | retval.append("\\n");
162 | continue;
163 | case '\f':
164 | retval.append("\\f");
165 | continue;
166 | case '\r':
167 | retval.append("\\r");
168 | continue;
169 | case '\"':
170 | retval.append("\\\"");
171 | continue;
172 | case '\'':
173 | retval.append("\\\'");
174 | continue;
175 | case '\\':
176 | retval.append("\\\\");
177 | continue;
178 | default:
179 | if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
180 | String s = "0000" + Integer.toString(ch, 16);
181 | retval.append("\\u" + s.substring(s.length() - 4, s.length()));
182 | } else {
183 | retval.append(ch);
184 | }
185 | continue;
186 | }
187 | }
188 | return retval.toString();
189 | }
190 |
191 | }
192 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/express/population/Part21ParserConstants.java:
--------------------------------------------------------------------------------
1 | /* Generated By:JavaCC: Do not edit this line. Part21ParserConstants.java */
2 | package nl.tue.buildingsmart.express.population;
3 |
4 | /******************************************************************************
5 | * Copyright (C) 2009-2016 BIMserver.org
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Affero General Public License as
9 | * published by the Free Software Foundation, either version 3 of the
10 | * License, or (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Affero General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Affero General Public License
18 | * along with this program. If not, see {@literal}.
19 | *****************************************************************************/
20 |
21 | public interface Part21ParserConstants {
22 |
23 | /** End of File. */
24 | int EOF = 0;
25 | /** RegularExpression Id. */
26 | int EMBEDDED_REMARK = 6;
27 | /** RegularExpression Id. */
28 | int LPAREN = 7;
29 | /** RegularExpression Id. */
30 | int RPAREN = 8;
31 | /** RegularExpression Id. */
32 | int LBRACE = 9;
33 | /** RegularExpression Id. */
34 | int RBRACE = 10;
35 | /** RegularExpression Id. */
36 | int LBRACKET = 11;
37 | /** RegularExpression Id. */
38 | int RBRACKET = 12;
39 | /** RegularExpression Id. */
40 | int SEMICOLON = 13;
41 | /** RegularExpression Id. */
42 | int COLON = 14;
43 | /** RegularExpression Id. */
44 | int COMMA = 15;
45 | /** RegularExpression Id. */
46 | int DOT = 16;
47 | /** RegularExpression Id. */
48 | int EQ = 17;
49 | /** RegularExpression Id. */
50 | int DOLLAR = 18;
51 | /** RegularExpression Id. */
52 | int STAR = 19;
53 | /** RegularExpression Id. */
54 | int SLASH = 20;
55 | /** RegularExpression Id. */
56 | int INTEGER = 21;
57 | /** RegularExpression Id. */
58 | int KEYWORD = 22;
59 | /** RegularExpression Id. */
60 | int USER_DEFINED_KEYWORD = 23;
61 | /** RegularExpression Id. */
62 | int STANDARD_KEYWORD = 24;
63 | /** RegularExpression Id. */
64 | int SIGN = 25;
65 | /** RegularExpression Id. */
66 | int REAL = 26;
67 | /** RegularExpression Id. */
68 | int NON_Q_CHAR = 27;
69 | /** RegularExpression Id. */
70 | int STRING = 28;
71 | /** RegularExpression Id. */
72 | int ENTITY_INSTANCE_NAME = 29;
73 | /** RegularExpression Id. */
74 | int ENUMERATION = 30;
75 | /** RegularExpression Id. */
76 | int HEX = 31;
77 | /** RegularExpression Id. */
78 | int BINARY = 32;
79 | /** RegularExpression Id. */
80 | int DIGIT = 33;
81 | /** RegularExpression Id. */
82 | int LOWER = 34;
83 | /** RegularExpression Id. */
84 | int UPPER = 35;
85 | /** RegularExpression Id. */
86 | int SPECIAL = 36;
87 | /** RegularExpression Id. */
88 | int REVERSE_SOLIDUS = 37;
89 | /** RegularExpression Id. */
90 | int APOSTROPHE = 38;
91 | /** RegularExpression Id. */
92 | int CHARACTER = 39;
93 | /** RegularExpression Id. */
94 | int CONTROL_DIRECTIVE = 40;
95 | /** RegularExpression Id. */
96 | int PAGE = 41;
97 | /** RegularExpression Id. */
98 | int ALPHABET = 42;
99 | /** RegularExpression Id. */
100 | int EXTENDED2 = 43;
101 | /** RegularExpression Id. */
102 | int EXTENDED4 = 44;
103 | /** RegularExpression Id. */
104 | int END_EXTENDED = 45;
105 | /** RegularExpression Id. */
106 | int ARBITRARY = 46;
107 | /** RegularExpression Id. */
108 | int HEX_ONE = 47;
109 | /** RegularExpression Id. */
110 | int HEX_TWO = 48;
111 | /** RegularExpression Id. */
112 | int HEX_FOUR = 49;
113 |
114 | /** Lexical state. */
115 | int DEFAULT = 0;
116 |
117 | /** Literal token values. */
118 | String[] tokenImage = { "", "\" \"", "\"\\t\"", "\"\\n\"", "\"\\r\"", "\"\\f\"", "", "\"(\"", "\")\"", "\"{\"", "\"}\"", "\"[\"", "\"]\"", "\";\"",
119 | "\":\"", "\",\"", "\".\"", "\"=\"", "\"$\"", "\"*\"", "\"/\"", "", "", "", "", "", "",
120 | "", "", "", "", "", "", "", "", "", "", "\"\\\\\"", "\"\\\'\"",
121 | "", "", "", "", "", "", "", "", "", "", "",
122 | "\"ISO-10303-21;\"", "\"END-ISO-10303-21\"", "\"HEADER;\"", "\"ENDSEC;\"", "\"DATA;\"", "\"&SCOPE\"", "\"ENDSCOPE\"", };
123 |
124 | }
125 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/express/population/Token.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.express.population;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class Token {
21 |
22 | /**
23 | * An integer that describes the kind of this token. This numbering system
24 | * is determined by JavaCCParser, and a table of these numbers is stored in
25 | * the file ...Constants.java.
26 | */
27 | public int kind;
28 |
29 | /**
30 | * beginLine and beginColumn describe the position of the first character of
31 | * this token; endLine and endColumn describe the position of the last
32 | * character of this token.
33 | */
34 | public int beginLine, beginColumn, endLine, endColumn;
35 |
36 | /**
37 | * The string image of the token.
38 | */
39 | public String image;
40 |
41 | /**
42 | * A reference to the next regular (non-special) token from the input
43 | * stream. If this is the last token from the input stream, or if the token
44 | * manager has not read tokens beyond this one, this field is set to null.
45 | * This is true only if this token is also a regular token. Otherwise, see
46 | * below for a description of the contents of this field.
47 | */
48 | public Token next;
49 |
50 | /**
51 | * This field is used to access special tokens that occur prior to this
52 | * token, but after the immediately preceding regular (non-special) token.
53 | * If there are no such special tokens, this field is set to null. When
54 | * there are more than one such special token, this field refers to the last
55 | * of these special tokens, which in turn refers to the next previous
56 | * special token through its specialToken field, and so on until the first
57 | * special token (whose specialToken field is null). The next fields of
58 | * special tokens refer to other special tokens that immediately follow it
59 | * (without an intervening regular token). If there is no such token, this
60 | * field is null.
61 | */
62 | public Token specialToken;
63 |
64 | /**
65 | * Returns the image.
66 | */
67 | public String toString() {
68 | return image;
69 | }
70 |
71 | /**
72 | * Returns a new Token object, by default. However, if you want, you can
73 | * create and return subclass objects based on the value of ofKind. Simply
74 | * add the cases to the switch for all those special cases. For example, if
75 | * you have a subclass of Token called IDToken that you want to create if
76 | * ofKind is ID, simlpy add something like :
77 | *
78 | * case MyParserConstants.ID : return new IDToken();
79 | *
80 | * to the following switch statement. Then you can cast matchedToken
81 | * variable to the appropriate type and use it in your lexical actions.
82 | */
83 | public static final Token newToken(int ofKind) {
84 | switch (ofKind) {
85 | default:
86 | return new Token();
87 | }
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/express/population/TokenMgrError.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.express.population;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class TokenMgrError extends Error {
21 | /*
22 | * Ordinals for various reasons why an Error of this type can be thrown.
23 | */
24 |
25 | private static final long serialVersionUID = 835629989072666810L;
26 |
27 | /**
28 | * Lexical error occured.
29 | */
30 | static final int LEXICAL_ERROR = 0;
31 |
32 | /**
33 | * An attempt wass made to create a second instance of a static token
34 | * manager.
35 | */
36 | static final int STATIC_LEXER_ERROR = 1;
37 |
38 | /**
39 | * Tried to change to an invalid lexical state.
40 | */
41 | static final int INVALID_LEXICAL_STATE = 2;
42 |
43 | /**
44 | * Detected (and bailed out of) an infinite loop in the token manager.
45 | */
46 | static final int LOOP_DETECTED = 3;
47 |
48 | /**
49 | * Indicates the reason why the exception is thrown. It will have one of the
50 | * above 4 values.
51 | */
52 | int errorCode;
53 |
54 | /**
55 | * Replaces unprintable characters by their espaced (or unicode escaped)
56 | * equivalents in the given string
57 | */
58 | protected static final String addEscapes(String str) {
59 | StringBuffer retval = new StringBuffer();
60 | char ch;
61 | for (int i = 0; i < str.length(); i++) {
62 | switch (str.charAt(i)) {
63 | case 0:
64 | continue;
65 | case '\b':
66 | retval.append("\\b");
67 | continue;
68 | case '\t':
69 | retval.append("\\t");
70 | continue;
71 | case '\n':
72 | retval.append("\\n");
73 | continue;
74 | case '\f':
75 | retval.append("\\f");
76 | continue;
77 | case '\r':
78 | retval.append("\\r");
79 | continue;
80 | case '\"':
81 | retval.append("\\\"");
82 | continue;
83 | case '\'':
84 | retval.append("\\\'");
85 | continue;
86 | case '\\':
87 | retval.append("\\\\");
88 | continue;
89 | default:
90 | if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
91 | String s = "0000" + Integer.toString(ch, 16);
92 | retval.append("\\u" + s.substring(s.length() - 4, s.length()));
93 | } else {
94 | retval.append(ch);
95 | }
96 | continue;
97 | }
98 | }
99 | return retval.toString();
100 | }
101 |
102 | /**
103 | * Returns a detailed message for the Error when it is thrown by the token
104 | * manager to indicate a lexical error. Parameters : EOFSeen : indicates if
105 | * EOF caused the lexicl error curLexState : lexical state in which this
106 | * error occured errorLine : line number when the error occured errorColumn
107 | * : column number when the error occured errorAfter : prefix that was seen
108 | * before this error occured curchar : the offending character Note: You can
109 | * customize the lexical error message by modifying this method.
110 | */
111 | protected static String LexicalError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar) {
112 | return ("Lexical error at line " + errorLine + ", column " + errorColumn + ". Encountered: "
113 | + (EOFSeen ? " " : ("\"" + addEscapes(String.valueOf(curChar)) + "\"") + " (" + (int) curChar + "), ") + "after : \"" + addEscapes(errorAfter) + "\"");
114 | }
115 |
116 | /**
117 | * You can also modify the body of this method to customize your error
118 | * messages. For example, cases like LOOP_DETECTED and INVALID_LEXICAL_STATE
119 | * are not of end-users concern, so you can return something like :
120 | *
121 | * "Internal Error : Please file a bug report .... "
122 | *
123 | * from this method for such cases in the release version of your parser.
124 | */
125 | public String getMessage() {
126 | return super.getMessage();
127 | }
128 |
129 | /*
130 | * Constructors of various flavors follow.
131 | */
132 |
133 | public TokenMgrError() {
134 | }
135 |
136 | public TokenMgrError(String message, int reason) {
137 | super(message);
138 | errorCode = reason;
139 | }
140 |
141 | public TokenMgrError(boolean EOFSeen, int lexState, int errorLine, int errorColumn, String errorAfter, char curChar, int reason) {
142 | this(LexicalError(EOFSeen, lexState, errorLine, errorColumn, errorAfter, curChar), reason);
143 | }
144 | }
145 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/express/population/test/PopulationMetrics.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.express.population.test;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | import java.io.File;
21 | import java.io.FileInputStream;
22 | import java.io.IOException;
23 | import java.nio.file.Paths;
24 | import java.util.HashMap;
25 | import java.util.TreeSet;
26 |
27 | import nl.tue.buildingsmart.express.dictionary.Namespaces;
28 | import nl.tue.buildingsmart.express.population.EntityInstance;
29 | import nl.tue.buildingsmart.express.population.ModelPopulation;
30 |
31 | @SuppressWarnings("all")
32 | public class PopulationMetrics {
33 | ModelPopulation pop;
34 | Namespaces nsConf;
35 | HashMap namespaceMembers = new HashMap();
36 |
37 | public PopulationMetrics(ModelPopulation pop, Namespaces nsConf) {
38 |
39 | this.pop = pop;
40 | this.nsConf = nsConf;
41 | }
42 |
43 | public void countEntitiesPerNamespace() {
44 | for (String ns : nsConf.getNamespaces()) {
45 | namespaceMembers.put(ns, new Integer(0));
46 | }
47 | for (EntityInstance entInst : pop.getInstances().values()) {
48 | String ns = nsConf.getNS(entInst.getEntityDefinition().getName());
49 | if(ns==null){
50 | System.out.println("Namespace for " + entInst.getEntityDefinition().getName() + " not found!");
51 | } else {
52 | namespaceMembers.put(ns, namespaceMembers.get(ns) + 1);
53 | }
54 | }
55 | TreeSet ts = new TreeSet(namespaceMembers.keySet());
56 | for (String ns : ts) {
57 |
58 | System.out.println(ns + ";" + namespaceMembers.get(ns));
59 | }
60 | }
61 |
62 | public static void main(String[] args) throws IOException {
63 | if(args.length > 1 ){
64 | try(FileInputStream spf = new FileInputStream(args[0])){
65 | Namespaces namespaces = new Namespaces(args[1]);
66 | if(namespaces.readNSConfig()){
67 | System.out.println("read ns config");
68 | } else {
69 | System.out.println("failed to read ns config");
70 | }
71 | for (String namespace: namespaces.getNamespaces()) {
72 | System.out.println(namespace);
73 | // System.out.println(String.join(", ", namespaces.getNamespaceMembers(namespace)));
74 | }
75 | ModelPopulation model = new ModelPopulation(spf);
76 | model.setSchemaFile(Paths.get("src", "schema", "IFC2X3_TC1.exp"));
77 | model.load();
78 | new PopulationMetrics(model, namespaces).countEntitiesPerNamespace();
79 | }
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/express/population/test/PopulationTest.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.express.population.test;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | import java.io.File;
21 | import java.io.FileInputStream;
22 | import java.io.FileNotFoundException;
23 | import java.nio.file.Paths;
24 |
25 | import org.slf4j.Logger;
26 | import org.slf4j.LoggerFactory;
27 |
28 | import nl.tue.buildingsmart.express.population.ModelPopulation;
29 |
30 | public class PopulationTest {
31 |
32 | private static final Logger LOGGER = LoggerFactory.getLogger(PopulationTest.class);
33 | private ModelPopulation model;
34 |
35 | /**
36 | * @param args
37 | */
38 | public static void main(String[] args) {
39 | new PopulationTest().start(new File(args[0]));
40 | }
41 |
42 | private void start(File file) {
43 | try {
44 | FileInputStream input = new FileInputStream(file);
45 | /*
46 | * byte[] contents= new byte[100]; try {
47 | *
48 | * input.read(contents); } catch (IOException e) { // TODO
49 | * Auto-generated catch block LOGGER.error("", e); }
50 | */
51 | model = new ModelPopulation(input);
52 | model.setSchemaFile(Paths.get("src", "schema", "IFC2X3_TC1.exp"));
53 | model.load();
54 |
55 | System.out.println(model.getInstancesOfType("IfcWall").size());
56 |
57 | System.out.println("ready");
58 | } catch (FileNotFoundException e) {
59 | // TODO Auto-generated catch block
60 | LOGGER.error("", e);
61 |
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/AggregationType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public abstract class AggregationType implements BaseType, UnderlyingType{
21 | /**
22 | * the base type this aggregation collects
23 | */
24 | private BaseType element_type;
25 |
26 |
27 | /** Standard constructor
28 | * @param element_type a base element type this aggregation collects
29 | */
30 | public AggregationType( BaseType element_type) {
31 |
32 | this.element_type = element_type;
33 | }
34 |
35 | /**
36 | * @return the element type this type aggregates
37 | */
38 | public BaseType getElement_type() {
39 | return element_type;
40 | }
41 |
42 | /**
43 | * @param element_type set the base type this type aggregates
44 | */
45 | public void setElement_type(BaseType element_type) {
46 | this.element_type = element_type;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/ArrayType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class ArrayType extends AggregationType {
21 | private Bound lower_index;
22 | private Bound upper_index;
23 | private boolean unique_flag;
24 | private boolean optional_flag;
25 |
26 | public ArrayType(BaseType element_type) {
27 | super(element_type);
28 | // TODO Auto-generated constructor stub
29 | }
30 |
31 |
32 |
33 | public Bound getLower_index() {
34 | return lower_index;
35 | }
36 |
37 | public void setLower_index(Bound lower_index) {
38 | this.lower_index = lower_index;
39 | }
40 |
41 | public boolean isOptional_flag() {
42 | return optional_flag;
43 | }
44 |
45 | public void setOptional_flag(boolean optional_flag) {
46 | this.optional_flag = optional_flag;
47 | }
48 |
49 | public boolean isUnique_flag() {
50 | return unique_flag;
51 | }
52 |
53 | public void setUnique_flag(boolean unique_flag) {
54 | this.unique_flag = unique_flag;
55 | }
56 |
57 | public Bound getUpper_index() {
58 | return upper_index;
59 | }
60 |
61 | public void setUpper_index(Bound upper_index) {
62 | this.upper_index = upper_index;
63 | }
64 |
65 | }
66 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/Attribute.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public abstract class Attribute {
21 | private String name;
22 | private EntityDefinition parent_entity;
23 | private boolean derived;
24 |
25 | public Attribute(String name, EntityDefinition parent_entity) {
26 |
27 | this.name = name;
28 | this.parent_entity = parent_entity;
29 | }
30 |
31 | public String getName() {
32 | return name;
33 | }
34 |
35 | public void setName(String name) {
36 | this.name = name;
37 | }
38 |
39 | public EntityDefinition getParent_entity() {
40 | return parent_entity;
41 | }
42 |
43 | public void setParent_entity(EntityDefinition parent_entity) {
44 | this.parent_entity = parent_entity;
45 | }
46 |
47 | public void setDerived(boolean derived) {
48 | this.derived = derived;
49 | }
50 |
51 | public boolean isDerived() {
52 | return derived;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/BagType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class BagType extends VariableSizeAggregationType {
21 |
22 | public BagType(BaseType element_type) {
23 | super(element_type);
24 | // TODO Auto-generated constructor stub
25 | }
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/BaseType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public interface BaseType {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/BinaryType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class BinaryType extends SimpleType {
21 |
22 | public BinaryType() {
23 | super();
24 | // TODO Auto-generated constructor stub
25 | }
26 |
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/BooleanType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class BooleanType extends SimpleType {
21 |
22 | public BooleanType() {
23 | super();
24 | // TODO Auto-generated constructor stub
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/Bound.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public abstract class Bound {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/ConstructedType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public interface ConstructedType extends UnderlyingType {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/DefinedType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class DefinedType extends NamedType implements UnderlyingType{
21 | private UnderlyingType domain;
22 |
23 | public UnderlyingType getDomain() {
24 | return domain;
25 | }
26 |
27 | public void setDomain(UnderlyingType domain) {
28 | this.domain = domain;
29 | }
30 |
31 | public DefinedType(String name, UnderlyingType domain) {
32 | super(name);
33 | this.domain = domain;
34 | }
35 |
36 | public DefinedType(String name) {
37 | super(name);
38 | // TODO Auto-generated constructor stub
39 | }
40 | public UnderlyingType getDomain(boolean includeSubtypes){
41 | UnderlyingType ut = this.domain;
42 | if (ut instanceof DefinedType ){
43 | ut = ((DefinedType)domain).getDomain(includeSubtypes);
44 | }
45 | return ut;
46 | }
47 |
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/DerivedAttribute.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class DerivedAttribute extends Attribute implements UnderlyingType {
21 |
22 | public DerivedAttribute(String name, EntityDefinition parent_entity) {
23 | super(name, parent_entity);
24 | // TODO Auto-generated constructor stub
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/DerivedAttribute2.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class DerivedAttribute2 {
21 | private String name;
22 | private BaseType type;
23 | private String expressCode;
24 | private final boolean collection;
25 | private boolean hasSuper;
26 |
27 | public DerivedAttribute2 (String name, BaseType type, String expressCode, boolean collection, boolean hasSuper) {
28 | this.name = name;
29 | this.type = type;
30 | this.expressCode = expressCode;
31 | this.collection = collection;
32 | this.hasSuper = hasSuper;
33 | }
34 |
35 | public String getName() {
36 | return name;
37 | }
38 |
39 | public BaseType getType() {
40 | return type;
41 | }
42 |
43 | public String getExpressCode() {
44 | return expressCode;
45 | }
46 |
47 | public boolean isCollection() {
48 | return collection;
49 | }
50 |
51 | public boolean hasSuper() {
52 | return hasSuper;
53 | }
54 | }
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/EntityDefinition.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | import java.util.ArrayList;
21 | import java.util.HashMap;
22 | import java.util.HashSet;
23 | import java.util.Iterator;
24 | import java.util.Map;
25 | import java.util.Set;
26 |
27 | public class EntityDefinition extends NamedType {
28 | // store each supertype in both a list and a hashtable for convenience
29 | private ArrayList supertypes = new ArrayList();
30 | private HashMap supertypesBN = new HashMap();
31 | // store each attribute in both a list and a hashtable for convenience
32 | private ArrayList attributes = new ArrayList();
33 | private HashMap attributesBN = new HashMap();
34 |
35 | private HashMap attributesPlusSuperBN;
36 | private ArrayList attributesPlusSuper;
37 |
38 | private ArrayList subtypes = new ArrayList();
39 | private final Map derivedAttributes = new HashMap();
40 | private final Set derivedAttributesOverride = new HashSet();
41 | boolean complex;
42 | boolean instantiable;
43 | boolean independent;
44 |
45 | public EntityDefinition(String name) {
46 | super(name);
47 | }
48 |
49 | public boolean isDerived(String name) {
50 | return derivedAttributes.containsKey(name);
51 | }
52 |
53 | public String toString() {
54 | return this.getName();
55 | }
56 |
57 | public boolean addAttribute(Attribute a) {
58 | a.setParent_entity(this);
59 | attributes.add(a);
60 | attributesBN.put(a.getName(), a);
61 | return true;
62 | }
63 |
64 | public void addDerived(DerivedAttribute2 attribute, boolean firstOccurance) {
65 | if (!derivedAttributes.containsKey(attribute.getName())) {
66 | derivedAttributes.put(attribute.getName(), attribute);
67 | } else {
68 | if (firstOccurance) {
69 | derivedAttributes.put(attribute.getName(), attribute);
70 | }
71 | }
72 | for (EntityDefinition entityDefinition : supertypes) {
73 | if (entityDefinition.getAttributeBNWithSuper(attribute.getName()) != null) {
74 | derivedAttributesOverride.add(attribute.getName());
75 | }
76 | }
77 | doSubtypes(attribute);
78 | }
79 |
80 | private void doSubtypes(DerivedAttribute2 attribute) {
81 | for (EntityDefinition entityDefinition : subtypes) {
82 | entityDefinition.addDerived(new DerivedAttribute2(attribute.getName(), attribute.getType(), attribute.getExpressCode(), attribute.isCollection(), true), false);
83 | entityDefinition.doSubtypes(attribute);
84 | }
85 | }
86 |
87 | public Attribute getAttributeBN(String name) {
88 | return attributesBN.get(name);
89 | }
90 |
91 | public Attribute getAttributeBNWithSuper(String name) {
92 | if (attributesBN.containsKey(name)) {
93 | return attributesBN.get(name);
94 | }
95 | if (attributesPlusSuperBN == null) {
96 | getAttributesCached(true);
97 | }
98 | if (attributesPlusSuperBN.containsKey(name)) {
99 | return attributesPlusSuperBN.get(name);
100 | }
101 | return null;
102 | }
103 |
104 | public boolean addSupertype(EntityDefinition parent) {
105 | supertypes.add(parent);
106 | supertypesBN.put(parent.getName(), parent);
107 | return true;
108 | }
109 |
110 | public ArrayList getAttributes() {
111 | return attributes;
112 | }
113 |
114 | /**
115 | * returns all Attirbutes of this ENTITY. Optionally also returns all
116 | * inherited Attributes from the parents
117 | *
118 | * @param returnInherited
119 | * if true also returns inherited attributs
120 | * @return
121 | */
122 | public ArrayList getAttributes(boolean returnInherited) {
123 | if (!returnInherited)
124 | return this.getAttributes();
125 | else {
126 | ArrayList tempAttribs = new ArrayList();
127 | Iterator parentIter = this.getSupertypes().iterator();
128 | while (parentIter.hasNext()) {
129 | tempAttribs = parentIter.next().getAttributes(true);
130 | }
131 | Iterator attribIter = this.getAttributes().iterator();
132 | while (attribIter.hasNext())
133 | tempAttribs.add(attribIter.next());
134 | return tempAttribs;
135 | }
136 | }
137 |
138 | public ArrayList getAttributesCached(boolean returnInherited) {
139 | if (!returnInherited)
140 | return this.getAttributes();
141 | else {
142 | if (attributesPlusSuper == null) {
143 | attributesPlusSuper = getAttributes(true);
144 | attributesPlusSuperBN = new HashMap();
145 | for (Attribute attribute : attributesPlusSuper) {
146 | attributesPlusSuperBN.put(attribute.getName(), attribute);
147 | }
148 | }
149 | return attributesPlusSuper;
150 | }
151 | }
152 |
153 | public void setAttributes(ArrayList attributes) {
154 | this.attributes = attributes;
155 | }
156 |
157 | public HashMap getAttributesBN() {
158 | return attributesBN;
159 | }
160 |
161 | public void setAttributesBN(HashMap attributesBN) {
162 | this.attributesBN = attributesBN;
163 | }
164 |
165 | public ArrayList getSupertypes() {
166 | return supertypes;
167 | }
168 |
169 | public void setSupertypes(ArrayList supertypes) {
170 | this.supertypes = supertypes;
171 | }
172 |
173 | public HashMap getSupertypesBN() {
174 | return supertypesBN;
175 | }
176 |
177 | public void setSupertypesBN(HashMap supertypesBN) {
178 | this.supertypesBN = supertypesBN;
179 | }
180 |
181 | public ArrayList getSubtypes() {
182 | if (this.subtypes == null)
183 | this.subtypes = new ArrayList();
184 | return subtypes;
185 | }
186 |
187 | public void setSubtypes(ArrayList subtypes) {
188 | this.subtypes = subtypes;
189 | }
190 |
191 | public void addSubtype(EntityDefinition subClass) {
192 | this.subtypes.add(subClass);
193 | }
194 |
195 | public boolean isInstantiable() {
196 | return instantiable;
197 | }
198 |
199 | public void setInstantiable(boolean instantiable) {
200 | this.instantiable = instantiable;
201 | }
202 |
203 | public Map getDerivedAttributes() {
204 | return derivedAttributes;
205 | }
206 |
207 | public boolean isDerivedOverride(String name) {
208 | return derivedAttributesOverride.contains(name);
209 | }
210 | }
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/EnumerationType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | import java.util.HashSet;
21 |
22 |
23 | public class EnumerationType extends DefinedType implements ConstructedType {
24 |
25 | private HashSet elements = new HashSet();
26 |
27 | public EnumerationType(String name, UnderlyingType domain) {
28 | super(name, domain);
29 | // TODO Auto-generated constructor stub
30 | }
31 |
32 | public EnumerationType(String name) {
33 | super(name);
34 | // TODO Auto-generated constructor stub
35 | }
36 |
37 | public void addElement(String e){
38 | elements.add(e);
39 | }
40 |
41 | public HashSet getElements() {
42 | return elements;
43 | }
44 |
45 | public void setElements(HashSet elements) {
46 | this.elements = elements;
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/ExplicitAttribute.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class ExplicitAttribute extends Attribute implements UnderlyingType,
21 | ExplicitOrDerived {
22 |
23 | private BaseType domain;
24 | private ExplicitOrDerived redeclares;
25 | private boolean optional = false;
26 | private boolean derived = false;
27 |
28 | public ExplicitAttribute(String name, EntityDefinition parent_entity) {
29 | super(name, parent_entity);
30 | }
31 |
32 | public BaseType getDomain() {
33 | return domain;
34 | }
35 |
36 | public BaseType getDomain(boolean includeSubtypes) {
37 | BaseType bt = this.domain;
38 | if (bt instanceof DefinedType)
39 | bt = (BaseType) ((DefinedType) bt).getDomain(true);
40 | return bt;
41 | }
42 |
43 | public void setDomain(BaseType domain) {
44 | this.domain = domain;
45 |
46 | }
47 |
48 | public ExplicitOrDerived getRedeclares() {
49 | return redeclares;
50 | }
51 |
52 | public void setRedeclares(ExplicitOrDerived redeclares) {
53 | this.redeclares = redeclares;
54 | }
55 |
56 | public boolean isDerived() {
57 | return derived;
58 | }
59 |
60 | public void setDerived(boolean derived) {
61 | // LOGGER.info("derived: " + derived);
62 | this.derived = derived;
63 | }
64 |
65 | public boolean isOptional() {
66 | return optional;
67 | }
68 |
69 | public void setOptional(boolean optional_flag) {
70 | this.optional = optional_flag;
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/ExplicitOrDerived.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public interface ExplicitOrDerived {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/IntegerBound.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class IntegerBound extends Bound {
21 | //-1 == unbounded
22 | private int bound_value = -1;
23 |
24 | public int getBound_value() {
25 | return bound_value;
26 | }
27 |
28 | public void setBound_value(int bound_value) {
29 | this.bound_value = bound_value;
30 | }
31 |
32 | public IntegerBound() {
33 | super();
34 | // TODO Auto-generated constructor stub
35 | }
36 |
37 | public IntegerBound(int bound_value) {
38 | super();
39 | this.bound_value = bound_value;
40 | }
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/IntegerType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class IntegerType extends SimpleType {
21 |
22 | public IntegerType() {
23 | super();
24 | // TODO Auto-generated constructor stub
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/InverseAttribute.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class InverseAttribute extends
21 | Attribute implements
22 | UnderlyingType {
23 |
24 | private EntityDefinition domain = null;
25 | private ExplicitAttribute inverted_attr = null;
26 | private Bound min_cardinality, max_cardinality;
27 |
28 | public InverseAttribute(String name, EntityDefinition parent_entity) {
29 | super(name, parent_entity);
30 | }
31 |
32 | public EntityDefinition getDomain() {
33 | return domain;
34 | }
35 |
36 | public void setDomain(EntityDefinition domain) {
37 | this.domain = domain;
38 | }
39 |
40 | public ExplicitAttribute getInverted_attr() {
41 | return inverted_attr;
42 | }
43 |
44 | public void setInverted_attr(ExplicitAttribute inverted_attr) {
45 | this.inverted_attr = inverted_attr;
46 | }
47 |
48 | public Bound getMax_cardinality() {
49 | return max_cardinality;
50 | }
51 |
52 | public void setMax_cardinality(Bound max_cardinality) {
53 | this.max_cardinality = max_cardinality;
54 | }
55 |
56 | public Bound getMin_cardinality() {
57 | return min_cardinality;
58 | }
59 |
60 | public void setMin_cardinality(Bound min_cardinality) {
61 | this.min_cardinality = min_cardinality;
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/ListType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class ListType extends VariableSizeAggregationType {
21 |
22 | public ListType(BaseType element_type) {
23 | super(element_type);
24 | // TODO Auto-generated constructor stub
25 | }
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/LogicalType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class LogicalType extends SimpleType {
21 |
22 | public LogicalType() {
23 | super();
24 | // TODO Auto-generated constructor stub
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/NamedType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public abstract class NamedType implements BaseType, TypeOrRule {
21 | private String name = "";
22 | //TODO Where Rules
23 |
24 | public NamedType(String name) {
25 | super();
26 | this.name = name;
27 | }
28 |
29 | public String getName() {
30 | return name;
31 | }
32 |
33 | public void setName(String name) {
34 | this.name = name;
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/NumberType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class NumberType extends SimpleType {
21 |
22 | public NumberType() {
23 | super();
24 | // TODO Auto-generated constructor stub
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/PopulationDependendBound.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class PopulationDependendBound extends Bound {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/RealType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class RealType extends SimpleType {
21 |
22 | public RealType() {
23 | super();
24 | // TODO Auto-generated constructor stub
25 | }
26 |
27 | }
28 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/Schema.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public interface Schema {
21 |
22 | EntityDefinition getEntityBNNoCaseConvert(String string);
23 |
24 | EntityDefinition getEntityBN(String name);
25 | }
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/SchemaDefinition.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | import java.util.ArrayList;
21 | import java.util.HashMap;
22 | import java.util.Iterator;
23 |
24 | /**
25 | * Holds the definitions of TYPEs
(see {@link BaseType} and its
26 | * implementations), ENTITY
s (see {@link EntityDefinition}) and
27 | * their ATTRIBUTE
s (see {@link Attribute} as defined in a ISO
28 | * 10303 EXPRESS
schema.
29 | *
30 | * @author Jakob Beetz
31 | *
32 | */
33 | @SuppressWarnings("all")
34 | public class SchemaDefinition implements Schema {
35 |
36 | /**
37 | * the name of the schema
38 | */
39 | private String name;
40 |
41 | /**
42 | * a map of all {@link EntityDefinition}s by their UPPERCASE names as keys
43 | * in this schema
44 | */
45 | private HashMap entitiesBN = new HashMap();
46 | /**
47 | * a list of all {@link EntityDefinition}s in this schema
48 | */
49 | private ArrayList entities = new ArrayList();
50 |
51 | /**
52 | * a hash map of all EXPRESS TYPE
definitions in this schema
53 | * with the UPPERCASE name of the type as its keys
54 | */
55 | private HashMap typesBN = new HashMap();
56 |
57 | /**
58 | * a List of all EXPRESS TYPE
definitions in this schema
59 | */
60 |
61 | private ArrayList types = new ArrayList();
62 |
63 | /**
64 | * hash map of an ordered list of all parents of an ENTITY
65 | * definition. First element is the direct supertype, last the root
66 | * supertype
67 | */
68 | private HashMap> parents = new HashMap>();
69 |
70 | /**
71 | * hash map of all relations that are defined in the EXPRESS
72 | * ATTRIBUTE
s defined locally to a given
73 | * {@link EntityDefinition}. Note:ArrayList does not include
74 | * relations to other entities defined in supertypes
75 | */
76 | private HashMap> entityRelations = new HashMap>();
77 |
78 | private byte[] schemaData;
79 |
80 | /**
81 | * @param ent
82 | * the {@link EntityDefinition} to be added to the schema
83 | * @return true if adding the definition to the schema succeeded
84 | *
85 | */
86 | public boolean addEntity(EntityDefinition ent) {
87 | // TODO exception handling
88 | String entName = ent.getName();
89 | entities.add(ent);
90 | entitiesBN.put(entName.toUpperCase(), ent);
91 |
92 | return true;
93 | }
94 |
95 | /**
96 | * @param type
97 | * the {@link DefinedType} to be added to the total list of types
98 | * defined in this schema
99 | * @return true if successfully added the type definition
100 | */
101 | public boolean addType(DefinedType type) {
102 | types.add(type);
103 | typesBN.put(type.getName().toUpperCase(), type);
104 | return true;
105 | }
106 |
107 | public DefinedType getTypeBN(String name) {
108 | return typesBN.get(name.toUpperCase());
109 | }
110 |
111 | public void constructEntityRelationsMap() {
112 | entityRelations.clear();
113 | Iterator ei = entities.iterator();
114 | while (ei.hasNext()) {
115 | EntityDefinition ent = (EntityDefinition) ei.next();
116 | if (!ent.getAttributes().isEmpty()) {
117 | Iterator ai = ent.getAttributes().iterator();
118 | while (ai.hasNext()) {
119 | Attribute at = (Attribute) ai.next();
120 | if (at instanceof ExplicitAttribute) {
121 | BaseType bt = ((ExplicitAttribute) at).getDomain();
122 | if (bt instanceof EntityDefinition) {
123 | ArrayList rels = entityRelations.get(ent);
124 | if (rels == null) {
125 | entityRelations.put(ent, new ArrayList());
126 | rels = entityRelations.get(ent);
127 | }
128 | rels.add((EntityDefinition) bt);
129 | }
130 |
131 | }
132 | }
133 | }
134 | }
135 | }
136 |
137 | public void constructHirarchyMap() {
138 | parents.clear();
139 | this.parents = new HashMap>();
140 | Iterator ei = entities.iterator();
141 | while (ei.hasNext()) {
142 | EntityDefinition ent = (EntityDefinition) ei.next();
143 | if (!ent.getSupertypes().isEmpty()) {
144 | Iterator iter = ent.getSupertypes().iterator();
145 |
146 | while (iter.hasNext()) {
147 | EntityDefinition parent = (EntityDefinition) iter.next();
148 | if (parents.get(parent) == null)
149 | parents.put(parent, new ArrayList());
150 | ArrayList children = parents.get(parent);
151 | children.add(ent);
152 | parent.addSubtype(ent);
153 | // System.out.println("adding "+ent.getName()+ " to "+
154 | // parent.getName());
155 | }
156 |
157 | }
158 | }
159 |
160 | }
161 |
162 | /**
163 | *
164 | * @param name
165 | * @return a BaseType with the given Name (can be a TYPE or an ENTITY)
166 | */
167 | public BaseType getBaseTypeBN(String name) {
168 | BaseType bt;
169 | bt = typesBN.get(name.toUpperCase());
170 | if (bt == null)
171 | bt = entitiesBN.get(name.toUpperCase());
172 | if (bt == null && name.equalsIgnoreCase("real"))
173 | return new RealType();
174 | if (bt == null && name.equalsIgnoreCase("integer"))
175 | return new IntegerType();
176 | if (bt == null && name.equalsIgnoreCase("binary"))
177 | return new BinaryType();
178 | if (bt == null && name.equalsIgnoreCase("string"))
179 | return new StringType();
180 | if (bt == null && name.equalsIgnoreCase("logical"))
181 | return new LogicalType();
182 |
183 | return bt;
184 | }
185 |
186 | public EntityDefinition getEntityBN(String name) {
187 | return entitiesBN.get(name.toUpperCase());
188 | }
189 |
190 | public EntityDefinition getEntityBNNoCaseConvert(String name) {
191 | return entitiesBN.get(name);
192 | }
193 |
194 | public HashMap getEnitiesBN() {
195 | return entitiesBN;
196 | }
197 |
198 | public void setEnitiesBN(HashMap enitiesBN) {
199 | this.entitiesBN = enitiesBN;
200 | }
201 |
202 | public ArrayList getEntities() {
203 | return entities;
204 | }
205 |
206 | public void setEntities(ArrayList entities) {
207 | this.entities = entities;
208 | }
209 |
210 | public String getName() {
211 | return name;
212 | }
213 |
214 | public void setName(String name) {
215 | this.name = name;
216 | }
217 |
218 | public HashMap getTypesBN() {
219 | return typesBN;
220 | }
221 |
222 | public void setTypesBN(HashMap types) {
223 | this.typesBN = types;
224 | }
225 |
226 | public ArrayList getTypes() {
227 | return types;
228 | }
229 |
230 | public void setTypes(ArrayList typesBN) {
231 | this.types = typesBN;
232 | }
233 |
234 | public SchemaDefinition(String name) throws Exception {
235 | super();
236 | this.name = name;
237 |
238 | }
239 |
240 | public SchemaDefinition() {
241 | super();
242 | }
243 |
244 | public HashMap> getParents() {
245 | return parents;
246 | }
247 |
248 | public ArrayList getEntityChildren(EntityDefinition ent) {
249 | return parents.get(ent);
250 | }
251 |
252 | public ArrayList getEntityRelations(EntityDefinition ent) {
253 |
254 | if (entityRelations.get(ent) == null)
255 | return new ArrayList();
256 | else
257 | return entityRelations.get(ent);
258 | }
259 |
260 | public byte[] getSchemaData() {
261 | return schemaData;
262 | }
263 |
264 | public void setSchemaData(byte[] schemaData) {
265 | this.schemaData = schemaData;
266 | }
267 |
268 | // TODO add rules and external schemas
269 | }
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/SchemaException.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class SchemaException extends Exception {
21 |
22 | private static final long serialVersionUID = 4627067690205941773L;
23 |
24 | public SchemaException(String message) {
25 | super(message);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/SelectType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | import java.util.ArrayList;
21 | import java.util.HashMap;
22 |
23 | public class SelectType extends DefinedType implements ConstructedType {
24 |
25 |
26 | private HashMap selectionsBN = new HashMap();
27 | private ArrayList selections = new ArrayList();
28 |
29 |
30 | public SelectType(String name, UnderlyingType domain) {
31 | super(name, domain);
32 | // TODO Auto-generated constructor stub
33 | }
34 |
35 | /** Copy constructor (shallow copy)
36 | * @param old
37 | */
38 | public SelectType (SelectType old){
39 | super(old.getName(),old.getDomain() );
40 | this.setSelections(old.getSelections());
41 | this.setSelectionsBN(old.getSelectionsBN());
42 | }
43 |
44 | public SelectType(String name){
45 |
46 | super(name);
47 |
48 | super.setDomain(new StringType());
49 |
50 | }
51 |
52 |
53 |
54 | public boolean addSelection(NamedType type){
55 | selectionsBN.put(type.getName(), type);
56 | selections.add(type);
57 | return true;
58 | }
59 |
60 | public NamedType getSelectionBN(String name){
61 | return selectionsBN.get(name);
62 | }
63 |
64 | public ArrayList getSelections() {
65 | return selections;
66 | }
67 |
68 | public void setSelections(ArrayList selections) {
69 | this.selections = selections;
70 | }
71 |
72 | public HashMap getSelectionsBN() {
73 | return selectionsBN;
74 | }
75 |
76 | public void setSelectionsBN(HashMap selectionsBN) {
77 | this.selectionsBN = selectionsBN;
78 | }
79 |
80 | }
81 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/SetType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class SetType extends VariableSizeAggregationType {
21 |
22 | public SetType(BaseType element_type) {
23 | super(element_type);
24 | // TODO Auto-generated constructor stub
25 | }
26 |
27 |
28 |
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/SimpleType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public abstract class SimpleType implements BaseType, UnderlyingType {
21 |
22 |
23 |
24 | public SimpleType() {
25 |
26 |
27 | }
28 |
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/StringType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class StringType extends SimpleType {
21 |
22 | public StringType() {
23 | super();
24 | // TODO Auto-generated constructor stub
25 | }
26 |
27 |
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/TypeOrRule.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public interface TypeOrRule {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/UnderlyingType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public interface UnderlyingType {
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/VariableSizeAggregationType.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public abstract class VariableSizeAggregationType extends AggregationType {
21 |
22 | private Bound lower_bound;
23 | private Bound upper_bound;
24 |
25 |
26 |
27 | public VariableSizeAggregationType(BaseType element_type) {
28 | super(element_type);
29 | // TODO Auto-generated constructor stub
30 | }
31 |
32 | public Bound getLower_bound() {
33 | return lower_bound;
34 | }
35 |
36 | public void setLower_bound(Bound lower_bound) {
37 | this.lower_bound = lower_bound;
38 | }
39 |
40 | public Bound getUpper_bound() {
41 | return upper_bound;
42 | }
43 |
44 | public void setUpper_bound(Bound upper_bound) {
45 | this.upper_bound = upper_bound;
46 | }
47 |
48 | }
49 |
--------------------------------------------------------------------------------
/BuildingSMARTLibrary/src/nl/tue/buildingsmart/schema/WhereRule.java:
--------------------------------------------------------------------------------
1 | package nl.tue.buildingsmart.schema;
2 |
3 | /******************************************************************************
4 | * Copyright (C) 2009-2016 BIMserver.org
5 | *
6 | * This program is free software: you can redistribute it and/or modify
7 | * it under the terms of the GNU Affero General Public License as
8 | * published by the Free Software Foundation, either version 3 of the
9 | * License, or (at your option) any later version.
10 | *
11 | * This program is distributed in the hope that it will be useful,
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 | * GNU Affero General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU Affero General Public License
17 | * along with this program. If not, see {@literal}.
18 | *****************************************************************************/
19 |
20 | public class WhereRule implements TypeOrRule {
21 | String label ="";
22 | TypeOrRule parentItem;
23 | }
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Author: Jakob Beetz Eindhoven University of Technology
2 | This is the initial dump of some utility libraries to access STEP schemas and population files.
3 |
4 | Currently only a very limited amount of javadoc tags has been added to the packages
5 | and the sources.
6 |
7 | The library consists of 6 packages:
8 |
9 | - net.sourceforge.osexpress.parser
10 | a parser generator written by Josh Lubel et al in the context of the
11 | OSEXPRESS project.
12 | https://sourceforge.net/projects/osexpress/
13 | modified and adapted slightly
14 |
15 | - nl.tue.buildingsmart.express.parser
16 | a modfied ANTLR grammar Express2SDAI.g
17 | it makes use of the dictionary package to store an in-memory meta-model of an
18 | ISO 10303 part 11 EXPRESS schema definition file.
19 | The main schemas that have been tested with it are different versions of the
20 | Industry Foundation Classes (IFC) model developed under the umbrella of the
21 | buildingSMART / IAI organization:
22 | http://www.iai-international.org/
23 | http://www.iai-international.org/Model/IFC(ifcXML)Specs.html
24 |
25 | - nl.tue.buildingsmart.express.dictionary
26 | a meta model structure to capture some of the essential modeling constructs
27 | of the EXPRESS schema definition language.
28 | Many advanced features such as RULE, FUNCTION, QUERY etc. are not implemnted yet
29 |
30 | - nl.tue.buildingsmart.express.population
31 | a JavaCC based file-reader for ISO 10303 part 21 Step Physical File Format (SPFF)
32 | files. This primitive piece creates a large Hashmap of ENTITY and ATTRIBUTE instances
33 | and will quickly go through the memory roof of large population files.
34 | It has been particularly developed with reading in IFC files in mind
35 | The original JavaCC grammar has been developed by Singva Ma
36 |
37 | - nl.tue.buildingsmart.express.population.test
38 | a primitive test that reads in a SPFF (IFC) file given in argv and provided an .exp
39 | EXPRESS schema will spit out some statistics.
40 |
41 | - nl.tue.buildingsmart.emf
42 | a primitive generator that takes and EXPRESS .exp schema and converts it into an ecore
43 | model for the use in the Eclipse Modeling Framework (EMF)
44 |
45 | other highly experimental mappings to RDF(S) and OWL, graphical editors, network visualizers
46 | etc. are available upon request
47 |
48 |
49 | TODO: loads and loads of cleanup, refactoring and documentation.
50 |
--------------------------------------------------------------------------------