Sunday, August 12, 2007

When not to use XML

Discovered the hard way that "xml" as the start of a namespace prefix (e.g. xmlfoo:) is a no-no. Apparently "xml" as a prefix within a namespace prefix is off limits -causes Jena errors.

Sunday, August 05, 2007

Always run consistency checks...

Always.

Jena No Likey XML 1.1??

Having some headaches with Jena loading XML 1.1 based ontologies this evening. The underlying SAX parser is XML 1.1 capable but it seems that the parser is not instantiated with XML 1.1 options turned on.

Searching the net I'm not finding much discussion on the topic which leaves me wondering if I'm the first to arrive at this point. Does anyone know if there is a way, short of rebuilding Jena itself, to get Jena to load XML 1.1 based models?

Thursday, June 28, 2007

Ontologies do NOT import namespace prefix mappings

For quite a while I was lead to believe that namespace prefix mappings were imported into an ontology and were "known" and reusable by the importing ontology. While this is true for seemingly everything else: classes, properties, individuals, statements, it is not so for namespace prefix mappings.

Why? Well, namespace prefixes are an XML concept while the rest are ontology (RDF/OWL) concepts. TopBraid Composer also misdirected me a bit by reusing the same "shading means imported" paradigm used for classes and the like as it did for namespaces. For namespaces, shading does mean that they have come from an imported source, you just can't make use of them -they are presented for informative purposes only. If you do want to use a namespace from the import list, "Clone" it with the "Clone" button, this makes a local copy.

If you don't, TBC is smart enough to make some guesses to resolve unknown prefixes, but when it can't it uses a "j.#" (i.e. j.0, j.1, j.2 ...) as a place holder (really its Jena doing this).

Live and learn...

Tuesday, April 24, 2007

TBC: Indirect Instances

Finally!

For months my coworker has had a neat feature enabled in his TopBraid Composer where from a parent class the instance count of child, subchild, etc are indicated at the parent level in parenthesis. This is a nice feature because it saves you from drilling down class trees to find where your instances are.

Only problem was he couldn't recall how he enabled the feature and it wasn't an option in the Window > Preferences > TopBraid Composer list. I stumbled into it under the "Instances" window options. Its the last option with the label "Show indirect instances":

This feature definitely reduces my instance hunting time, modeling life just got easier.

Wednesday, April 11, 2007

SeRQL Query for all Resources w/o Some Relationship

After a few tries I managed to form a SeRQL query that would give me resources of a given type that did not have a given relationship:

select distinct
localName(A)
from
{A} rdf:type {foo:AClass}
where not exists (
select A
from
{A} foo:hasBar {B}
)
using namespace ...

Still, it seems this could be more simply expressed, what I was initially expecting was something more concise such as:


select distinct
localName(A)
from
{A} rdf:type {foo:AClass},
![{A} foo:hasBar {B}]
using namespace ...

Tuesday, April 03, 2007

The Case for Anti-Triples

A super convenient feature of TopBraid Composer is the capability to manage and manipulate triples. You can drag a statement from one resource and copy onto another, or a selected group. This saves lots of repetitive work. Yet another reason TBC is my favorite ontology editor.

It is so convenient and you quickly become so dependent on the feature that you start wishing that you could remove triples from a group of resources in the same way. Triples are always additive in these scenarios, they can only add information and not remove it. Thus the need for an anti-triple, a triple that represents anti-information.

This could simply be a triple that is flagged to have a negative sign, so when dropped onto a resource it remove an occurrence of itself -or the pattern it represents. Thought of another way, when a triple meets an anti-triple in an ontological space, they annihilate each other.

I'm thinking of anti-triples as an editing paradigm of convenience of course. For instance a triple could be dropped onto a resource with the "-" key held down to take the deletion action.

Of course Anti-Triples recognized in a future OWL revisions could lead to anti-ontologies of a anti-knowledge, which would no doubt be abused by black-hats for information espionage and evil doing. Eventually getting fully out of hand by a mad scientist bent on the uncreation of the Semantic Web lest our hero reaches the glowing red off button in the control room in the base of the hollowed out volcano which has just decided to conveniently erupt.

Time to write a screen play... maybe the Semantic Web will lead to a revival of all the cheezey "net" movies and television shows of the late 90s. Will semantics make the net-cheeze-flicks any more intelligent this time around?

TBC Tip: Form Clicks for Productivity

I've learned quite a lot about TBC since my last post in January and have a backlog of tips and techniques to record here, no doubt I've already forgotten a few, but they should come back to mind eventually.

A trick I've learned only this week helps when working with Class and Resource Forms. When in a Form view, an alternative to pulling down and selecting the "Add empty row" menu item one can simply double click on the property label. For example when adding subclass constraints you may double click the "rdfs:subClassOf" label and an empty row appears. This saves some mouse work, still I'd like to see the "Insert" key do the same.

Another trick can simplify adding new properties to a form. In addition to dragging and dropping a property onto a form, you can right-click the form background and receive a list of applicable properties. Depending where you click on the form (Annotation, Axiom, or Other Properties sections) you get a context sensitive list of properties.

Less mousing around, more modeling, good stuff!

SPARQLets!

A neat feature of TopBraid Composer is the ability to save SPARQL queries in your ontology, as a "sparql:query" string type. These queries will then appear in "Query Library" tab where they can be invoked by simple mouse clicks. The inferred results can also be asserted and saved back into the model.

The stored queries are bound to a particular ontology though. I'd like to have a capability to store general queries in a "bookmark" like form that could be invoked against any ontology. This would be analogous to Bookmarklets (Bookmarks of Javascript Applets), thus SPARQlets!

For next week - SPARQLets that say "ni!"

Friday, January 05, 2007

Dropping Triples

Discovered another neat labor saving TopBraid Composer feature. Lets say you create a new property, apply it to an instance with some value, then need to repeat for oodles more instances of the same class, or may apply over various classes. Select the instances that you want to update and drag them in the Basket.

Now go to Window > Show View > Triples. The Triples window will appear, then check the ontology you want to work with, click the first "triple" icon, and navigate to and select the instance where you have already applied the property that you want to copy. Once you have a list of all triples where that instance is the subject shall appear.

Now the neat part. Select the triple(s) that you want to apply to instances in your basket, and simply drag and drop them on. A prompt will appear to ask if you want to apply the triple to the all individuals in the basket, making them the subject, click "Yes" and voila! You've just saved yourself a lot of repetition.

Neat feature #2:

I've been seeing the not-so-intuitive icon around, wondering what it was and never using it. Now its my favorite feature. Visually I thought it looked like something was being downloaded or saved. Its a reference finder, maybe binoculars would be a better mnemonic, I can't suggest anything sensible that makes for a better "reference" image. Select a property, class or instance, double click it to load it into a form. Then hit the "Find references" button, a tab will open in the lower pane with the label "Reference" and shows you call cases where that entity shows up in a triple.

Very handy if you're considering deleting an item, check first if it is referenced anywhere.