#------------------------------------------------------------------------------- # Copyright (c) 2011, BAE Systems. # Developed with the sponsorship of the Defense Advanced Research Projects Agency (DARPA). # # Permission is hereby granted, free of charge, to any person obtaining a copy of this data, # including any software or models in source or binary form, as well as any drawings, # specifications, and documentation (collectively "the Data"), to deal in the Data without restriction, # including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, # and/or sell copies of the Data, and to permit persons to whom the Data is furnished to do so, # subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all copies or substantial # portions of the Data. # # THE DATA IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING # BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE # AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS, SPONSORS, DEVELOPERS, CONTRIBUTORS, # OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN # ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # DATA OR THE USE OR OTHER DEALINGS IN THE DATA. #------------------------------------------------------------------------------- Tim Anderson 13 May 2011 The Prolog engine that we use, as instantiated by Galileo, includes an add-on library that defines a new amil_query predicate. This allows Prolog to *read* values from AMIL, and use them in its computations; as discussed in amil-programming.txt, AMIL may run executables or invoke web services (Pro/E) to obtain those values. There are 2-, 3-, and 4-argument versions of the predicate. The first argument is take to be a variable; on successful execution of the query, the list of returned values will be unified with that variable. The second argument is the query; the third, if supplied, is an attribute name (defaulting to "value"); the fourth, is supplied, says whether to return all values found, or only the first. The default is to return all. The query itself consists of one or more terms. If there's more than one, the whole thing must be a list. The first (or only) term should refer to a node, by name. If all we care about is the name, then it can stand by itself: amil_query(X, 'LowFidelityRampMass') will get the value attribute of the named node. The most general form of the single-term query is: node(NODE-NAME, attribute(ATTR-NAME, ATTR-VALUE),...,parameter(PARAM-NAME, PARAM-VALUE)...) The attribute and parameter terms can appear in any order. The attribute terms constrain the search (these are most useful on links; for a node, since the unique name must currently be supplied, they can only cause failure): whatever is returned must have attributes with the supplied names whose values match. The parameter terms are passed to AMIL as part of the query, overriding whatever values are associated with the specified node in the database. If there are multiple terms, they should alternate node/link/node/link. For a link, the format is the same, except the name refers to the link's *type* rather than to its "name." Only outbound links are searched. Thus: amil_query(X, ['LowFidelityRampMass', 'parameter'], name) will (or at least should) return a list containing the names of all parameter links outbound from the LowFidelityRampMass node. amil_query(X, node('LowFidelityRampMass', parameter('ArmorThickness',Thickness)), value) returns the mass, as computed based on the specified thickness rather than whatever various models might come up with.