A blog about ideas relating to philoinformatics (or at least that have something to do with computer science or philosophy)
Showing posts with label Semantic Web. Show all posts
Showing posts with label Semantic Web. Show all posts

Wednesday, December 8, 2010

Sparql on Riak

Graph Data Stores
There are generally two different goals people have in mind when using graph data stores.
  1. Graph-walking from node to node, by following edges in the graph. People usually have social networks or The Social Web in mind.
  2. Dynamic schema or schemaless triplestores. People usually have mass fact databases (aka "knowledgebases") or The Semantic Web in mind.
But under the covers, these two concerns generally overlap as graph data stores.

Riak is a very interesting, open source, homogeneously clustered, document data store. But Riak also supports "links" between documents, which makes it a graph data store as well. These links were designed for the goal of graph-walking. An interesting feature is that this graph-walking is reduced to a series of map-reduce operations so queries are fulfilled in parallel across the cluster.

SPARQL on Riak
SPARQL is a query language that is designed for the triplestores (the 2nd goal) but I see no reason why you couldn't use it for graph data stores in general, at least in theory. So if you can reduce SPARQL queries down to a Riak queries then you automatically get your SPARQL queries reduced down to map-reduce operations. Riak even supports something similar to SPARQL property paths where you can keep intermediate results while following links, so it might not be too difficult reduce most types of SPARQL queries. One concern I have (after the main concern of whether the reduction is possible) is whether Riak can handle billions of tiny "documents", which would essentially just be URIs unless you wanted to store associated documents with each URI.

Infinitely Scalable Triplestore
One goal I would like to see achieved is an infinitely scalable triplestore. Or if "infinite" is too strong of a word, let's say a triplestore that can handle an order of magnitude more triples than the biggest triplestores out there. This SPARQL on Riak proposal might actually be able to pull this off. The query might be unbearably slow, but it should complete reliably even if it takes hours, days, or months. Creating some sort of major plug-in for Apache Hive that handles SPARQL-like queries (Hive currently supports SQL-like queries) might be the more ideal way to build an infinitely scalable distributed triplestore, but doing this would be much more difficult.

Wednesday, December 1, 2010

Bridging Ontologies: The Key to Scalable Ontology Design

It's been years since I've created an ontology (in the computing/informatics sense) but I'm going to give some advice on creating them anyways. When creating an ontology, it can be helpful to connect it up to other related ontologies. In fact, I think this is a requirement for building the semantic web (taking 'ontology' in a broad sense). You may want to ground your ontology (i.e. connect it to more generic or foundational ontologies; towards upper ontologies) or connect it to well known ontologies increasing the potential usefulness and adoption of your ontology. Whatever the reason, there are benefits in doing so if you want the data that your ontology schematizes to be more easily and automatically reusable. The potential downside is that you are forcing your users to endorse the ontology you're connecting to. So how exactly should one connect their ontology into the ontology ecosystem?

Most ontologies out there seem to me to be part of a stack of ontologies built by a single group of people. The ontologies tend to build directly on top of each other, meaning "lower" ontologies directly reference "upper" ontologies. Since the ontologies are developed by a single organization, it seems to make sense to directly connect to them because the organization (arguably) knows exactly what they are attempting to represent or what they mean. The fact that organizations tend to keep their ontologies rather isolated may be caused by a fear to commit to ontologies they didn't create.

The way ontologies are (or at least should be) developed allows the possibility for changes and updates. To accommodate this, one should develop ontologies with versioning. This way, someone using your ontology won't ever have it change on them and the developers can still maintain and change the ontology by introducing new versions. It's as simple as adding a version number to your ontology's url.

But this brings up the problem we face by directly referencing other ontologies. Let's imagine you have an ontology X that makes reference to another ontology Y and that ontology Y has a newer version available. You're planning on updating a term in X to make reference to essentially the same term but in the newer version of Y to keep X up to date. So you update X to the new version of Y even though it basically hasn't changed its meaning. The role an ontology fulfills is to describe a certain subject or topic and this intrinsic meaning has not changed. Yet you still need to change your ontology. Under these conditions, no matter how much concensus is formed around the accuracy of your ontology, you will never know when it is stable. In fact, this leads to a cascading of updates and changes required by upstream ontologies that reference your ontology, and so on. This is not a distributed web-scale ontology design pattern. We need a way to decouple our ontologies.

So, is there a design pattern we can use to avoid these dangers and burdens of connecting to other ontologies? Can we do better than simply identifying good stable ontologies and directly referencing only those ontologies in our own ontology? Yes!

Introducing: Content vs Bridging Ontologies

The key to scalable ontology design is what I call Bridging Ontologies. You write your intended ontology without referencing other ontologies and then create a separate ontology that is mainly made up of owl:sameAs and rdfs:subClassOf relationships between your terms and the target ontology's terms. I call these ontologies Content Ontologies and Bridging Ontologies, respectively. You only need to update your Bridging Ontology when either the source or target ontology changes. The nature of a Bridging Ontology makes it useless for anyone to reference in their own ontologies, which stops any potential cascade of changes throughout the web of ontologies. Of course users would still need to use the Bridging Ontologies and would likely need to collapse/deflate the owl:sameAs relationships into single terms for most visualizing, processing, or reasoning purposes.

I'll go out on a limb here and say that every ontology anyone creates should be isolated in this manner. The vision then becomes a web of ontologies of small Content Ontology nodes that satisfy specific "semantic roles" and then Bridging Ontology edges definied between these Content Ontologies. Since you don't need to adopt all of the Bridging Ontologies that are built for a Content Ontology, it is much easier to reach concensus on the Content Ontologies and then to pick and choose your Bridging Ontologies, choosing to commit (or not) to exactly how that content fits into the big picture. This allows for decoupled semantics rather than traditional inflexible semantics.

Monday, March 15, 2010

Conceptual Space Markup Language (CSML)


I've recently come across a great paper by Benjamin Adams and Martin Raubal called Conceptual Space Markup Language (CSML): Towards the Cognitive Semantic Web. I found their paper interesting on many levels because it lies at the nexus of many rather diverse topics that I’m interested in. CSML directly involves Computational Geometry and the Semantic Web, but indirectly involves the philosophy of meaning, mind, and color. Also, as it grows in popularity, I believe force-based organizational algorithms and neural networks will become a heavily used mechanism for generating and using CSML data. Basically, CSML takes Conceptual Spaces, which are already at an interesting intersection of multiple mind sciences and multiple strands of philosophy, and connects it with multiple threads of engineering and informatics.

Wait.
What are Conceptual Spaces?

Conceptual Spaces are multidimensional spaces made up of quality dimensions. Quality dimensions are basically just any property you can think of that has a (pseudo-) continuous range of values. Think: size, mass, brightness, beauty, craziness, unicornity or anything else that you think you can make sense of on some sort of numerical range. You can now consider points and (convex) shapes within your set of quality dimensions, which will correspond to concepts. Consider the classic-cool-colour-cone example to the lower right. That’s a representation of a conceptual space with quality dimensions of hue, value, and saturation. 

But this isn’t just a fancy mathematical model. Structures like this are in some sense actually “held” by neurons in your brain. You may have heard people talk about "levels of reality" (or "levels of description of reality") such as the physical level, biological level, psychological level, sociological level, etc. Well, the idea is that when you look into the brain, which is (of course) very complex, you can look at it "at different levels" (presumably of granularity in this case). Conceptual Spaces are one of those lesser-known but very useful levels between the neuronal level and the psychological level (and below the symbolic level if you think there is one). Other people have much more comprehensive and informative explanations that I’m not going to try to repeat here. If you’re interested in the multitude of potential philosophical implications check out Paul Chruchland’s State-Space Semantics and Meaning Holism. (He’s also got some good stuff to say about colors outside of the classic-cool-color-cone here.)

CSML describes Conceptual Spaces

CSML, the Conceptual Space Markup Language, is an XML serialization of conceptual spaces. CSML brings a whole new engineering dimension to conceptual spaces which fits into the realm of Semantic Web technologies and is actually analogous to OWL, but with radically different implications. In my previous post, which was actually written in June 2008, I dreamed of a “smooth semantic web” that didn’t always require rigid categorization. CSML looks like a better candidate to handle that kind of data. CSML is specifically designed to handle context-dependent meaning and (relative) similarity of concepts, which are both difficult to handle in OWL. (How would you represent a large squirrel and a tiny planet consistently? What about brightness, beauty, craziness, and unicorniness?) After trying to use a few units ontologies for measurement data (at iCAPTURE for Mark Wilkinson) I also have high hopes that CSML can help simplify the problems on that front.

The most exciting part for me is that conceptual spaces lend themselves to fancy techniques for being automatically generated by way of artificial neural networks and force-based organizational algorithms, which brings in a few more of the theoretical engineering topics I’ve been interested in over the years. Starting with similarity data, force-based (or tension reduction) algorithms could help identify quality dimensions. Neural networks can nicely use quality dimension coordinates as input and also learn to precisely place items into conceptual spaces. I can’t wait to see the tools that will be created to allow for generating, reasoning over, and visualizing CSML data and how they will integrate with existing semantic web technologies and machine learning techniques.

Saturday, March 13, 2010

Towards a Smooth Semantic Web

This is an almost complete draft I wrote almost 2 years ago. I thought I should publish it because it is basically complete, and because my next post will be about the new language and technologies that will make the "smooth semantic web"  a reality. And for the record, 'smooth semantic web' was a provisional name to be changed before publishing.
Here it is:

The Semantic Web is slowly building up and will eventually grow to a critical mass where it will become useful. How useful is another question. Will it revolutionize the web? Web 3.0? Maybe. Maybe not. But it will definitely have a use and an effect. The current standards such as RDF, OWL, SWRL, SPARQL, and SKOS are good, and still have a ton of potential that is growing exponentially as we speak. But these standards are not enough. OWL and SKOS can only capture so much knowledge. They can capture crystalized categorizations of well defined concepts. But much, if not the vast majority, of knowledge is not found in strict categorization and necessary relationships. So what is missing?

People have made attempts to extend OWL in a few different ways to make it cover a wider range of statable knowledge. People have looked into adding probability, non-monotonicty (time), belief. I propose a different addition which, if adopted, would add a prior layer to OWL, just as the above attempts do.

Consider a music ontology. OWL can support certain relationships such as: Rock ISA Genre, Track isPublishedOn CD, etc. But the certain pieces of knowledge cannot be represented because they haven't been crystallized to the point of being definable, especially when you consider the categorization of instances. Imagine the daunting task of deciding whether certain border line songs count as belonging to a specific genre. But consider the task (still daunting, but not as much) of deciding whether a song is "better classified as Rock than Rap" for instance. It may be difficult to say that a song is Rock, or is Rap, but it may be clear which one it is closer to. Much more can be said.

Notice that we are not talking about probabilities here. It isn't semantically correct to say that a song is "more likely" categorized as Rock than Rap. We are saying that if we were to categorize it as either Rock or Rap, it would be better categorized as Rock than Rap.

You may be wondering what the criterion for "better" is or should be. This itself should be represented within a knowledgebase.

So how would we use this knowledge? SWRL and SPARQL can only handle deductive reasoning, so they won't help. There are two options, the way I see it. Take my smooth knowledge and use some kind of classifying step to derive a regular rigid knowledgebase. The other option is to invent smooth reasoners. I think vector space representations and abduction would be important for this step.

Tuesday, August 5, 2008

Large and Small Controlled Vocabularies

I've been thinking about something to make using a project called Entity Describer (ED) that my co-workers have been working on. I thought, and still think, I should make a recommender because ED should contain better tag data than basically all other tag sets because the tags are taken as a controlled vocabulary from Freebase. A controlled vocabulary gives you spelling correction and possibly disambiguation, but because the tags are from Freebase, ED also has a very large user generated vocabulary, and connections between the tags (aka semantics). But I realized that the tag data generated by ED doesn't contain information about what the users like and dislike (as of July 2008), though you could guess that most users tag things they like much more often than things they dislike.

Fortunately, ED will soon allow you to choose which vocabulary you would like to use if Freebase topics aren't right for your tagging needs. So I thought I would create a few vocabularies including:
  • Thumbs up and down
  • Agree/Disagree (more concrete, but less usable than thumbs)
  • Consistent, Valid, Sound, Straw Man, etc (for arguments, and maybe good for philosophy papers)
  • Stars (0 or 1) to (4, 5, or 10) seems popular
  • "Effects on mentality" like frightening, enlightening, and annoying (kind of like TED talk ratings)
  • Emotions (similar to effects on mentality)
    or my personal favourite
  • "like this", "want people to see this", "want to see more like this", "agree with this", and the inverses (a small set of reasons I've used thumbs up or thumbs down with the Firefox StumbleUpon add-on)
I could create these vocabularies, but why not add them to Freebase and let people use them from there? This got me thinking about something more general.

One great reason to use Freebase for tags is that there are so many. But when trying to use the tag data to make (say) a recommender, the user may not have found their ideal tags to use. So what a person actually felt about something slightly differs from what they expressed through tagging it. This doesn't happen with a sufficiently small vocabulary. You know that the user found the best description they could, but then they may not have been able to express themselves with the limited vocabulary. So, either way, big or small vocabulary, tags may not be reflecting what the user has in mind.

There are definitely ways to alleviate this problem, and the best size totally depends on exactly how and what your users are tagging. I think the above small vocabularies would all work better outside of Freebase, but tags describing the subject of a website work better within Freebase. What do you think? How significant is this problem? When is this problem most significant? Do you think a vocabulary of content types (i.e. Blog, Video, News, Article, Game, etc) is better inside or outside of Freebase?

Wednesday, July 16, 2008

Types of "trust" needed in semantic web

Anyone (or anything) can potentially publish RDF data. In order to know whether you should use their data, there are many issues of trust. There are (at least) two important categories of trust when it comes to the semantic web.

1) Personal Trust
Personal trust amounts to trusting that the creator of the data has the right motives. Spam is a good example. This kind of trust will become more important as the semantic web grows, but isn't a major problem yet.

2) Reliability Trust
Being able to trust data found on the semantic web requires knowing how reliable the data is. Was it created by experts? Is there a peer review mechanism? Was it created by automatic natural language processing? Currently this kind of trust is also not too important, but I believe it will become very important much faster than personal trust. We already know how to solve the reliability trust issues, with more metadata. We will need data about how the data was generated. (Note that implementing this allows more options for lying about data, and so doesn't really help with personal trust issues).

Thursday, July 3, 2008

Getting rough data into the semantic web

It's nice when regular relational databases, excel spreadsheets, and other sources that people have created can be attached to the semantic web. But there are problems with the way most data is recorded, especially for data about time. In short, the problem is that people round values. This may seem like a trivial unimportant problem, but I don't think so if you want to be able to use the rough data that makes up most of the world's data. Here are the issues:

1) Datatype granularity. Datatypes allow for a wide range of possible values, but not all values. We may need to know in some situations whether the data value written is an exact match to the value that was intended. For instance, 1/3 can't be represented fully as a double and 3pm today can't be represented as a date without dropping the 3pm part.

2) Granularity used vs datatype granularity. This is a much bigger problem than (1). People often write things to a granularity that is much less fine grained than the datatype granularity. For instance, you may be recording distance to 2 decimal places and storing it as a float. This needs to be taken into account for situations where values are compared. We don't want to say that two things have the same height just because they are almost the same height. Also, people round times to the minute, 5 minutes, 10 minutes, 15 minutes, hour, and many other ways. Are they rounding down? Are they rounding to the nearest? Some other recording method?

An ontology that has commonly used recording methods to describe the data recording process would allow more justified inferences about the data to be made. This would allow a higher level of trust (in the second sense, explained here) when using the data which is going to be of great importance as the semantic web grows.

Friday, June 13, 2008

Pellet + OWLAPI + SWRL

I've found over the last couple of months that there are a LOT of different ways to mess up when trying to use SWRL, Pellet, and OWLAPI. I'll try to list everything I can remember getting stuck on or potentially getting stuck on. Feel free to add your own by comment.

Java Heap Overflow errors:
  1. remember that you can add more memory to java in Eclipse for a single project by going to Run -> Open Run Dialog -> Arguments and then adding -Xmx1024M to your VM Arguments (or some other value instead of 1024).

  2. A great solution is to break your data into separated named graphs where you know the information will not be important between the graphs. For me, this fixed everything (especially in FaCT++ where it fixed speed issues as well). I had data about patients that I knew were not the same patient, and I reason about each patient one at a time.

  3. Still not enough? I'm not sure what to say yet, but I have some extremely unthought out guesses: try KAON2 because I heard it scales better (but might only scale for speed), try a database backend with an rdf to sql mapper (such as D2R Server), and try OWL-Lite (if expressive enough for you). None of these guesses might do anything to fix your problem, but they are what I'm going to try next if I hit this problem. Please tell me if these options would or wouldn't help.

  4. If you're using SWRL rules, try the Rete algorithm (if using a version of Pellet pre-1.5.2). Turn Rete algorithm on by writing this line: PelletOptions.USE_CONTINUOUS_RULES = true;
    I've heard there are some specific cases where this algorithm is slower, but it usually isn't.

  5. This probably won't happen to you because you are smarter than me. But make sure when you are trying to write "facts" between individuals you don't refer to classes. Write it like this:
    axioms.add( factory.getOWLObjectPropertyAssertionAxiom( personInd, hasWeightOP, weightInd ) );

    and not like this:
    OWLObjectValueRestriction hasWeightTheWeight = factory.getOWLObjectValueRestriction( hasWeightOP, weightInd );
    axioms.add( factory.getOWLClassAssertionAxiom( personInd, hasWeightTheWeight ) );

SWRL rules just won't work:

  1. Is your SWRL rule Safe? I saw a few different definitions of "SWRL rule safety" but the one that seems to be right is: Make sure all individuals that are involved are explicitly added! For example, if you have a rule like this:
    Person(?x) ^ drives(?x,?y) ^ Car(?y) -> Driver(?x)
    and you have an instance of person which is also an instance of "drives some Car", but you don't have an the instance of Car that he drives explicitly added, the rule will not return the person instance as a driver instance. For more check this part of the ProtegeWiki: SWRLLanguageFAQ.

  2. Simplify rules as much as possible. Don't use negation (NOT) and don't use disjunction (OR). I've never had a problem with this, or even tried it, but I seem to remember people having problems with this... somewhere.

Reasoning takes too long!
  1. I'm still working on this... but reducing expressivity can't hurt. It sounds like OWL-Lite would make a huge difference for speed, but you have to sacrifice so much that personally, it doesn't seem like it's ever worth it unless you want structured tags and don't care about answering queries.
  2. Try FaCT++. It was orders of magnitude faster when I used iterative reasoning as explained above.