When developing with the Carbon LDP JavaScript SDK and using the sparqler library, you could stumble upon the error: Error: The used prefix has not been declared. In one case where I generated this error, the complete console error was as follows: ExploreComponent.html:48 ERROR Error: The used prefix has not been declared at IRIResolver.push../node_modules/sparqler/iri/IRIResolver.js.IRIResolver.resolve (IRIResolver.js:23) […]

The conditional (ternary) operator is the only JavaScript operator that takes three operands and it is frequently used as a shortcut for the if statement. // If isMember (first argument) evaluates to true, return “$2:00” (first expression), // else return “$10.00” (second expression) function getFee(isMember) { return (isMember ? “$2.00” : “$10.00”); } // Another […]

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 ); The observable is created by the operator, fromEvent, which takes an “element” and an event […]

This page provides a log of how I setup a Liferay development environment using Ubuntu and VMWare Fusion. The idea is to be able to develop for Liferay CE and Liferay DXP although only the CE portion is fully setup so far, with the DXP portion standing by for potential completion in the case of […]

How to install Oracle Java 8 on Ubuntu (in may case, Ubuntu 16.04 LTS) Procedure to install Oracle Java 8 on Ubuntu You probably want to confirm first that a version of Java is not already installed. If so, you can do that with the java -version command as shown below… developer@ubuntu:~$ java -version The program ‘java’ […]

RDF can be expressed in a variety of different serialization formats. It can also be used inline with HTML. Following is an example of the most widely used of these formats so that you can compare them at a glance. RDF/XML An XML-based syntax for RDF graphs that was the first standard format for serializing […]