/** Get the data for reuse based off sparql endpoint * @access public * @return array $data * */ public function getInfo($identifier) { $key = md5($identifier . 'ocre'); $uri = self::CRRO . $identifier; if (!$this->getCache()->test($key)) { EasyRdf_Namespace::set('nm', 'http://nomisma.org/id/'); EasyRdf_Namespace::set('nmo', 'http://nomisma.org/ontology#'); EasyRdf_Namespace::set('skos', 'http://www.w3.org/2004/02/skos/core#'); EasyRdf_Namespace::set('rdf', 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'); $request = new EasyRdf_Http_Client(); $request->setUri($uri); $response = $request->request()->getStatus(); if ($response == 200) { $graph = new EasyRdf_Graph($uri); $graph->load(); $data = $graph->resource($uri); $this->getCache()->save($data); } else { $data = NULL; } } else { $data = $this->getCache()->load($key); } return $data; }
/** * @Route("/create-person") */ public function createPersonAction() { \EasyRdf_Format::registerSerialiser('ntriples', 'EasyRdf_Serialiser_Arc'); \EasyRdf_Format::registerSerialiser('posh', 'EasyRdf_Serialiser_Arc'); \EasyRdf_Format::registerSerialiser('rdfxml', 'EasyRdf_Serialiser_Arc'); \EasyRdf_Format::registerSerialiser('turtle', 'EasyRdf_Serialiser_Arc'); \EasyRdf_Namespace::set('foaf', 'http://xmlns.com/foaf/0.1/'); $uri = 'http://www.example.com/emi#me'; $name = 'Emi Berea'; $emailStr = '*****@*****.**'; $homepageStr = 'http://bereae.me/'; $graph = new \EasyRdf_Graph(); # 1st Technique $me = $graph->resource($uri, 'foaf:Person'); $me->set('foaf:name', $name); if ($emailStr) { $email = $graph->resource("mailto:" . $emailStr); $me->add('foaf:mbox', $email); } if ($homepageStr) { $homepage = $graph->resource($homepageStr); $me->add('foaf:homepage', $homepage); } # Finally output the graph $data = $graph->serialise('rdfxml'); if (!is_scalar($data)) { $data = var_export($data, true); } var_dump($data); die; }
function convert_to_rdf($path) { //get processed array $uris = get_uris(); $result = process_spreadsheet($path); init_vocabularies(); global $voc_keys; $root = new EasyRdf_Graph(); $courses = $root->newBNode('rdf:Seq'); //create container //iterate through array and create nodes foreach ($result as $key => $value) { $resource_uri = $uris[$key]; $temp_cours = new EasyRdf_Resource($resource_uri, $root); $courses->append($temp_cours); foreach ($value as $propName => $propValue) { if ($propName == null || $propName == "" || $propName == "id") { continue; } $predicate_url = $voc_keys[$propName]; //add to resource predicate with property. probably addLiteral method $temp_cours->addLiteral($predicate_url, $propValue); } } return $root->serialise("rdfxml"); }
/** * Perform the load. * * @param EasyRdf_Graph $chunk * @return void */ public function execute(&$chunk) { if (!$chunk->isEmpty()) { // Don't use EasyRdf's ntriple serializer, as something might be wrong with its unicode byte characters // After serializing with semsol/arc and easyrdf, the output looks the same (with unicode characters), but after a // binary utf-8 conversion (see $this->serialize()) the outcome is very different, leaving easyrdf's encoding completely different // from the original utf-8 characters, and the semsol/arc encoding correct as the original. $ttl = $chunk->serialise('turtle'); $arc_parser = \ARC2::getTurtleParser(); $ser = \ARC2::getNTriplesSerializer(); $arc_parser->parse('', $ttl); $triples = $ser->getSerializedTriples($arc_parser->getTriples()); preg_match_all("/(<.*\\.)/", $triples, $matches); if ($matches[0]) { $this->buffer = array_merge($this->buffer, $matches[0]); } $triple_count = count($matches[0]); $this->log("Added {$triple_count} triples to the load buffer."); while (count($this->buffer) >= $this->loader->buffer_size) { // Log the time it takes to load the triples into the store $start = microtime(true); $buffer_size = $this->loader->buffer_size; $triples_to_send = array_slice($this->buffer, 0, $buffer_size); $this->addTriples($triples_to_send); $this->buffer = array_slice($this->buffer, $buffer_size); $duration = round((microtime(true) - $start) * 1000, 2); $this->log("Took {$buffer_size} triples from the load buffer, loading them took {$duration} ms."); } } }
/** * Retrieve the latest RDFA version of schema.org and converts it to JSON-LD. * * Note: caches the file in data and retrieves it from there as long as it exists. */ private function getJSONVersionOfSchema() { // Set cachefile $cacheFile = dirname(dirname(__DIR__)) . '/data/schemaorg.cache'; if (!file_exists($cacheFile)) { // Create dir if (!file_exists(dirname($cacheFile))) { mkdir(dirname($cacheFile), 0777, true); } // Load RDFA Schema $graph = new \EasyRdf_Graph(self::RDFA_SCHEMA); $graph->load(self::RDFA_SCHEMA, 'rdfa'); // Lookup the output format $format = \EasyRdf_Format::getFormat('jsonld'); // Serialise to the new output format $output = $graph->serialise($format); if (!is_scalar($output)) { $output = var_export($output, true); } $this->schema = \ML\JsonLD\JsonLD::compact($graph->serialise($format), 'http://schema.org/'); // Write cache file file_put_contents($cacheFile, serialize($this->schema)); } else { $this->schema = unserialize(file_get_contents($cacheFile)); } }
protected function getTriples($file) { if (!file_exists($file)) { throw new Exception($file . ' not found'); } // validate the file to import $parser = new tao_models_classes_Parser($file, array('extension' => 'rdf')); $parser->validate(); if (!$parser->isValid()) { throw new common_Exception('Invalid RDF file ' . $file); } $modelDefinition = new EasyRdf_Graph(); $modelDefinition->parseFile($file); /* $graph = $modelDefinition->toRdfPhp(); $resources = $modelDefinition->resources(); */ $format = EasyRdf_Format::getFormat('php'); $data = $modelDefinition->serialise($format); $triples = array(); foreach ($data as $subjectUri => $propertiesValues) { foreach ($propertiesValues as $prop => $values) { foreach ($values as $k => $v) { $triples[] = array('s' => $subjectUri, 'p' => $prop, 'o' => $v['value'], 'l' => isset($v['lang']) ? $v['lang'] : ''); } } } return $triples; }
public function actionEasyRDF() { $this->layout = "test"; $foaf = new EasyRdf_Graph("http://njh.me/foaf.rdf"); $foaf->load(); $me = $foaf->primaryTopic(); echo "My name is: " . $me->get('foaf:name') . "\n"; }
/** Fetch a named graph from the graph store * * The URI can either be a full absolute URI or * a URI relative to the URI of the graph store. * * @param string $uriRef The URI of graph desired * @return object EasyRdf_Graph The graph requested */ public function get($uriRef) { $graphUri = $this->_parsedUri->resolve($uriRef)->toString(); $dataUrl = $this->urlForGraph($graphUri); $graph = new EasyRdf_Graph($graphUri); $graph->load($dataUrl); return $graph; }
public function testParseQuery() { $graph = new EasyRdf_Graph(); $graph->parse(readFixture('query/construct.ttl'), 'turtle'); $query = $graph->resource('test:construct'); $this->assertClass('EasySpinRdf_Query_Construct', $query); $this->assertStringEquals("CONSTRUCT { ?this test:grandParent ?grandParent } WHERE { ?parent test:child ?this. ?grandParent test:child ?parent }", $query->getSparql()); }
public function testParseQuery() { $graph = new EasyRdf_Graph(); $graph->parse(readFixture('query/ask.ttl'), 'turtle'); $query = $graph->resource('test:ask'); $this->assertClass('EasySpinRdf_Query_Ask', $query); $this->assertStringEquals("# must be 18 years old\nASK WHERE { ?this test:age 18 }", $query->getSparql()); }
public function testParseQuery() { $graph = new EasyRdf_Graph(); $graph->parse(readFixture('query/describe.ttl'), 'turtle'); $query = $graph->resource('test:describe'); $this->assertClass('EasySpinRdf_Query_Describe', $query); $this->assertStringEquals("DESCRIBE ?value WHERE { ?this test:uncle ?value }", $query->getSparql()); }
/** * Method to serialise an EasyRdf_Graph to RDF/JSON * * http://n2.talis.com/wiki/RDF_JSON_Specification * docs/appendix-a-rdf-formats-json.md * * @param EasyRdf_Graph $graph An EasyRdf_Graph object. * @param string $format The name of the format to convert to. * @param array $options * @throws EasyRdf_Exception * @return string The RDF in the new desired format. */ public function serialise($graph, $format, array $options = array()) { $nodes = array(); // cache for id-to-node association foreach ($graph->toRdfPhp() as $resource => $properties) { echo $resource; } }
/** Fetch a named graph from the graph store * * The URI can either be a full absolute URI or * a URI relative to the URI of the graph store. * * @param string $uriRef The URI of graph desired * @return object EasyRdf_Graph The graph requested */ public function get($uriRef) { $graphUri = EasyRdf_Utils::resolveUriReference($this->_uri, $uriRef); $dataUrl = $this->urlForGraph($graphUri); $graph = new EasyRdf_Graph($graphUri); $graph->load($dataUrl); return $graph; }
protected function preRun() { $data = parent::getData(); $resourceUri = JURI::base() . "index.php?com_content&view=article&id=" . $data["articleID"]; $annotation = new EasyRdf_Graph($resourceUri); foreach ($data["entityIDs"] as $entityID) { $annotation->addResource($resourceUri, "sioc:about", "http://www.mni.thm.de/user/" . $entityID); } parent::setData($annotation->serialise("rdfxml")); }
public function testParseWebId() { $graph = new EasyRdf_Graph(); $graph->parseFile(fixturePath('webid.ttl'), 'turtle'); $me = $graph->resource('http://www.example.com/myfoaf#me'); $modulus = $me->get('cert:key')->get('cert:modulus'); $this->assertStringEquals('CB24ED85D64D794B69C701C186ACC059501E856000F661C93204D8380E07191C' . '5C8B368D2AC32A428ACB970398664368DC2A867320220F755E99CA2EECDAE62E' . '8D15FB58E1B76AE59CB7ACE8838394D59E7250B449176E51A494951A1C366C62' . '17D8768D682DDE78DD4D55E613F8839CF275D4C8403743E7862601F3C49A6366' . 'E12BB8F498262C3C77DE19BCE40B32F89AE62C3780F5B6275BE337E2B3153AE2' . 'BA72A9975AE71AB724649497066B660FCF774B7543D980952D2E8586200EDA41' . '58B014E75465D91ECF93EFC7AC170C11FC7246FC6DED79C37780000AC4E079F6' . '71FD4F207AD770809E0E2D7B0EF5493BEFE73544D8E1BE3DDDB52455C61391A1', $modulus); $this->assertInternalType('string', $modulus->getValue()); $this->assertSame(NULL, $modulus->getLang()); $this->assertSame('xsd:hexBinary', $modulus->getDatatype()); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $relations = []; $schemaOrg = new \EasyRdf_Graph(); $schemaOrg->load(TypesGeneratorConfiguration::SCHEMA_ORG_RDFA_URL, 'rdfa'); $relations[] = $schemaOrg; $goodRelations = [new \SimpleXMLElement(TypesGeneratorConfiguration::GOOD_RELATIONS_OWL_URL, 0, true)]; $goodRelationsBridge = new GoodRelationsBridge($goodRelations); $cardinalitiesExtractor = new CardinalitiesExtractor($relations, $goodRelationsBridge); $result = $cardinalitiesExtractor->extract(); $output->writeln(json_encode($result, JSON_PRETTY_PRINT)); }
function dissertationen($atts) { EasyRdf_Namespace::set('bibo', 'http://purl.org/ontology/bibo/'); EasyRdf_Namespace::set('sd', 'http://symbolicdata.org/Data/Model#'); EasyRdf_Namespace::set('dct', 'http://purl.org/dc/terms/'); $people = new EasyRdf_Graph("http://symbolicdata.org/Data/People/"); $people->parseFile("http://symbolicdata.org/rdf/People.rdf"); //$people->parseFile("/home/graebe/git/SD/web/rdf/People.rdf"); $out = "\n\n<h2 align=\"center\">Habilitationen</h2>\n\n"; $out .= displayAll(getDissertations('habil'), $people); $out .= "\n\n<h2 align=\"center\">Promotionen</h2>\n\n"; $out .= displayAll(getDissertations('phd'), $people); return $out; }
function casystems() { EasyRdf_Namespace::set('sd', 'http://symbolicdata.org/Data/Model#'); EasyRdf_Namespace::set('dct', 'http://purl.org/dc/terms/'); EasyRdf_Namespace::set('owl', 'http://www.w3.org/2002/07/owl#'); $people = new EasyRdf_Graph("http://symbolicdata.org/Data/People/"); $people->parseFile("http://symbolicdata.org/rdf/People.rdf"); //$people->parseFile("/home/graebe/git/SD/web/rdf/People.rdf"); $systems = new EasyRdf_Graph("http://symbolicdata.org/Data/CA-Systems/"); $systems->parseFile("http://symbolicdata.org/rdf/CA-Systems.rdf"); //$systems->parseFile("/home/graebe/git/SD/web/rdf/CA-Systems.rdf"); $out = displaySystems($systems, $people); return $out; }
/** * @ignore */ private static function statement2rdf(PDOStatement $statement) { $graph = new EasyRdf_Graph(); while ($r = $statement->fetch()) { if (isset($r['l_language']) && !empty($r['l_language'])) { $graph->addLiteral($r['subject'], $r['predicate'], $r['object'], $r['l_language']); } elseif (common_Utils::isUri($r['object'])) { $graph->add($r['subject'], $r['predicate'], $r['object']); } else { $graph->addLiteral($r['subject'], $r['predicate'], $r['object']); } } $format = EasyRdf_Format::getFormat('rdfxml'); return $graph->serialise($format); }
public static function toFile($filePath, $triples) { $graph = new \EasyRdf_Graph(); foreach ($triples as $triple) { if (!empty($triple->lg)) { $graph->addLiteral($triple->subject, $triple->predicate, $triple->object, $triple->lg); } elseif (\common_Utils::isUri($triple->object)) { $graph->add($triple->subject, $triple->predicate, $triple->object); } else { $graph->addLiteral($triple->subject, $triple->predicate, $triple->object); } } $format = \EasyRdf_Format::getFormat('rdfxml'); return file_put_contents($filePath, $graph->serialise($format)); }
/** Get data from the endpoint * @access protected * @return string */ protected function getData() { $key = md5($this->_uri); if (!$this->_cache->test($key)) { $graph = new EasyRdf_Graph(self::URI . $this->_uri . self::SUFFIX); $graph->load(); $data = $graph->resource(self::URI . $this->_uri); $this->_cache->save($data); } else { $data = $this->_cache->load($key); } EasyRdf_Namespace::set('dcterms', 'http://purl.org/dc/terms/'); EasyRdf_Namespace::set('pleiades', 'http://pleiades.stoa.org/places/vocab#'); return $data; }
public function testParseEmpty() { $count = $this->parser->parse($this->graph, '{}', 'jsonld', null); $this->assertSame(0, $count); // Should be empty but no exception thrown $this->assertSame(0, $this->graph->countTriples()); }
/** Get the graph to parse * @access protected * @returns object */ protected function getData() { $key = md5($this->_uri); if (!$this->_cache->test($key)) { $graph = new EasyRdf_Graph($this->_uri); $graph->load(); $data = $graph->resource($this->_uri); $this->_cache->save($data); } else { $data = $this->_cache->load($key); } EasyRdf_Namespace::set('dbpediaowl', 'http://dbpedia.org/ontology/'); EasyRdf_Namespace::set('dbpprop', 'http://dbpedia.org/property/'); EasyRdf_Namespace::set('dbpedia', 'http://dbpedia.org/resource/'); return $data; }
public function saveAdditionalRdf($userId) { try { $serializedRdf = trim(stripslashes($_POST['additionalRdf'])); if (!empty($serializedRdf)) { $graph = new \EasyRdf_Graph(); $graph->parse($serializedRdf); // parsing if done to check if syntax is valid update_user_meta($userId, 'additionalRdf', $serializedRdf); } else { update_user_meta($userId, 'additionalRdf', ''); } } catch (\Exception $ex) { wp_die('Addtional RDF Triples could not be saved. Cause: ' . $ex->getMessage()); } }
/** Get the HTTP Client object used to fetch RDF data * * If no HTTP Client has previously been set, then a new * default (EasyRdf_Http_Client) client will be created. * * @return object mixed The HTTP client object */ public static function getHttpClient() { if (!self::$_httpClient) { self::$_httpClient = new EasyRdf_Http_Client(); } return self::$_httpClient; }
public function setUp() { if (PHP_MAJOR_VERSION < 5 or PHP_MAJOR_VERSION >= 5 and PHP_MINOR_VERSION < 3) { $this->markTestSkipped("JSON-LD support requires PHP 5.3+"); } if (!class_exists('\\ML\\JsonLD\\JsonLD')) { $this->markTestSkipped('"ml/json-ld" dependency is not installed'); } $this->graph = new EasyRdf_Graph('http://example.com/'); $this->serialiser = new EasyRdf_Serialiser_JsonLd(); $joe = $this->graph->resource('http://www.example.com/joe#me', 'foaf:Person'); $joe->set('foaf:name', new EasyRdf_Literal('Joe Bloggs', 'en')); $joe->set('foaf:age', 59); $project = $this->graph->newBNode(); $project->add('foaf:name', 'Project Name'); $joe->add('foaf:project', $project); }
/** * Seed the themes * * return @void */ private function seedThemes() { $this->info('---- Seeding new themes ----'); $base_uri = $this->argument('uri'); $taxonomy_uri = $this->argument('taxonomy_uri'); if (empty($taxonomy_uri)) { $taxonomy_uri = $base_uri; } // Try to get the themes from the ns.thedatatank.com (semantic data) try { $this->info('Trying to fetch triples from the uri: ' . $base_uri); $themes_graph = \EasyRdf_Graph::newAndLoad($base_uri); if ($themes_graph->isEmpty()) { $this->info('We could not reach the online themes.'); } else { $this->info('Found new themes online, removing the old ones.'); // Empty the themes table \Theme::truncate(); } // Fetch the resources with a skos:conceptScheme relationship $resources = $themes_graph->allOfType('skos:ConceptScheme'); $taxonomy_uris = array(); foreach ($resources as $r) { array_push($taxonomy_uris, $r->getUri()); } if (!empty($taxonomy_uris)) { if (count($taxonomy_uris) == 1) { $taxonomy_uri = $taxonomy_uris[0]; } else { // Check if one of the possible taxonomy uris compares to the uri of the document foreach ($taxonomy_uris as $tax_uri) { if ($base_uri == $tax_uri) { $taxonomy_uri = $tax_uri; break; } $this->error('None of the URIs that have the skos:ConceptScheme property matched the URI of the document, please specify the taxonomy URI as a second parameter.'); } } } else { $this->error('No resource has been found with a property of skos:ConceptScheme.'); } // Fetch all of the themes foreach ($themes_graph->resourcesMatching('skos:inScheme') as $theme) { if ($theme->get('skos:inScheme')->getUri() == $taxonomy_uri) { $uri = $theme->getUri(); $label = $theme->getLiteral('rdfs:label'); if (!empty($label) && !empty($uri)) { $label = $label->getValue(); $this->info('Added ' . $uri . ' with label ' . $label); \Theme::create(array('uri' => $uri, 'label' => $label)); } } } $this->info('Added new themes.'); } catch (EasyRdf_Exception $ex) { $this->info('An error occurred when we tried to fetch online themes.'); } }
public function queryWorldCatFromOCLC() { $oclc = (string) (int) $this->OCLC; $url = 'http://www.worldcat.org/oclc/' . $oclc; $rdf = new EasyRdf_Graph($url . '.rdf'); $rdf->load(); $resources = $rdf->resources(); $book = $resources[$url]; //Core info $this->Title = (string) $book->getLiteral('schema:name'); $publisherData = $book->get('schema:publisher'); if ($publisherData) { $this->Publisher = (string) $publisherData->get('schema:name'); } //Publishing date $date = (string) $book->getLiteral('schema:datePublished'); if (strlen($date) == 4) { $this->YYYY = $date; } else { echo '<div class="alert-box">Publishing date: ', $date, " / check the template, the code doesn't know how to parse this format and only made a guess. ", '<a href="" class="close">×</a></div>'; $date = date_parse($date); $this->YYYY = $date['year']; $this->MM = $date['month']; $this->DD = $date['day']; } //Authors $this->Authors = []; //TODO: look type mapping $contributors = $book->allResources('schema:contributor'); foreach ($contributors as $contributor) { $this->Authors[] = [(string) $contributor->get('schema:givenName'), (string) $contributor->get('schema:familyName')]; } //Kludge for library:placeOfPublication //We have generally two links, one for the city, one for the country. //Only the city has a schema:name, the country is only a reference. $rdf_content = file_get_contents($url . '.rdf'); if (preg_match_all('@<library:placeOfPublication rdf:resource="(.*)"/>@', $rdf_content, $matches)) { foreach ($matches[1] as $place) { if ($cityCandidate = (string) $resources[$place]->get('schema:name')) { $this->Place = $cityCandidate; break; } } } }
public function setUp() { if (PHP_MAJOR_VERSION < 5 or PHP_MAJOR_VERSION == 5 and PHP_MINOR_VERSION < 3) { $this->markTestSkipped("JSON-LD support requires PHP 5.3+"); } if (!class_exists('\\ML\\JsonLD\\JsonLD')) { $this->markTestSkipped('"ml/json-ld" dependency is not installed'); } $this->graph = new EasyRdf_Graph('http://example.com/'); $this->serialiser = new EasyRdf_Serialiser_JsonLd(); $joe = $this->graph->resource('http://www.example.com/joe#me', 'foaf:Person'); $joe->set('foaf:name', new EasyRdf_Literal('Joe Bloggs', 'en')); $joe->set('foaf:age', 59); $joe->set('foaf:homepage', $this->graph->resource('http://foo/bar/me')); $project = $this->graph->newBNode(); $project->add('foaf:name', 'Project Name'); $joe->add('foaf:project', $project); EasyRdf_Namespace::set('dc', 'http://purl.org/dc/elements/1.1/'); EasyRdf_Namespace::set('ex', 'http://example.org/vocab#'); EasyRdf_Namespace::set('xsd', 'http://www.w3.org/2001/XMLSchema#'); EasyRdf_Namespace::set('', 'http://foo/bar/'); $chapter = $this->graph->resource('http://example.org/library/the-republic#introduction', 'ex:Chapter'); $chapter->set('dc:description', new EasyRdf_Literal('An introductory chapter on The Republic.')); $chapter->set('dc:title', new EasyRdf_Literal('The Introduction')); $book = $this->graph->resource('http://example.org/library/the-republic', 'ex:Book'); $book->set('dc:creator', new EasyRdf_Literal('Plato')); $book->set('dc:title', new EasyRdf_Literal('The Republic')); $book->addResource('ex:contains', $chapter); $library = $this->graph->resource('http://example.org/library', 'ex:Library'); $library->addResource('ex:contains', $book); }
/** * {@inheritdoc} */ protected function execute(InputInterface $input, OutputInterface $output) { $configArgument = $input->getArgument('config'); if ($configArgument) { $parser = new Parser(); $config = $parser->parse(file_get_contents($configArgument)); unset($parser); } else { $config = []; } $processor = new Processor(); $configuration = new TypesGeneratorConfiguration(); $processedConfiguration = $processor->processConfiguration($configuration, [$config]); $processedConfiguration['output'] = realpath($input->getArgument('output')); if (!$processedConfiguration['output']) { throw new \RuntimeException('The specified output is invalid'); } $graphs = []; foreach ($processedConfiguration['rdfa'] as $rdfa) { $graph = new \EasyRdf_Graph(); if ('http://' === substr($rdfa['uri'], 0, 7) || 'https://' === substr($rdfa['uri'], 0, 8)) { $graph->load($rdfa['uri'], $rdfa['format']); } else { $graph->parseFile($rdfa['uri'], $rdfa['format']); } $graphs[] = $graph; } $relations = []; foreach ($processedConfiguration['relations'] as $relation) { $relations[] = new \SimpleXMLElement($relation, 0, true); } $goodRelationsBridge = new GoodRelationsBridge($relations); $cardinalitiesExtractor = new CardinalitiesExtractor($graphs, $goodRelationsBridge); $ucfirstFilter = new \Twig_SimpleFilter('ucfirst', 'ucfirst'); $loader = new \Twig_Loader_Filesystem(__DIR__ . '/../../templates/'); $twig = new \Twig_Environment($loader, ['autoescape' => false, 'debug' => $processedConfiguration['debug']]); $twig->addFilter($ucfirstFilter); if ($processedConfiguration['debug']) { $twig->addExtension(new \Twig_Extension_Debug()); } $logger = new ConsoleLogger($output); $entitiesGenerator = new TypesGenerator($twig, $logger, $graphs, $cardinalitiesExtractor, $goodRelationsBridge); $entitiesGenerator->generate($processedConfiguration); }