Created
January 14, 2014 18:30
-
-
Save kendall/8423194 to your computer and use it in GitHub Desktop.
Stardog 2.2 graph analytics embedded in SPARQL queries
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # graph for shortest path with reasoning | |
| @prefix rule: <tag:stardog:api:rule:> . | |
| @prefix : <urn:test:> . | |
| @prefix g: <tag:stardog:api:property:graph:> . | |
| # the graph | |
| :one :to :two . | |
| :one :to :four . | |
| :two :to :four . | |
| :two :to :five . | |
| :three :to :one . | |
| :three :to :six . | |
| :four :to :three . | |
| :four :to :five . | |
| :four :to :six . | |
| :four :to :seven . | |
| :five :to :seven . | |
| :seven :to :six . | |
| :eight :to :nine . | |
| :nine :to :ten . | |
| :ten :to :eight . | |
| :five a :reasoner . | |
| # the rules | |
| [] a rule:SPARQLRule ; | |
| rule:content """ | |
| IF { | |
| ?node a :reasoner | |
| } | |
| THEN { | |
| ?node :to :nine | |
| } | |
| """. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select ?s ?score { | |
| (?s ?score) stardog:property:graph:pageRank (100 .80) | |
| } | |
| order by ?score | |
| limit 10 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| prefix uni: <http://www.Department0.University0.edu/> | |
| select ?index ?source ?predicate ?target { | |
| (?source ?predicate ?target ?index) stardog:property:graph:shortestPath (uni:UndergraduateStudent299 uni:Course0) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select distinct ?cluster ?subject { | |
| (?cluster ?subject) stardog:property:graph:strongComponents () | |
| } | |
| order by ?cluster |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # from StrongComponentsTest.java | |
| @prefix : <urn:test:> . | |
| @prefix g: <tag:stardog:api:property:graph:> . | |
| :one :to :two . | |
| :two :to :four . | |
| :three :to :two . | |
| :three :to :four . | |
| :three :to :six . | |
| :four :to :one . | |
| :five :to :four . | |
| :five :to :eight . | |
| :six :to :three . | |
| :six :to :five . | |
| :seven :to :six . | |
| :seven :to :seven . | |
| :seven :to :eight . | |
| :eight :to :five . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| select ?cluster (count(?cluster) as ?count) { | |
| (?cluster ?subject) stardog:property:graph:weakComponents () | |
| } | |
| group by ?cluster | |
| order by ?cluster |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment