This is my personal cheat sheet for Microsoft Visual Studio Code (VS Code). It may be sparse at the moment, but I’m sure it will grow over time. Mainly, this is to record little commands and things that I am constantly forgetting (especially unique ones related to the unique plugins I use). HTML Tag Wrap […]

A tool that helps you write schema.org markup

Hans Polak has created a tool  for web designers to facilitate the creation of valid HTML5 schema.org  semantic schema’s. Using schema.org semantics to describe content allows search engines (Google, Bing, Yahoo, Yandex) to comprehend the content of web pages. Google, for example, can use these semantics to present search results with rich snippets (contextually better layouts). If you’ve ever […]

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. Find all same-subject triples by given subject By specifying only the subject in the pattern, we can return all triples […]

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 […]