Archive

Posts Tagged ‘sesame’

Pork and Noodles

June 11, 2016 Comments off

Marinade (or coat if you dont have time) minced pork in a mixture of 2 tablespoons each of cornflour, fish sauce, soy sauce (dark and light to give it some colour), oyster sauce; a chopped chili, a couple of cloves of garlic, some chopped ginger – it should be fairly wet and not too thick, perhaps like consistency of single cream.

Boil water for noodles.

Wok on high, starting cooking mince – it will clump together because of the cornflour. Add some thinly sliced white cabbage/bean-sprouts/brocolli even – whatever you like with pork. Garnish with chopped redpepper, coriander, sesame seed and oil, lime juice.

Mix with noodles, serve.

EAT YUM

Aperture Nepomuk queries

February 22, 2011 1 comment

Having crawled an Imap store (ie google mail), I now need to query the results to see whats what, whos who, and how they are connected, if at all.

These are the namespace prefixes used in the queries

Prefix URI
nie http://www.semanticdesktop.org/ontologies/2007/01/19/nie#
nco http://www.semanticdesktop.org/ontologies/2007/03/22/nco#
nfo http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#
nmo http://www.semanticdesktop.org/ontologies/2007/03/22/nmo#
sesame http://www.openrdf.org/schema/sesame#

And these are the queries. Note that each message is in its own graph, and references the folder in which it rests – eg <imap://youraddress@imap.yourprovider.com/INBOX;TYPE=LIST>. This in turn nie:isPartOf another folder, which isnt nie:isPartOf a parent folder.

An Imap store has a username and password etc, but doesnt have an associated email address. A folder may contain messages to the owner with an email address the server accepts, but may also contain messages to other addresses if the cc list contains the owner address.

id Folder Relationship Purpose Query
inbox direct Basic find list of emails, with
sender email address
select distinct ?subject
?from ?address{

?s nmo:from ?o  .
?o nco:fullname ?from .
?o nco:hasEmailAddress ?e .
?e nco:emailAddress
?address .

?s nmo:messageSubject
?subject .

?s a nmo:Email} 


note : with a Jena TDB dataset, use

select distinct ?subject ?from ?address{
graph ?g{
?s nmo:from ?o  .
?o nco:fullname ?from .
?o nco:hasEmailAddress ?e .
?e nco:emailAddress
?address .
?s nmo:messageSubject
?subject .
?s a nmo:Email
}
}

inbox direct Find emails, distinguish
replies(and what replied to), and CC addresses
select distinct ?s ?subject
?r ?to ?refid ?from ?address{

?s nmo:from ?o  .
?s nmo:messageId ?sid .
?o nco:fullname ?from .
?o nco:hasEmailAddress ?e .
?e nco:emailAddress
?address .

?s nmo:messageSubject
?subject .

?s a nmo:Email
optional {
?s nmo:inReplyTo ?r .
?r nmo:messageId ?mid .
}
optional {
?s nmo:to ?toid .
?toid nco:fullname ?to .
}
optional {
?s nmo:cc ?ccid .
optional{
?ccid nco:fullname ?ccto .
}
}
optional {
?s nmo:references ?refid .}} 

order by ?subject

Note : nco:fullname optional as you may not know the email addressee’s name
Note : As with the basic query about, where using a Jean Dataset, you need a graph selector in the where clause eg

select * { graph ?g {?s ?p ?o}}
inbox direct most messages direct to you
select (count(?from) as ?count) ?from ?address{
graph ?g{
?s nmo:from ?o  .
?o nco:fullname ?from .
?o nco:hasEmailAddress ?e .
?e nco:emailAddress ?address .
?s a nmo:Email
} 

}
group by ?from ?address
order by desc(?count)
inbox direct most messages CC to you Not so easy : where you are a CC recipient, its not possible to match on the to: field, or with any metadata on the imap server.
inbox direct fastest replies
inbox direct most replies
inbox contacts and counts by mail
domain
inbox indirect messages to others on CC list
(may not be known to you, but sender knows)
outbox direct recipents (to,cc,bcc)
outbox direct replies
outbox direct most replied to
outbox direct most sent to
outbox direct fastest replied to (by message,
by recipient)
output direct fastest sent to (by message, by
recipient)

Things get more interesting when more that one mailbox is available for
analyis…but Im going to need Sesame3 or revert to Jena because Sesame2 doesnt do aggregate functions like count. 2 steps forward, 1 step back. So, Jena support in Aperture is minimal and old. It cannot make use of graphs, TDB or SDB, (but the libraries are up to date). It also doesnt support Datasets or Named Graphs in Jena. So, I add ModelSet (the RDF2Go adapter type needed), Dataset and Named graph support, in TDB to begin with. This involves updating the Aperture Jena adapter. Doesn’t seem to be any activity on the Aperture mailing list tho, as I get zero response to a question about updating the Jena support. Is Aperture another nice-but-dead Semantic Web technology ?

Java Semantic & Linked Open Data webapps – Part 5.2

February 8, 2011 Comments off

Continuation from previous article in series

The overall architecture for the Semantic backed J2EE app is different from the Linked data app already discussed because we need a business logic layer and a decoupling from the persistence layer. We also want to create a Java app rather than a semantic application so that the programming paradigms and patterns are familiar to the Enterprise java developer.

 

Semantically backed J2EE webApp - System diagram

Here we see a fairly standard 3 tier MVC application. Browser requests URIs from the appserver, or makes an Ajax call and gets html from server side JSPs or JSON formatted data in response, respectively. The application server contains java code that maps URIs and API calls to controllers, which make calls to service classes and DAO code. The DAO code makes call via a persistence proxy to get data from the server that is unmarshalled from RDF to java objects (or makes writes in the other direction). The persistence layer is configured to use an implementation that takes care of the Object to RDF mapping – two implementations are available (JenaBean and EmpireJPA). These in turn use their own protocols to talk to native or location repositories, or typically JDBC talk with standard DBMS. Spring and Spring security provide infrastructure level services for dependency injection, component wiring, MVC abstractions, and role, method and data level security for beans and dynamically created object instances. These technologies are shown below in the AppServer layer cake.

 

Technology libraries and tools used in Semantically backed J2EE WebApp

Technology libraries and tools used in Semantically backed J2EE WebApp

Obviously, there are many things going on here, and they’ll need some discussion

  • Basic building blocks, tool selection
  • Security considerations and restrictions
    • authentication – OpenID, admin login, facebook connect
    • authorisation role,uri,method,data levels
    • registration process
    • ownership, group (friend) and application membership, resolution (date & location cloaking)
    • ACL – data and dynamic object level authorisation
    • Syndication –
      • json,jsonp (get/post),window.name,ajax,
      • cors
      • oauth
      • API and result formats
  • Scale, concurrency, transactions,  failures, and performance
  • URIs, ontology, linkage
  • input, output interfaces
  • ontology to object/interface mapping

Lewis Topographical Dictionary Ireland and SkyTwenty on EC2

November 17, 2010 Comments off

Both applications are now running on Amazon EC2 in a micro instance.

  • AMI 32bit Ubuntu 10.04 (ami-480df921)
  • OpenJDK6
  • Tomcat6
  • MySQL5
  • Joseki 3.4.2
  • Jena 3.6.2
  • Sesame2
  • Empire 0.7
  • DynDNS ddclient (see [1])

Dont try installing sun-java6-jdk, it wont work. You might get it installed if you try running instance as m1.small, and do it as the first task on the AMI instance. Didnt suit me, as I discovered too late, and my motivation to want to install it turned out to be no-propagation of JAVA_OPTS, not the jdk. See earlier post on setting up Ubuntu.

  • Lewist Topographical Dictionary of Ireland
    • Javascript/Ajax to sparql endpoint. Speedy.
    • Extraction and RDF generation from unstructured text with custom software.
    • Sparql endpoint on Joseki, with custom content negotiation
    • Ontology for location, roads, related locations, administrative description, natural resources, populations, peerage.
    • Onotology for Peerage – Nobility, Gentry, Commoner.
    • Find locations where peers have more than one seat
    • Did one peer know another, in what locations, degree of separation
    • Linked Open Data connections to dbPedia, GeoNames (uberblic and sindice to come) – find people in dbPedia born in 1842 for your selected location. Map on google maps with geoNames sourced wgs84 lat/long.
  • SkyTwenty
    • Location based service built JPA based Enterprise app on Semantic repo (sesame native).
    • Spring with SpringSec ACL, OpenID Authorisation.
    • Location and profile tagging with Umbel Subject Concepts.
    • FOAF and SIOC based ontology
    • Semantic query console – “find locations tagged like this”, “find locations posted by people like me”
    • Scheduled queries, with customisable action on success or failure
    • Location sharing and messaging with ACL groups – – identity hidden and location and date time cloaked to medium accuracy.
    • Commercial apps possible – identity hidden and location and date time cloaked to low accuracy
    • Data mining across all data for aggregate queries – very low accuracy, no app/group/person identifiable
    • To come
      • OpenAuth for application federation,
      • split/dual JPA – to rdbms for typical app behaviour, to semantic repo for query console
      • API documentation

A report on how these were developed and the things learned is planned, warts and all.

[1]http://blog.codesta.com/codesta_weblog/2008/02/amazon-ec2—wh.html – not everything needs to be done, but you’ll get the idea. Install ddclient and follow instructions.