def get_model(call): '''Returns the name of the target SMART data model corresponding to the SMART python client convenience method Expects a valid SMART python client convenience method name ''' # We may have to load the ontology if it is not available yet if not rdf_ontology.api_types: rdf_ontology.parse_ontology(open(ONTOLOGY).read()) # Look through the api calls array until a call with matching convenience method name is found for c in rdf_ontology.api_calls: if call == c.client_method_name: return c.target.replace("http://smartplatforms.org/terms#", "")
def get_model(call): '''Returns the name of the target SMART data model corresponding to the SMART python client convenience method Expects a valid SMART python client convenience method name ''' # We may have to load the ontology if it is not available yet if not rdf_ontology.api_types: rdf_ontology.parse_ontology(open(ONTOLOGY).read()) # Look through the api calls array until a call with matching convenience method name is found for c in rdf_ontology.api_calls: if call == c.client_method_name: return c.target.replace("http://smartplatforms.org/terms#","")
queries = [] generate_queries (data, queries, str(NS['sp'][model])) return queries # Query builder state variables main_types = [] data = {} loaded = False # Initialize the namespace manager object namespace_manager = NamespaceManager(Graph()) # Import the namespaces into the namespace manager for ns in NS.keys(): namespace_manager.bind(ns, NS[ns], override=False) # Parse the ontology when necessary if not rdf_ontology.api_types: rdf_ontology.parse_ontology(open(ONTOLOGY_PATH).read()) # Build a list of data types that need to be added to the data definitions for t in rdf_ontology.api_types: if t.is_statement or len(t.calls) > 0 or rdf_ontology.sp.Component in [x.uri for x in t.parents]: main_types.append(t) # Build the data definitions object with each data type for t in main_types: generate_data_for_type(t, data)