def test_uriÎ_and_curie(self): """ Compile a model of URI's and Curies and then test the various types """ self.single_file_generator('py', PythonGenerator, filtr=metadata_filter) # Make sure the python is valid with open(os.path.join(self.source_path, self.model_name + '.py')) as f: model = f.read() spec = compile(model, 'test', 'exec') module = ModuleType('test') exec(spec, module.__dict__) # Check that the interpretations are correct msg = self.single_file_generator('jsonld', ContextGenerator, filtr=ldcontext_metadata_filter, fail_if_expected_missing=False) msg = self.single_file_generator('json', JSONLDGenerator, filtr=json_metadata_filter, fail_if_expected_missing=False) if msg: self.fail(msg) curie_obj = module.C1("ex:obj1", hasCurie="ex:curie", hasURI="http://example.org/test/uri", hasNcName="A123", id2="ex:id2") instance_jsonld = loads('{ "ex": "http://example.org/test/inst#" }') g = as_rdf(curie_obj, [ os.path.join(self.source_path, self.model_name + '.jsonld'), instance_jsonld ]) self.rdf_comparator( expected_rdf, g, os.path.join(self.target_path, self.model_name + '.jsonld'))