Example SPARQL queries that can help you list the classes in an ontology. List all classes PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> SELECT DISTINCT ?type WHERE { ?s a ?type. } Note: The SPARQL keyword a is a shortcut for the common predicate rdf:type, giving the class of a resource. List root classes SELECT ?directSub ?super WHERE { […]

Construct a graph giving ontology structure (the class hierarchy, properties, domains and ranges) CONSTRUCT { ?s ?p ?o . } WHERE { VALUES ?p { rdfs:subClassOf rdfs:subPropertyOf rdfs:domain rdfs:range} ?s ?p ?o } Note that when a reasoner is enabled classes may typically be inferred to be rdfs:subClassOf themselves and rdfs:subClassOf any parent class, not […]

Find all triples Use SELECT to signify you want to SELECT certain information and WHERE to signify your conditions, restrictions, and filters. A limit is used to avoid cracking the server on a large dataset. SELECT ?subject ?predicate ?object WHERE {?subject ?predicate ?object} LIMIT 100 Find all same-subject triples by given subject By specifying only […]

A recipe for responding to a button click with an RxJS Observable. HTML <script> src=”https://unpkg.com/@reactivex/rxjs@5.3.0/dist/global/Rx.js”></script> <button>Click me</button> JavaScript var button = document.querySelector(‘button’); Rx.Observable.fromEvent(button, ‘click’). subscribe( (value) => console.log(value.clientX) // just for example, log the x position of the cursor ); JavaScript – Line 3 The observable is created by the operator, fromEvent, which takes an […]