Skip to content

Instantly share code, notes, and snippets.

@Locke
Locke / CoreASM.xml
Created October 13, 2019 08:54
IntelliJ CoreASM Syntax Highlighting
<filetype binary="false" description="CoreASM" name="CoreASM">
<highlighting>
<options>
<option name="LINE_COMMENT" value="//" />
<option name="COMMENT_START" value="/*" />
<option name="COMMENT_END" value="*/" />
<option name="HEX_PREFIX" value="" />
<option name="NUM_POSTFIXES" value="" />
<option name="HAS_BRACES" value="true" />
<option name="HAS_BRACKETS" value="true" />
@Locke
Locke / 1.txt
Last active July 5, 2018 12:20
representativeEntities
I noticed that Openllet implements `getInstances` in a way that respects the IndividualNodeSetPolicy (BY_SAME_AS / BY_NAME).
However, when I use Openllet with the Java Stream interface from `OWLReasoner.instances` the nested nodes get flatMapped and the stream contains all elements, especially those "duplicates" I'm not interested in.
It looks to me like the Java Stream API is quite new, but will be the preferred way in the future of this project. Therefore I would expect a Stream API to get instances without the "same as duplicates".
I currently see some possible ways:
1. change `OWLReasoner.instances` to respect IndividualNodeSetPolicy (would be a breaking change)
2. provide an additional method for such retrieval in the OWLReasoner interface (could be independent of the IndividualNodeSetPolicy setting, might be interesting for a mixed-mode usage)
3. leave this to the reasoner implementation, i.e. override OWLReasoner.instances in PelletReasoner
<?xml version="1.0"?>
<Ontology xmlns="http://www.w3.org/2002/07/owl#"
xml:base="http://de.athalis.owl.App.main()"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xml="http://www.w3.org/XML/1998/namespace"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
ontologyIRI="http://de.athalis.owl.App.main()"
versionIRI="http://de.athalis.owl.App.main()_0.0">
<Prefix name="" IRI="http://de.athalis.owl.App.main()"/>
locke@UBUNTU:/mnt/c/Users/andre/Downloads/casm-0.1.0/casm-0.1.0$ cmake .
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
@Locke
Locke / App.java
Last active June 4, 2018 18:18
NullPointerException in BlockingContext.moveBlockerUp
package de.athalis.owl;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import openllet.owlapi.OpenlletReasoner;
import openllet.owlapi.OpenlletReasonerFactory;
import org.semanticweb.owlapi.apibinding.*;
C:\git\jline3\demo>jline-gogo.bat verbose
Launching Gogo JLine...
Classpath: C:\git\jline3\demo\target\classes;C:\git\jline3\demo\target\lib\jline-3.6.2-SNAPSHOT.jar;C:\git\jline3\demo\target\lib\org.apache.felix.gogo.runtime-1.0.8.jar;C:\git\jline3\demo\target\lib\org.apache.felix.gogo.jline-1.0.8.jar
Feb 21, 2018 12:39:39 PM org.jline.utils.Log logr
FEIN: Error creating JNA based terminal: com/sun/jna/win32/StdCallLibrary
java.lang.NoClassDefFoundError: com/sun/jna/win32/StdCallLibrary
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
@Locke
Locke / Hot_logo.svg
Created January 7, 2018 13:12
Hot logo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Locke
Locke / gist:2c3c84ee3777ec584dd9793f2a8c2af9
Last active November 3, 2016 21:52
scala 2.12.0: Subtractable's type parameter bounds
$ sbt
> console
[info] Starting scala interpreter...
[info]
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_111).
Type in expressions for evaluation. Or try :help.
scala> val nestedScala = Seq(Set("a", 1), Map(5 -> "x"))
nestedScala: Seq[scala.collection.immutable.Iterable[Any] with Int => Any{def seq: scala.collection.immutable.Iterable[Any] with Int => Any{def seq: scala.collection.immutable.Iterable[Any] with Int => Any}}] = List(Set(a, 1), Map(5 -> x))
@Locke
Locke / Helper.scala
Last active August 17, 2016 08:47
Set[(A, B)] toSetMap
/*
I needed a quick transformation like `toMap` on Set[(A, B)] that retains all of B's values.
Thanks to https://twitter.com/br_waldteufel/status/765831435244670976 this is now much cleaner than the first revision :)
example:
scala> Set(("A", 1), ("A", 2), ("B", 1)).toSetMap
res0: Map[String,Set[Int]] = Map(A -> Set(1, 2), B -> Set(1))
package locke.util.matching
import scala.util.matching.Regex
import scala.concurrent.Future
object implicits {
implicit class ConcurrentRegex(private val regex: Regex) extends AnyVal {
def replaceAllInConcurrent(target: CharSequence, replacer: Regex.Match => Future[String])(implicit ctx: scala.concurrent.ExecutionContext): Future[String] = {
val f: Iterator[Future[String]] = regex.findAllMatchIn(target).map(replacer)