swarc2bundle's Introduction
To get access to ARC2 classes, configure ARC2's path (config.yml) sw_arc2: arc2_path: %kernel.root_dir%/../vendor/arc2/ Include this bundle as usual. You will only have to import one service to have access to all ARC2. For example, in a controller: $this->get('sw_arc2') You want to use DBpedia? Include the ARC2 service, use the convenience class Sw\Arc2Bundle\Sparql\DbPedia: $this->get('sw_arc2'); \Sw\Arc2Bundle\Sparql\DbPedia::getRdfsLabelRegex('Europe'); You can issue arbitrary SPARQL request to DBpedia too: $this->get('sw_arc2'); \Sw\Arc2Bundle\Sparql\DbPedia::request("your SPARQL request"); You can also use directly the underlying helper class to make queries to other servers: $this->get('sw_arc2'); \Sw\Arc2Bundle\Sparql\DistantSparqlEndpoint::request("endpoint's URL", "your SPARQL request"); If you are going to make many requests, it would be best to create a class for this endpoint, and create within static methods for your requests (you could add there a bit of caching, if you need to) - just to make code easier to read. You want a local SPARQL endpoint? They need more configuration: sw_arc2: arc2_path: %kernel.root_dir%/../vendor/arc2/ # The database to use (only MySQL, requirement from ARC2). database: host: localhost user: root password: ~ database: symfony # Configuration for the SPARQL endpoint sparql_endpoint: # Whether the endpoint will be served at the next URL (@todo) active: true # The URL where the endpoint will be automatically served (@todo) url: /sparql # The store where triples are to be found (table prefix) store: sandbox # Whether the tables are to be created if non existent autocreate: false timeout: 60 read_key: ~ write_key: ~ limit: 250 features: select: true construct: true ask: true describe: true load: true insert: true delete: true dump: true As of now, you cannot configure the URL from the configuration (there's a hope this will be implemented one day or another). Instead, it will always be served on the following URL once its routes are imported (relatively to what prefix you decided for this bundle's routes): /sparql/ If you prefer, just imitate the called controller and do the following in one of your actions: $this->get('sw_arc2.sparql')->drawEndpoint(); The two methods will output directly the endpoint interface, without any chance for you to catch it. If you need it, you can try: $this->get('sw_arc2.sparql')->getEndpointData(); However, this is not really tested and could interfere with many things, as ARC2 is doing many things in the hood. This method should probably be reimplemented properly.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.