Permalink
Browse files

added querying for companies

  • Loading branch information...
1 parent c5f8d01 commit e19c3c960146073feaca37a5ec947a9c70704640 Sebastian Germesin committed Feb 24, 2011
Showing with 84 additions and 84 deletions.
  1. +75 −68 demos/smartlist/index.html
  2. +5 −12 demos/smartlist/js/demo.js
  3. +4 −4 src/connectors/rdfa.js
View
@@ -28,6 +28,10 @@
<script type="text/javascript" src="../../lib/rdfquery/latest/jquery.rdfquery.core.min.js"></script>
<script type="text/javascript" src="../../lib/rdfquery/latest/jquery.rdfquery.rdfa.min.js"></script>
<script type="text/javascript" src="../../lib/rdfquery/latest/jquery.rdfquery.rules.min.js"></script>
+
+ <!-- AutoSuggest -->
+ <script type="text/javascript" src="../../lib/autosuggest/jquery.autoSuggest.js"></script>
+ <link rel="stylesheet" href="../../lib/autosuggest/autoSuggest.css" />
<!-- Autocomplete -->
<script type="text/javascript" src="../../lib/jquery-ui/js/jquery.ui.core.js"></script>
@@ -57,7 +61,7 @@
<!-- SIF - Domain specific Functionality -->
<script type="text/javascript" src="../../src/dsf/analyze.js"></script>
- <script type="text/javascript" src="../../src/dsf/places.js"></script>
+ <script type="text/javascript" src="../../src/dsf/companies.js"></script>
<script type="text/javascript" src="../../src/dsf/persons.js"></script>
<!-- SIF - Configurations -->
@@ -89,7 +93,7 @@
for (connector in persons) {
for (var x = 0; x < persons[connector].length; x++) {
var person = persons[connector][x];
- names.push(person.name.toString().replace(/"/g, ""));
+ names.push(person.name);
}
}
response(names);
@@ -116,86 +120,31 @@
</center>
<div>
<div smart="true" id="summary">
- <h3>Example text</h3>
- <p>The event took place in Paris, France.
- Victoria Beckham, <span id="barack" typeof="v:Person" about="#barack-obama">
- <span property="v:name">Barack Obama</span></span> and
- Michael Jackson were present at the event.</p>
+ <h3>Teaser</h3>
+ <p>The IKS Semantic interaction framework hackathon took place in Vienna, Austria.
+ Persons from different locations and companies came to work on the framework, e.g.,
+ GENTICS, <span typeof="v:Organization" about="#dfki">DFKI</span>, jQuery UI.</p>
<ul>
<li></li>
</ul>
- </div>
- <hr/>
- <hr/>
- <table>
- <tr>
- <td style="width:300px;vertical-align:top;"><div id="places">
- <h3>Tags - Places</h3>
- <button onclick="presentEntitiesAsTags($('#summary').sif().places(), $('#places input'));$(this).attr('disabled', 'disabled');">Retrieve all places</button>
- <input style="display:block;" type="text"></input>
- </div></td>
- <td style="width:300px;vertical-align:top;"><div id="persons">
- <h3>Tags - Persons</h3>
- <button onclick="presentEntitiesAsTags($('#test').sif().persons(), $('#persons input'));$(this).attr('disabled', 'disabled');">Retrieve all persons</button>
- <div class="info"></div>
- <input style="display:block;" type="text"></input>
- </div></td>
- </tr>
- </table>
- </div>
- <div>
- <h4 style="display:inline">Code explanation:</h4><input onclick="$(this).attr('checked')? $('#code').show():$('#code').hide();" style="display:inline;margin-left:15px;" type="checkbox"><i style="font-size:80%;">toggle</i></input>
- <span id="code" style="display:none;">
- <p>Load the Semantic Interaction Framework:
- <pre>&lt;script type="text/javascript" src=".../jquery.sif-0.1.min.js"&gt;&lt;/script&gt;</pre>
- </p>
- <p>Customize the Semantic Interaction Framework:
- <pre>
-&lt;!-- SIF - connectors --&gt;
-&lt;script type="text/javascript" src=".../connectors/stanbol.js"&gt;&lt;/script&gt;
-&lt;script type="text/javascript" src=".../connectors/browser.js"&gt;&lt;/script&gt;
-&lt;script type="text/javascript" src=".../connectors/rdfa.js"&gt;&lt;/script&gt;
-
-&lt;!-- SIF - Domain specific Functionality --&gt;
-&lt;script type="text/javascript" src=".../src/dsf/analyze.js"&gt;&lt;/script&gt;
-&lt;script type="text/javascript" src=".../src/dsf/places.js"&gt;&lt;/script&gt;
-&lt;script type="text/javascript" src=".../src/dsf/persons.js"&gt;&lt;/script&gt;
-
-&lt;!-- SIF - Configurations --&gt;
-&lt;script type="text/javascript"&gt;
- SIF.Connectors.stanbol.options.stanbol_url =
- "http://stanbol.iksfordrupal.net:9000/engines/";
-&lt;/script&gt;
- </pre>
- </p>
- <p>Semantify the object:
- <pre>
-$(function() {
- //semantify the abstract object
- $('#summary').sif().analyze(); //triggers 'contextChanged' on $('#summary')
-});</pre>
- </p>
- <p>Query for found persons:
- <pre>$('#summary').sif().persons();</pre>
- </p>
- <p>Query for found places:
- <pre>$('#summary').sif().places();</pre>
- </p>
- </span>
- </div>
- </div>
- <div style="display:none;" smart="true" id="faked_data">
+ <div style="display:none;">
<span typeof="v:Organization" about="#dfki">
<span property="v:name">DFKI GmbH</span>
<span property="v:url">http://www.dfki.de</span>
+ <span property="v:latitude">49.23485</span>
+ <span property="v:longitude">6.994402</span>
</span>
<span typeof="v:Organization" about="#gentics">
<span property="v:name">GENTICS</span>
<span property="v:url">http://www.gentics.com</span>
+ <span property="v:latitude">48.208174</span>
+ <span property="v:longitude">16.373819</span>
</span>
<span typeof="v:Organization" about="#jqueryui">
<span property="v:name">jQUery UI</span>
<span property="v:url">http://www.jqueryui.com</span>
+ <span property="v:latitude">-19.777765</span>
+ <span property="v:longitude">-43.937217</span>
</span>
<span typeof="v:Person" about="#sebastian-germesin">
<span property="v:name">Sebastian Germesin</span>
@@ -248,5 +197,63 @@ <h4 style="display:inline">Code explanation:</h4><input onclick="$(this).attr('c
<span property="v:role" content="???"></span>
</span>
</div>
+ </div>
+ <hr/>
+ <hr/>
+ <table>
+ <tr>
+ <td style="width:300px;vertical-align:top;"><div id="companies">
+ <h3>Tags - Companies</h3>
+ <button onclick="presentEntitiesAsTags($('[smart]').sif().companies(), $('#companies'));$(this).attr('disabled', 'disabled');">Retrieve all companies</button>
+ </div></td>
+ <td style="width:300px;vertical-align:top;"><div id="persons">
+ <h3>Tags - Persons</h3>
+ <button onclick="presentEntitiesAsTags($('#test').sif().persons(), $('#persons'));$(this).attr('disabled', 'disabled');">Retrieve all persons</button>
+ <div class="info"></div>
+ </div></td>
+ </tr>
+ </table>
+ </div>
+ <div>
+ <h4 style="display:inline">Code explanation:</h4><input onclick="$(this).attr('checked')? $('#code').show():$('#code').hide();" style="display:inline;margin-left:15px;" type="checkbox"><i style="font-size:80%;">toggle</i></input>
+ <span id="code" style="display:none;">
+ <p>Load the Semantic Interaction Framework:
+ <pre>&lt;script type="text/javascript" src=".../jquery.sif-0.1.min.js"&gt;&lt;/script&gt;</pre>
+ </p>
+ <p>Customize the Semantic Interaction Framework:
+ <pre>
+&lt;!-- SIF - connectors --&gt;
+&lt;script type="text/javascript" src=".../connectors/stanbol.js"&gt;&lt;/script&gt;
+&lt;script type="text/javascript" src=".../connectors/browser.js"&gt;&lt;/script&gt;
+&lt;script type="text/javascript" src=".../connectors/rdfa.js"&gt;&lt;/script&gt;
+
+&lt;!-- SIF - Domain specific Functionality --&gt;
+&lt;script type="text/javascript" src=".../src/dsf/analyze.js"&gt;&lt;/script&gt;
+&lt;script type="text/javascript" src=".../src/dsf/places.js"&gt;&lt;/script&gt;
+&lt;script type="text/javascript" src=".../src/dsf/persons.js"&gt;&lt;/script&gt;
+
+&lt;!-- SIF - Configurations --&gt;
+&lt;script type="text/javascript"&gt;
+ SIF.Connectors.stanbol.options.stanbol_url =
+ "http://stanbol.iksfordrupal.net:9000/engines/";
+&lt;/script&gt;
+ </pre>
+ </p>
+ <p>Semantify the object:
+ <pre>
+$(function() {
+ //semantify the abstract object
+ $('#summary').sif().analyze(); //triggers 'contextChanged' on $('#summary')
+});</pre>
+ </p>
+ <p>Query for found persons:
+ <pre>$('#summary').sif().persons();</pre>
+ </p>
+ <p>Query for found places:
+ <pre>$('#summary').sif().places();</pre>
+ </p>
+ </span>
+ </div>
+ </div>
</body>
</html>
View
@@ -2,13 +2,12 @@
* Demo-specific methods.
*/
-function presentEntitiesAsTags (rdfs, inputField) {
+function presentEntitiesAsTags (rdfs, field) {
var foundEntities = [];
for (var i in rdfs) {
var rdf = rdfs[i];
for (var e = 0; e < rdf.matches.length; e++) {
var entity = rdf[e];
- debugger;
var name = entity.name;
var confidence = (entity.confidence) ? parseFloat((entity.confidence.toString()).replace(/"/g, "")) : 100.0;
foundEntities.push({
@@ -18,14 +17,8 @@ function presentEntitiesAsTags (rdfs, inputField) {
});
}
}
- inputField
- .autoSuggest({value: "", name: ""}, {
- selectedItemProp: "name",
- searchObjProps: "name",
- startText: "",
- showResultList: false,
- preFill: foundEntities,
- selectionRemoved: function(elem) {
- elem.fadeTo("fast", 0, function(){ elem.remove(); });
- }});
+ for (var x = 0; x < foundEntities.length; x++) {
+ var name = foundEntities[x].name;
+ field.append($("<div>").text(name.replace(/@en/, "")));
+ }
}
View
@@ -41,7 +41,7 @@ SIF.Connectors.rdfa.analyze = function (obj, success, error) {
}
}
-SIF.Connectors.rdfa.persons = function (rdf) {
+SIF.Connectors.rdfa.persons = function (rdf) {
var ret = rdf
.where('?subject <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdf.data-vocabulary.org/#Person>')
.where('?subject <http://rdf.data-vocabulary.org/#name> ?name')
@@ -57,9 +57,9 @@ SIF.Connectors.rdfa.companies = function (rdf) {
var ret = rdf
.where('?subject <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdf.data-vocabulary.org/#Organization>')
.where('?subject <http://rdf.data-vocabulary.org/#name> ?name')
- .optional('?subject <http://rdf.data-vocabulary.org/#firstname> ?firstname')
- .optional('?subject <http://rdf.data-vocabulary.org/#lastname> ?lastname')
- .optional('?subject <http://rdf.data-vocabulary.org/#mbox> ?mbox');
+ .optional('?subject <http://rdf.data-vocabulary.org/#url> ?url')
+ .optional('?subject <http://rdf.data-vocabulary.org/#latitude> ?latitude')
+ .optional('?subject <http://rdf.data-vocabulary.org/#longitude> ?longitude');
return ret;
}

0 comments on commit e19c3c9

Please sign in to comment.