/** * {@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)); }
/** * @param \Twig_Environment $twig * @param LoggerInterface $logger * @param \EasyRdf_Graph[] $graphs * @param CardinalitiesExtractor $cardinalitiesExtractor * @param GoodRelationsBridge $goodRelationsBridge */ public function __construct(\Twig_Environment $twig, LoggerInterface $logger, array $graphs, CardinalitiesExtractor $cardinalitiesExtractor, GoodRelationsBridge $goodRelationsBridge) { $this->twig = $twig; $this->logger = $logger; $this->graphs = $graphs; $this->cardinalitiesExtractor = $cardinalitiesExtractor; $this->goodRelationsBridge = $goodRelationsBridge; $this->cardinalities = $this->cardinalitiesExtractor->extract(); }
/** * @param \Twig_Environment $twig * @param LoggerInterface $logger * @param \EasyRdf_Graph[] $graphs * @param CardinalitiesExtractor $cardinalitiesExtractor * @param GoodRelationsBridge $goodRelationsBridge */ public function __construct(\Twig_Environment $twig, LoggerInterface $logger, array $graphs, CardinalitiesExtractor $cardinalitiesExtractor, GoodRelationsBridge $goodRelationsBridge) { if (empty($graphs)) { throw new \InvalidArgumentException('At least one graph must be injected.'); } $this->twig = $twig; $this->logger = $logger; $this->graphs = $graphs; $this->cardinalitiesExtractor = $cardinalitiesExtractor; $this->goodRelationsBridge = $goodRelationsBridge; $this->cardinalities = $this->cardinalitiesExtractor->extract(); }