### Build and Start Server Source: https://github.com/apache/jena-site/blob/main/source/documentation/fuseki2/fuseki-embedded.md Example of building and starting an embedded Fuseki server. ```java Dataset ds = ... ; FusekiServer server = FusekiServer.create() .add("/rdf", ds) .build() ; server.start() ; ``` -------------------------------- ### Fuseki Server Configuration Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/fuseki2/fuseki-data-access-control.md Example of starting Fuseki with a configuration file. ```bash $ fuseki --conf configFile.ttl ``` -------------------------------- ### Fuseki Server Start with Configuration File Source: https://github.com/apache/jena-site/blob/main/source/documentation/query/javascript-functions.md Example command to start Fuseki server using a configuration file. ```bash export JVM_ARGS=-Djena:scripting=true fuseki --conf config.ttl ``` -------------------------------- ### Turtle syntax for initialising content Source: https://github.com/apache/jena-site/blob/main/source/documentation/assembler/__index.md Example of an Assembler specification in Turtle syntax to pre-load a model with external content. ```turtle my:root ja:content [ja:externalContent ] ... rest of model specification ... . ``` -------------------------------- ### Running Fuseki with GeoSPARQL Source: https://github.com/apache/jena-site/blob/main/source/documentation/geosparql/geosparql-fuseki.md Command-line examples for starting Fuseki with GeoSPARQL support, including loading data, enabling RDFS inferencing, and using different storage options. ```bash java -jar jena-fuseki-geosparql-VER.jar -rf "geosparql_test.rdf" -i ``` ```bash geosparql-fuseki -rf "test.rdf" ``` ```bash geosparql-fuseki -rf "test.rdf" -i ``` ```bash geosparql-fuseki -rf "test.rdf" -si "spatial.index" ``` ```bash geosparql-fuseki -rf "test.rdf" -t "TestTDB" ``` ```bash geosparql-fuseki -t "TestTDB" ``` ```bash geosparql-fuseki -t "TestTDB" -p 3030 ``` -------------------------------- ### Fuseki Server Configuration (Command Line) Source: https://github.com/apache/jena-site/blob/main/source/documentation/query/javascript-functions.md Example command to start Fuseki server with a JavaScript library and script allow list. ```bash export JVM_ARGS=-Djena:scripting=true fuseki --set arq:js-library=functions.js \ --set arq:scriptAllowList=toCamelCase \ --mem /ds ``` -------------------------------- ### Turtle syntax for a memory model Source: https://github.com/apache/jena-site/blob/main/source/documentation/assembler/__index.md Example of an Assembler specification in Turtle syntax to create a memory-based Jena model. ```turtle my:root a ja:MemoryModel. ``` -------------------------------- ### Schemagen Configuration Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/tools/schemagen.md A complete example of a Schemagen configuration file in XML format. ```xml ``` -------------------------------- ### Turtle syntax for an inference model Source: https://github.com/apache/jena-site/blob/main/source/documentation/assembler/__index.md Example of an Assembler specification in Turtle syntax for an inference model, including reasoner and base model. ```turtle my:root ja:reasoner [ja:reasonerURL theReasonerURL] ; ja:baseModel theBaseModelResource . ``` -------------------------------- ### DocumentGraphFactory Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/assembler/assembler-howto.md Example of using DocumentGraphFactory to manage OntModel dependencies. ```turtle :repo a oa:DocumentGraphRepository ; oa:graph :g . :g a oa:Graph ; oa:graphIRI "file:etc/foo.n3" ; oa:graphLocation "file:etc/foo.n3" . :base a ja:MemoryModel ; ja:externalContent . :model a oa:OntModel ; oa:baseModel :base ; oa:documentGraphRepository :repo . ``` -------------------------------- ### Turtle syntax for an ontology model Source: https://github.com/apache/jena-site/blob/main/source/documentation/assembler/__index.md Example of an Assembler specification in Turtle syntax for an ontology model, referencing an OntModelSpec. ```turtle my:root a oa:OntModel ; oa:ontModelSpec my:specification ; oa:baseModel my:somebaseModel . my:specification a oa:OntSpecification ; oa:specificationName "OntModelSpecName" . ``` -------------------------------- ### Simple user/password authentication setup Source: https://github.com/apache/jena-site/blob/main/source/documentation/fuseki2/fuseki-security.md An example configuration for basic user/password authentication, including a [users] section and modified [urls]. ```ini [users] admin=pw [urls] ## Control functions open to anyone /$/status = anon /$/ping = anon /$/** = authcBasic,user[admin] # Everything else /**=anon ``` -------------------------------- ### Property Path Examples Source: https://github.com/apache/jena-site/blob/main/source/documentation/query/property_paths.md Examples illustrating the meaning of different property path syntaxes. ```text dc:title | rdfs:label dublin core title or an rdfs label. foaf:knows/foaf:name name of people one "knows" steps away. foaf:knows/foaf:knows/foaf:name name of people two "knows" steps away. ``` -------------------------------- ### Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/tools/schemagen.md An example of creating an individual using Schemagen. ```Java public static final Individual deputy = m_model.createIndividual( Dog, "http://example.org/eg#deputy" ); } ``` -------------------------------- ### tdbloader2 Command Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/tdb/commands.md Example of using the tdbloader2 command to create a database and load files. ```bash tdbloader2 --loc /path/for/database input1.ttl input2.ttl ... ``` -------------------------------- ### GSP GET Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/sparql-apis/__index.md Example of retrieving a Graph from a GSP service. ```java Graph graph = GSP.service("http://fuseki/dataset").defaultGraph().GET(); ``` -------------------------------- ### ModelStore GET Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/sparql-apis/__index.md Example of retrieving a Model from a ModelStore service. ```java Model model = ModelStore.service("http://fuseki/dataset").defaultGraph().GET(); ``` -------------------------------- ### Example of specifying configuration root Source: https://github.com/apache/jena-site/blob/main/source/documentation/tools/schemagen.md This example shows how to specify the configuration root URI on the command line, matching a resource in the configuration file. ```java Java jena.schemagen -c config/localconf.rdf -r http://example.org/sg#project1 ``` -------------------------------- ### Running Fuseki Server from command line Source: https://github.com/apache/jena-site/blob/main/source/documentation/fuseki2/fuseki-plain.md Example of how to run the Fuseki server from the command line using the FusekiMainCmd class. ```bash java -cp jena-fuseki-server-$VER.jar org.apache.jena.fuseki.main.cmds.FusekiMainCmd --help ``` -------------------------------- ### GSP Get Dataset Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/sparql-apis/__index.md Example of retrieving a DatasetGraph from a GSP service. ```java DatasetGraph dataset = GSP.request("http://fuseki/dataset").getDataset(); ``` -------------------------------- ### qparse arguments for query explanation Source: https://github.com/apache/jena-site/blob/main/source/documentation/query/explain.md Examples of using arq.qparse to explain query transformations. ```bash arq.qparse --explain --query Q.rq arq.qparse --explain 'SELECT * { ?s ?p ?o }' ``` -------------------------------- ### Complex Query Execution Setup with JDK HttpClient Source: https://github.com/apache/jena-site/blob/main/source/documentation/sparql-apis/__index.md Example of a more complex setup for QueryExecutionHTTP using JDK HttpClient, including custom client, send mode, and timeout. ```java // JDK HttpClient HttpClient httpClient = HttpClient.newBuilder() .connectTimeout(Duration.ofSeconds(10)) // Timeout to connect .followRedirects(Redirect.NORMAL) .build(); try ( QueryExecution qExec = QueryExecutionHTTP.create() .service("http:// .... ") .httpClient(httpClient) .query(query) .sendMode(QuerySendMode.asPost) .timeout(30, TimeUnit.SECONDS) // Timeout of request .build() ) { ResultSet results = qExec.execSelect(); ... use results ... } ``` -------------------------------- ### Direct Java Command Line Execution Source: https://github.com/apache/jena-site/blob/main/source/tutorials/sparql_query1.md Example of how to execute SPARQL queries directly using the Java command line, requiring the Jena JARs to be on the classpath. ```bash $ java -cp 'DIST/lib/*' arq.sparql ... ``` -------------------------------- ### Example HTTP GET request Source: https://github.com/apache/jena-site/blob/main/source/documentation/fuseki2/prefixes-service.md Fetches the URI for a given prefix. ```http http://localhost:port/prefixes?prefix=prefix1 ``` -------------------------------- ### Opening a model from an Assembler specification Source: https://github.com/apache/jena-site/blob/main/source/documentation/assembler/__index.md Demonstrates how to invoke the Assembler to open a model based on an RDF specification resource. ```java Assembler.general.openModel(R) ``` -------------------------------- ### Running Fuseki Server with custom jars Source: https://github.com/apache/jena-site/blob/main/source/documentation/fuseki2/fuseki-plain.md Example of running the Fuseki server from the command line when other jars are required. ```bash java -cp jena-fuseki-server-$VER.jar:...OtherJars... org.apache.jena.fuseki.main.cmds.FusekiMainCmd ARGS ``` -------------------------------- ### TDB Store Parameters JSON Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/tdb/store-parameters.md An example of the JSON file format used for storing TDB (TuttleDB) parameters. Unspecified options default to the running setup's defaults. ```json { "tdb.file_mode" : "mapped" , "tdb.block_size" : 8192 , "tdb.block_read_cache_size" : 10000 , "tdb.block_write_cache_size" : 2000 , "tdb.node2nodeid_cache_size" : 100000 , "tdb.nodeid2node_cache_size" : 500000 , "tdb.node_miss_cache_size" : 100 , "tdb.node_cache_initial_capacity_factor" : 0.25 , "tdb.index_node2id" : "node2id" , "tdb.index_id2node" : "nodes" , "tdb.triple_index_primary" : "SPO" , "tdb.triple_indexes" : [ "SPO" , "POS" , "OSP" ] , "tdb.quad_index_primary" : "GSPO" , "tdb.quad_indexes" : [ "GSPO" , "GPOS" , "GOSP" , "POSG" , "OSPG" , "SPOG" ] , "tdb.prefix_index_primary" : "GPU" , "tdb.prefix_indexes" : [ "GPU" ] , "tdb.file_prefix_index" : "prefixIdx" , "tdb.file_prefix_nodeid" : "prefix2id" , "tdb.file_prefix_id2node" : "prefixes" } ``` -------------------------------- ### Spatial Index Setup Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/geosparql/__index.md Demonstrates how to set up a spatial index for a dataset using GeoSPARQLConfig. ```java GeoSPARQLConfig.setupSpatialIndex(dataset); ``` -------------------------------- ### Schemagen Configuration File Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/tools/schemagen.md An example of a schemagen.rdf configuration file, demonstrating how to specify OWL usage, ontology generation, naming conventions, package, output, and templates for file headers and footers. ```xml ]> true true true Vocab com.example.vocabulary src/com/example/vocabulary /***************************************************************************** * Source code information * ----------------------- * Original author Jane Smart, example.com * Author email jane.smart@example.com * Package @package@ * Web site @website@ * Created %date% * Filename $RCSfile: schemagen.html,v $ * Revision $Revision: 1.16 $ * Release status @releaseStatus@ $State: Exp $ * * Last modified on $Date: 2010-06-11 00:08:23 $ * by $Author: ian_dickinson $ * * @copyright@ *****************************************************************************/ // Package /////////////////////////////////////// %package% // Imports /////////////////////////////////////// %imports% /** * Vocabulary definitions from %sourceURI% * @author Auto-generated by schemagen on %date% */ /* @footer@ */ /** Factory for generating symbols */ private static KsValueFactory s_vf = new DefaultValueFactory(); // Vocabulary properties /////////////////////////// // Vocabulary classes /////////////////////////// // Vocabulary datatypes /////////////////////////// // Vocabulary individuals /////////////////////////// public static final KsSymbol %valname% = s_vf.newSymbol( "%valuri%" ); /** Ontology individual corresponding to {@link #%valname%} */ public static final %valclass% _%valname% = m_model.%valcreator%( %valtype%, "%valuri%" ); ``` -------------------------------- ### Example 3 : Using RDFParser Source: https://github.com/apache/jena-site/blob/main/source/documentation/io/rdf-input.md Detailed control over the setup of the parsing process is provided by RDFParser, which uses a builder pattern. This example shows how to read Trig data and set the error handler specially. ```Java Dataset dataset; // The parsers will do the necessary character set conversion. try (InputStream in = new FileInputStream("data.some.unusual.extension")) { dataset = RDFParser.create() .source(in) .lang(RDFLanguages.TRIG) .errorHandler(ErrorHandlerFactory.errorHandlerStrict) .base("http://example/base") .toDataset(noWhere); } ``` -------------------------------- ### Challenge Registration with AuthEnv Source: https://github.com/apache/jena-site/blob/main/source/documentation/sparql-apis/http-auth.md Example of application setup code to register username and password with AuthEnv for challenge-based authentication. ```java // Application setup code AuthEnv.get().registerUsernamePassword("username", "password"); ``` -------------------------------- ### Sample RDF Graph Source: https://github.com/apache/jena-site/blob/main/source/tutorials/sparql_union.md An example RDF graph containing name information using both FOAF and vCard vocabularies. ```turtle @prefix foaf: . @prefix vcard: . _:a foaf:name "Matt Jones" . _:b foaf:name "Sarah Jones" . _:c vcard:FN "Becky Smith" . _:d vcard:FN "John Smith" . ``` -------------------------------- ### Building a Text Dataset in Code Source: https://github.com/apache/jena-site/blob/main/source/documentation/query/text-query.md Example of constructing a text dataset with code, demonstrating an in-memory setup. ```Java // Example of building a text dataset with code. // Example is in-memory. // Base dataset Dataset ds1 = DatasetFactory.createMem() ; EntityDefinition entDef = new EntityDefinition("uri", "text", RDFS.label) ; // Lucene, in memory. Directory dir = new RAMDirectory(); // Join together into a dataset Dataset ds = TextDatasetFactory.createLucene(ds1, dir, entDef) ; ``` -------------------------------- ### Building and starting an embedded Fuseki server Source: https://github.com/apache/jena-site/blob/main/source/documentation/fuseki2/fuseki-plain.md Java code snippet demonstrating how to build and start an embedded Fuseki server with a dataset. ```java Dataset ds = ... FusekiServer server = FusekiServer.create() .add("/dataset", ds) .build() ; server.start() ; ``` -------------------------------- ### Sample ARP Initialization and Parsing Source: https://github.com/apache/jena-site/blob/main/source/documentation/io/arp/arp_standalone.md Demonstrates how to initialize an ARP instance, set parsing options and handlers, and load RDF data from a StringReader. ```Java ARP arp = new ARP(); // initialisation - uses ARPConfig interface only. arp.getOptions().setLaxErrorMode(); arp.getHandlers().setErrorHandler(new ErrorHandler(){ public void fatalError(SAXParseException e){ // TODO code } public void error(SAXParseException e){ // TODO code } public void warning(SAXParseException e){ // TODO code } }); arp.getHandlers().setStatementHandler(new StatementHandler(){ public void statement(AResource a, AResource b, ALiteral l){ // TODO code } public void statement(AResource a, AResource b, AResource l){ // TODO code } }); // parsing. try { // Loading fixed input ... arp.load(new StringReader( "\n" +"" +"hello\n" +"" )); } catch (IOException ioe){ // something unexpected went wrong } catch (SAXParseException s){ // This error will have been reported } catch (SAXException ss) { // This error will not have been reported. } ``` -------------------------------- ### Query Execution on Windows Source: https://github.com/apache/jena-site/blob/main/source/tutorials/sparql_query1.md Command to execute the SPARQL query using the Windows helper script. ```batch > bat\sparql.bat --data=doc\Tutorial\vc-db-1.rdf --query=doc\Tutorial\q1.rq ``` -------------------------------- ### Running a tool on Linux/Mac Source: https://github.com/apache/jena-site/blob/main/source/documentation/tools/__index.md Example of running a Jena tool from the command line on Linux/Mac. ```bash sparql --version ``` -------------------------------- ### Publish an RDF file as a SPARQL endpoint Source: https://github.com/apache/jena-site/blob/main/source/documentation/fuseki2/fuseki-quick-start.md Command to run Fuseki server and publish an RDF file as a SPARQL endpoint. ```bash fuseki-server --file FILE /name ``` -------------------------------- ### Explore a TDB database Source: https://github.com/apache/jena-site/blob/main/source/documentation/fuseki2/fuseki-quick-start.md Command to run Fuseki server and explore a TDB database. ```bash fuseki-server --loc=DATABASE /name ``` -------------------------------- ### Add TDB SNAPSHOT dependency to Maven project Source: https://github.com/apache/jena-site/blob/main/source/getting_involved/__index.md Example of how to add a SNAPSHOT version of Jena TDB to a Maven project. ```xml org.apache.jena jena-tdb X.Y.Z-SNAPSHOT ``` -------------------------------- ### Command Line Query Execution Source: https://github.com/apache/jena-site/blob/main/source/tutorials/sparql_datasets.md Example command to run a SPARQL query using the command line application, specifying dataset graphs. ```bash $ java -cp ... arq.sparql --graph ds-dft.ttl --namedgraph ds-ng-1.ttl --namedgraph ds-ng-2.ttl --query query file ``` -------------------------------- ### Get zero or one labels for each subject Source: https://github.com/apache/jena-site/blob/main/source/documentation/query/lateral-join.md Example showing how to fetch zero or one label for any subject-predicate-object triple using LATERAL join. ```sparql ## Get zero or one labels for each subject. SELECT * { ?s ?p ?o LATERAL { OPTIONAL { SELECT * { ?s rdfs:label ?label } LIMIT 1 } } } ``` -------------------------------- ### sparql command for execution explanation Source: https://github.com/apache/jena-site/blob/main/source/documentation/query/explain.md Example of using arq.sparql to explain query execution. ```bash arq.sparql --explain --data ... --query ... ``` -------------------------------- ### Get exactly one label for each subject with type :T Source: https://github.com/apache/jena-site/blob/main/source/documentation/query/lateral-join.md Example demonstrating how to retrieve a single label for subjects of a specific type using LATERAL join. ```sparql ## Get exactly one label for each subject with type :T SELECT * { ?s rdf:type :T LATERAL { SELECT * { ?s rdfs:label ?label } LIMIT 1 } } ``` -------------------------------- ### Creating a SecuredGraph Source: https://github.com/apache/jena-site/blob/main/source/documentation/permissions/__index.md Example of how to create a SecuredGraph instance. ```java Factory.getInstance( SecurityEvaluator, String, Graph ); ``` -------------------------------- ### Read-only Service Configuration Source: https://github.com/apache/jena-site/blob/main/source/documentation/fuseki2/fuseki-configuration.md Example configuration for a read-only Fuseki service providing SPARQL query and HTTP GET SPARQL Graph Store protocol endpoints. ```turtle <#service2> rdf:type fuseki:Service ; fuseki:name "/ds-ro" ; # http://host:port/ds-ro fuseki:endpoint [ fuseki:operation fuseki:query ; fuseki:name "sparql" ]; fuseki:endpoint [ fuseki:operation fuseki:query ; fuseki:name "query" ]; fuseki:endpoint [ fuseki:operation fuseki:gsp_r ; fuseki:name "data" ]; fuseki:dataset <#dataset> ; . ``` -------------------------------- ### IF Form Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/query/function_forms.md Examples of using the IF form in SPARQL. ```sparql IF ( ?x<0 , "negative" , "positive" ) # A possible way to do default values. LET( ?z := IF(bound(?z) , ?z , "DftValue" ) ) ``` -------------------------------- ### Query Execution on Linux/Cygwin/Unix Source: https://github.com/apache/jena-site/blob/main/source/tutorials/sparql_query1.md Command to execute the SPARQL query using the bash helper script. ```bash $ bin/sparql --data=doc/Tutorial/vc-db-1.rdf --query=doc/Tutorial/q1.rq ``` -------------------------------- ### Example Citation Source: https://github.com/apache/jena-site/blob/main/source/about_jena/citing.md An example of how to format a citation for Apache Jena. ```text Apache Software Foundation, 2021. Apache Jena, Available at: https://jena.apache.org/. ``` -------------------------------- ### Selective Rule Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/tdb/optimizer.md Example of a more selective rule for property usage. ```text ((VAR :property VAR) ...) ``` -------------------------------- ### Example Output Source: https://github.com/apache/jena-site/blob/main/source/tutorials/rdf_api.md The expected output when listing nicknames. ```bash The nicknames of "John Smith" are: Smithy Adman ``` -------------------------------- ### HAVING clause example Source: https://github.com/apache/jena-site/blob/main/source/documentation/query/group-by.md Example of a HAVING clause used to filter grouped results. ```sparql SELECT ?p ?q { . . . } GROUP BY ?p ?q HAVING (count(distinct *) > 1) ``` -------------------------------- ### RDF/JSON Example Source: https://github.com/apache/jena-site/blob/main/static/documentation/io/rdf-json.html An example of RDF/JSON structure representing FOAF data. ```json { "http://example.org/about" : { "http://purl.org/dc/elements/1.1/creator" : [ { "value" : "Anna Wilder", "type" : "literal" } ] , "http://purl.org/dc/elements/1.1/title" : [ { "value" : "Anna's Homepage", "type" : "literal", "lang" : "en" } ] , "http://xmlns.com/foaf/0.1/maker" : [ { "value" : "_:person", "type" : "bnode" } ] } , "_:person" : { "http://xmlns.com/foaf/0.1/homepage" : [ { "value" : "http://example.org/about", "type" : "uri" } ] , "http://xmlns.com/foaf/0.1/made" : [ { "value" : "http://example.org/about", "type" : "uri" } ] , "http://xmlns.com/foaf/0.1/name" : [ { "value" : "Anna Wilder", "type" : "literal" } ] , "http://xmlns.com/foaf/0.1/firstName" : [ { "value" : "Anna", "type" : "literal" } ] , "http://xmlns.com/foaf/0.1/surname" : [ { "value" : "Wilder", "type" : "literal" } ] , "http://xmlns.com/foaf/0.1/depiction" : [ { "value" : "http://example.org/pic.jpg", "type" : "uri" } ] , "http://xmlns.com/foaf/0.1/nick" : [ { "type" : "literal", "value" : "wildling"} , { "type" : "literal", "value" : "wilda" } ] , "http://xmlns.com/foaf/0.1/mbox_sha1sum" : [ { "value" : "69e31bbcf58d432950127593e292a55975bc66fd", "type" : "literal" } ] } } ``` -------------------------------- ### Running a tool on Windows Source: https://github.com/apache/jena-site/blob/main/source/documentation/tools/__index.md Example of running a Jena tool from the command line on Windows. ```bat sparql.bat --version ``` -------------------------------- ### RDF Triple Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/rdf/__index.md An example of an RDF triple in Turtle syntax. ```turtle example:ijd foaf:name "Ian" ``` -------------------------------- ### RIOT Command Line Tool Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/io/__index.md Example of calling the riot command-line tool directly as a Java program. ```bash java -cp ... riotcmd.riot file.ttl ``` -------------------------------- ### Basic Pattern with QNames Source: https://github.com/apache/jena-site/blob/main/source/tutorials/sparql_basic_patterns.md The same query as above, but using QNames (prefixes) for clarity. ```sparql PREFIX vcard: SELECT ?givenName WHERE { ?y vcard:Family "Smith" . ?y vcard:Given ?givenName . } ``` -------------------------------- ### RDFWriter Properties Example Source: https://github.com/apache/jena-site/blob/main/source/documentation/io/rdfxml_howto.md Example of setting properties on an RDFWriter for RDF/XML-ABBREV. ```Java RDFWriter w = m.getWriter("RDF/XML-ABBREV"); w.setProperty("attributeQuoteChar","'"); w.setProperty("showXMLDeclaration","true"); w.setProperty("tab","1"); w.setProperty("blockRules", "daml:collection,parseTypeLiteralPropertyElt,parseTypeResourcePropertyElt,parseTypeCollectionPropertyElt"); ``` -------------------------------- ### SPARQL OPTIONAL Query for Comparison Source: https://github.com/apache/jena-site/blob/main/source/tutorials/sparql_union.md A SPARQL query using OPTIONAL to retrieve names, demonstrating a different approach to augmenting solutions compared to UNION. ```sparql PREFIX foaf: PREFIX vCard: SELECT ?name1 ?name2 WHERE { ?x a foaf:Person OPTIONAL { ?x foaf:name ?name1 } OPTIONAL { ?x vCard:FN ?name2 } } ``` -------------------------------- ### Example RDF Vocabulary Source: https://github.com/apache/jena-site/blob/main/source/documentation/tools/schemagen.md An example of a mini-RDF vocabulary used to demonstrate schemagen. ```rdf A class of canine companions The name that everyone calls a dog Posh dogs have a formal name on their KC certificate Deputy is a particular Dog Deputy Dawg of Chilcompton ```