├── .gitignore ├── spanner-loader ├── .gitignore ├── .settings │ ├── org.eclipse.m2e.core.prefs │ ├── org.eclipse.core.resources.prefs │ └── org.eclipse.jdt.core.prefs └── .project ├── bigquery-loader ├── .gitignore ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.jdt.core.prefs ├── src │ ├── test │ │ └── java │ │ │ └── com │ │ │ └── ibm │ │ │ └── rdf │ │ │ └── store │ │ │ └── sparql11 │ │ │ ├── BigQueryKnoesisTests.java │ │ │ └── BigQueryEngine.java │ └── main │ │ └── java │ │ └── com │ │ └── ibm │ │ └── research │ │ └── quetzal │ │ └── loader │ │ └── lubmSchema.json ├── .project └── .classpath ├── com.ibm.research.quetzal.core ├── scripts │ ├── configDB.cmds │ ├── .cvsignore │ ├── makeKeywordsCaseInsensitive.awk │ ├── fix-dbpedia-quotes.sh │ ├── addLineLengths.awk │ ├── run-load.sh │ ├── prettifyNTriples.awk │ ├── replaceWithPrefixes.awk │ ├── check_sets.sh │ ├── rc2-db-cfg.sh │ ├── sample-db-cfg.sh │ ├── slssd-dbp-cfg.sh~ │ ├── slssd-sp2b-cfg.sh~ │ ├── stacm3-tms-db-cfg.sh │ ├── stacm3-xiv-db-cfg.sh │ ├── helix1-fb-cfg.sh │ ├── helix1-lubm-cfg.sh~ │ ├── sl-db-cfg.sh │ ├── sl-lubm-cfg.sh │ ├── slssd-lubm-pg-cfg.sh~ │ ├── helix1-bsbm-cfg.sh │ ├── helix1-bsbm-cfg.sh~ │ ├── helix1-fb-cfg.sh~ │ ├── helix1-lubm-cfg.sh │ ├── helix1-sp2b-cfg.sh │ ├── helix1-sp2b-cfg.sh~ │ ├── slssd-lubm-cfg.sh~ │ ├── sl-rational-cfg.sh │ ├── slssd-lubm-cfg.sh │ ├── slssd-sp2b-cfg.sh │ ├── pasta-dev-cfg.sh │ ├── slssd-dbp-cfg.sh │ ├── slssd-dbp-pg-cfg.sh │ ├── slssd-sp2b-pg-cfg.sh │ ├── slssd-lubm-pg-cfg.sh │ ├── hackCols.awk │ ├── min-1-cfg.sh │ ├── quadsToTriples.awk │ ├── pawk.awk │ ├── skolemize.awk │ ├── run-query.sh │ ├── run-dir.sh │ ├── hiveDeleteKB.sh │ ├── hack-literals-for-db2.awk │ ├── check_find_object.awk │ ├── fix-escapes-for-ntriples.sh │ ├── run-test.sh │ ├── rdfload.sh │ ├── buildGraphWithInts.awk │ ├── SparqlGrammarFix.awk │ ├── check-parse.awk │ ├── rdfload.bat │ ├── testLongStringsSubstitution.awk │ ├── processQUT.awk │ ├── extractPrefixes.awk │ ├── long-strings.awk │ ├── test.sh │ ├── fix-escapes-for-ntriples.awk │ ├── replaceWithPrefixes.sh │ ├── check-mapping.sh │ ├── loadFileToNTriples.sh │ ├── check_line.sh │ ├── pawk.sh │ ├── triple-pawk.sh │ ├── stringLengthDistribution.sh │ ├── randomSample.sh │ ├── flatten_predicate.sh │ ├── strings.awk │ ├── scriptjar.jardesc │ └── paths.awk ├── sql │ ├── pssqlSHAFunctions │ ├── psqlIsNumericFunction │ ├── rdfDBSetup │ │ └── dbsetup.sql │ ├── SQL_stat_queries │ │ └── run_stats │ ├── psqlDatatypeFunction.sql │ ├── db2typeof.sql │ ├── psql2typeof.sql │ ├── readtext.sql │ └── psqlIsCastableFunction ├── .pgpass ├── test │ ├── ARQStatus │ ├── com │ │ └── ibm │ │ │ └── rdf │ │ │ └── store │ │ │ ├── tests │ │ │ ├── prune.awk │ │ │ └── counts.awk │ │ │ ├── testing │ │ │ └── RandomizedRepeat.java │ │ │ ├── testSuite │ │ │ ├── TestSuiteHelix2.java │ │ │ ├── TestSuiteSP2B.java │ │ │ ├── TestSuiteJazz.java │ │ │ └── TestSuiteLUBM.java │ │ │ └── sparql11 │ │ │ ├── DB2JazzNewTest.java │ │ │ └── TestSuiteUOBMALLQueries.java │ ├── queries │ │ └── knoesis │ │ │ ├── q2.sparql │ │ │ ├── q1.sparql │ │ │ └── q3.sparql │ ├── lubm │ │ ├── q14.sparql │ │ ├── q6.sparql │ │ ├── q1.sparql │ │ ├── q11.sparql │ │ ├── q3.sparql │ │ ├── q10.sparql │ │ ├── q12.sparql │ │ ├── q4.sparql │ │ ├── q2.sparql │ │ └── q7.sparql │ ├── sparqlRExt │ │ ├── r1.rq │ │ ├── r2.rq │ │ └── q1.sparql │ └── sparqlExtension │ │ ├── q7GET.sparql │ │ ├── q10GET.sparql │ │ ├── q1GET.sparql │ │ ├── q15GET.sparql │ │ ├── q11GET-reduced.sparql │ │ ├── q10GET-reduced.sparql │ │ ├── q11GET.sparql │ │ ├── q5GET.sparql │ │ ├── q14GET.sparql │ │ ├── q2GET.sparql │ │ ├── q3GET.sparql │ │ ├── q12GET-reduced.sparql │ │ ├── q12GET.sparql │ │ ├── q9GET2.sparql │ │ ├── q9GET.sparql │ │ ├── q8aGET.sparql │ │ └── q6GET.sparql ├── .cvsignore ├── docker │ ├── queries │ │ ├── q1.sparql │ │ ├── q2.sparql │ │ └── q3.sparql │ ├── spark │ │ ├── files │ │ │ ├── start.sh │ │ │ ├── beeline.sh │ │ │ ├── hive-site.xml │ │ │ └── init.sh │ │ ├── run-dir.sh │ │ ├── sparkEnvt.sh │ │ └── runLoadSpark.sh │ ├── db2 │ │ ├── run-dir.sh │ │ ├── db2Envt.sh │ │ ├── createDockerImage.sh │ │ ├── Dockerfile │ │ └── runLoadDB2.sh │ ├── postgresql │ │ ├── run-dir.sh │ │ ├── postgresEnvt.sh │ │ ├── Dockerfile~ │ │ ├── runLoadPostgres.sh │ │ ├── Dockerfile │ │ └── runLoadPostgres.sh~ │ ├── dockerEnvt.sh │ └── test.nt ├── .gitignore ├── mvnLibs │ └── research │ │ ├── iodt.sor │ │ └── 1.0 │ │ │ ├── iodt.sor-1.0.jar.sha1 │ │ │ ├── iodt.sor-1.0.pom.sha1 │ │ │ ├── iodt.sor-1.0.jar │ │ │ ├── _remote.repositories │ │ │ └── iodt.sor-1.0.pom │ │ ├── hashmvn │ │ └── hashmvn │ │ │ ├── 1.0 │ │ │ ├── hashmvn-1.0.jar.sha1 │ │ │ ├── hashmvn-1.0.pom.sha1 │ │ │ ├── hashmvn-1.0.jar │ │ │ ├── _maven.repositories │ │ │ └── hashmvn-1.0.pom │ │ │ └── 1.1 │ │ │ ├── hashmvn-1.1.jar.sha1 │ │ │ ├── hashmvn-1.1.pom.sha1 │ │ │ ├── hashmvn-1.1.jar │ │ │ ├── _maven.repositories │ │ │ └── hashmvn-1.1.pom │ │ ├── helixhashes │ │ └── 1.0 │ │ │ └── _maven.repositories │ │ └── helixmvn2 │ │ └── helixcore │ │ └── 1.0 │ │ ├── _maven.repositories │ │ ├── helixcore-1.0.jar.lastUpdated │ │ └── helixcore-1.0.pom.lastUpdated ├── issues │ └── IssueTracker.xls ├── run_result_matching_with_kepler.txt ├── .settings │ ├── org.eclipse.m2e.core.prefs │ └── org.eclipse.jdt.core.prefs ├── suspicious_queries ├── src │ └── com │ │ └── ibm │ │ └── research │ │ ├── owlql │ │ ├── ruleref │ │ │ ├── CreatableTable.java │ │ │ ├── Table.java │ │ │ ├── DatatypeFactory.java │ │ │ └── IRDFStoreDBSchemaProcessor.java │ │ ├── rule │ │ │ └── Adornment.java │ │ └── NewVariableGenerator.java │ │ ├── rdf │ │ └── store │ │ │ ├── sparql11 │ │ │ ├── model │ │ │ │ ├── Service.java │ │ │ │ ├── EExpressionResultType.java │ │ │ │ ├── BlankNodeVariable.java │ │ │ │ ├── Visitor.java │ │ │ │ ├── ExpressionVisitor.java │ │ │ │ ├── PathMapper.java │ │ │ │ ├── PathVisitor.java │ │ │ │ ├── IExpressionTraversalListener.java │ │ │ │ ├── InvPath.java │ │ │ │ ├── SeqPath.java │ │ │ │ ├── ZeroOrOnePath.java │ │ │ │ ├── AltPath.java │ │ │ │ ├── ZeroOrMorePath.java │ │ │ │ └── OneOrMorePath.java │ │ │ ├── sqlwriter │ │ │ │ └── SQLWriterException.java │ │ │ ├── planner │ │ │ │ └── PlanNodeType.java │ │ │ ├── XTree.java │ │ │ ├── sqltemplate │ │ │ │ └── SQLMapping.java │ │ │ └── DumpQuery.java │ │ │ ├── runtime │ │ │ └── service │ │ │ │ ├── sql │ │ │ │ ├── Shark.datatypes │ │ │ │ ├── DB2.datatypes │ │ │ │ ├── BigQueryRdfStoreSqls │ │ │ │ ├── BigQuery.datatypes │ │ │ │ ├── Postgresql.datatypes │ │ │ │ ├── SingleRowResultSetProcessor.java │ │ │ │ └── SQLExceptionWrapper.java │ │ │ │ └── types │ │ │ │ └── LangMap.java │ │ │ ├── utilities │ │ │ ├── io │ │ │ │ └── SparqlSelectResult.java │ │ │ └── NamespaceResolver.java │ │ │ ├── query │ │ │ ├── SQLLogicNodeType.java │ │ │ ├── EQueryType.java │ │ │ ├── Query.java │ │ │ └── QueryProcessor.java │ │ │ ├── hashing │ │ │ ├── IHashingFunction.java │ │ │ ├── HashingException.java │ │ │ ├── GetPredicates.java │ │ │ └── IHashingFamily.java │ │ │ └── jena │ │ │ ├── RdfStoreException.java │ │ │ └── impl │ │ │ └── DB2QuerySolutionImpl.java │ │ ├── sparql │ │ └── rewriter │ │ │ ├── SubstitutionForJena.java │ │ │ ├── Substitution.java │ │ │ ├── NeutralSubstitutionForJena.java │ │ │ └── SubstitutionApplierForJena.java │ │ └── proppaths │ │ ├── SQLCommand.java │ │ ├── InsertCopyOfATableIntoTable.java │ │ ├── DeleteTable.java │ │ ├── MultipleCTEDefintion.java │ │ ├── DropTableCommand.java │ │ ├── OpenCursor.java │ │ ├── PROCQ6 │ │ ├── genproc0 │ │ ├── CloseCursor.java │ │ ├── DropStoreProcedure.java │ │ ├── NewVariableGenerator.java │ │ ├── PROCQ7 │ │ ├── genproc2() │ │ ├── InsertIntoTable.java │ │ ├── PrepareStatementCommand.java │ │ ├── db2graph.all.sh │ │ ├── CTEDefinition.java │ │ ├── StoreProcedureDeclaration.java │ │ └── DeclareTempTableCommand.java ├── Vagrantfile ├── bulk_load.sh ├── .project ├── launches │ ├── DataLoader-test.launch │ ├── ColoringFunction - uniprot.launch │ ├── TDBTestUOBM1.launch │ ├── ScriptsOnlyUtility.launch │ ├── SingleGraphLoader-test.launch │ ├── TDBTestDBpedia37_RC2.launch │ ├── TDBTestSP2B100M_R_RC2.launch │ ├── TDBTestJazzOptimizedStore.launch │ ├── Reversed100M_WithOWLQLCompilation.launch │ ├── DataLoaderTest.launch │ ├── StatisticsLoader.launch │ ├── RRCQueryFileParser.launch │ └── DebugDataLoader.launch ├── build-grammar.xml └── build.xml ├── DrugPairGOSimilarity ├── NAMESPACE ├── DESCRIPTION~ ├── DrugPairGOSimilarity.Rproj ├── DESCRIPTION └── man │ └── DrugPairGOSimilarity-package.Rd ├── rdfstore-checker ├── .gitignore ├── .project ├── .settings │ ├── org.eclipse.jdt.core.prefs │ └── org.eclipse.jdt.core.prefs,v ├── source │ └── com │ │ └── ibm │ │ └── research │ │ └── rdf │ │ └── store │ │ └── sparql11 │ │ └── semantics │ │ ├── UniverseFactory.java │ │ ├── ComparisonUniverse.java │ │ └── OpenDatasetUniverse.java ├── .classpath └── launchers │ └── Drivers$DumpUniverse.launch ├── doc ├── QuetzalPlanner.key └── QuetzalPlanner.pdf ├── .travis.yml └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | -------------------------------------------------------------------------------- /spanner-loader/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /bigquery-loader/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/configDB.cmds: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/.cvsignore: -------------------------------------------------------------------------------- 1 | cmd.txt 2 | -------------------------------------------------------------------------------- /DrugPairGOSimilarity/NAMESPACE: -------------------------------------------------------------------------------- 1 | exportPattern("^[[:alpha:]]+") 2 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/makeKeywordsCaseInsensitive.awk: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /rdfstore-checker/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /target/ 3 | /jni/ 4 | /lib/ 5 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/sql/pssqlSHAFunctions: -------------------------------------------------------------------------------- 1 | CREATE EXTENSION pgcrypto; -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/.pgpass: -------------------------------------------------------------------------------- 1 | localhost:5432:quetzal:quetzal:quetzalcoatl -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/ARQStatus: -------------------------------------------------------------------------------- 1 | 10/31/2011 2:50 am GMT - 187 tests passing -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/.cvsignore: -------------------------------------------------------------------------------- 1 | schema_files 2 | src-gen 3 | install 4 | bin1 5 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/queries/q1.sparql: -------------------------------------------------------------------------------- 1 | select count(*) { 2 | ?s ?p ?o . 3 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/queries/q2.sparql: -------------------------------------------------------------------------------- 1 | select ?S ?p ?o { 2 | ?S ?p ?o . 3 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/.gitignore: -------------------------------------------------------------------------------- 1 | /bin/ 2 | /target/ 3 | /lib/ 4 | /target 5 | /generated/ 6 | -------------------------------------------------------------------------------- /doc/QuetzalPlanner.key: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quetzal-RDF/quetzal/HEAD/doc/QuetzalPlanner.key -------------------------------------------------------------------------------- /doc/QuetzalPlanner.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quetzal-RDF/quetzal/HEAD/doc/QuetzalPlanner.pdf -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/fix-dbpedia-quotes.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sed 's/\" \.$/\"" ./' $1 4 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/iodt.sor/1.0/iodt.sor-1.0.jar.sha1: -------------------------------------------------------------------------------- 1 | f2c9fedc6e985d2a8a14ffda65e94086401221f7 -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/iodt.sor/1.0/iodt.sor-1.0.pom.sha1: -------------------------------------------------------------------------------- 1 | 444b00e18fe20df0e29b5bbf219d4a963397d21c -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/com/ibm/rdf/store/tests/prune.awk: -------------------------------------------------------------------------------- 1 | split($0, garbage, /\|/) < limit { print $0; } 2 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/queries/q3.sparql: -------------------------------------------------------------------------------- 1 | select * { 2 | ?p ?o . 3 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.0/hashmvn-1.0.jar.sha1: -------------------------------------------------------------------------------- 1 | 6d9456f7305f3be9b332d88baffc44c6a608c3e9 -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.0/hashmvn-1.0.pom.sha1: -------------------------------------------------------------------------------- 1 | df077a05b339921147c8ee7a5fa5a54515cce0f5 -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.1/hashmvn-1.1.jar.sha1: -------------------------------------------------------------------------------- 1 | c579ccca154ddd8944731c435fec84035eee3eca -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.1/hashmvn-1.1.pom.sha1: -------------------------------------------------------------------------------- 1 | 195d00cd6c78fb042482aa3ea55c87056f69b034 -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/addLineLengths.awk: -------------------------------------------------------------------------------- 1 | { 2 | elts = split($0, garbage, /\|/); 3 | print elts, $0; 4 | } 5 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/spark/files/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./init.sh 4 | 5 | /usr/bin/tail -f /dev/null 6 | 7 | 8 | -------------------------------------------------------------------------------- /spanner-loader/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /bigquery-loader/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/issues/IssueTracker.xls: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quetzal-RDF/quetzal/HEAD/com.ibm.research.quetzal.core/issues/IssueTracker.xls -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/run_result_matching_with_kepler.txt: -------------------------------------------------------------------------------- 1 | FAILED--------- QUERY 46 *********Expected No of Rows = 1 ********* Actual No of Rows = 0 2 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/run-load.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | DIR=`dirname $0` 3 | 4 | $DIR/build-load-files.sh "$@" 5 | $DIR/load-load-files.sh "$@" 6 | 7 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/.settings/org.eclipse.m2e.core.prefs: -------------------------------------------------------------------------------- 1 | activeProfiles= 2 | eclipse.preferences.version=1 3 | resolveWorkspaceProjects=true 4 | version=1 5 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/db2/run-dir.sh: -------------------------------------------------------------------------------- 1 | DIR=`dirname $0` 2 | . $DIR/../dockerEnvt.sh 3 | . $DIR/db2Envt.sh 4 | cd $DIR/../../scripts 5 | bash ./run-dir.sh $1 6 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/spark/run-dir.sh: -------------------------------------------------------------------------------- 1 | DIR=`dirname $0` 2 | . $DIR/../dockerEnvt.sh 3 | . $DIR/sparkEnvt.sh 4 | cd $DIR/../../scripts 5 | bash ./run-dir.sh $1 -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/postgresql/run-dir.sh: -------------------------------------------------------------------------------- 1 | DIR=`dirname $0` 2 | . $DIR/../dockerEnvt.sh 3 | . $DIR/postgresEnvt.sh 4 | cd $DIR/../../scripts 5 | bash ./run-dir.sh $1 6 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/db2/db2Envt.sh: -------------------------------------------------------------------------------- 1 | export DB2_PORT=50000 2 | export DB2_USER=db2inst1 3 | export DB2_PASSWORD=db2inst1 4 | export DB2_SCHEMA=db2inst1 5 | export DB_ENGINE=db2 -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/spark/files/beeline.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./init.sh 4 | 5 | su $USER -c "rlwrap $HIVE_HOME/bin/beeline --showHeader=true -u jdbc:hive2://localhost:10000" 6 | 7 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/queries/knoesis/q2.sparql: -------------------------------------------------------------------------------- 1 | prefix obs: 2 | 3 | select ?s ?o 4 | { 5 | ?s obs:parameter ?o . 6 | } 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/iodt.sor/1.0/iodt.sor-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quetzal-RDF/quetzal/HEAD/com.ibm.research.quetzal.core/mvnLibs/research/iodt.sor/1.0/iodt.sor-1.0.jar -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/prettifyNTriples.awk: -------------------------------------------------------------------------------- 1 | { 2 | printf("%s||%s||", $1, $2); 3 | 4 | for (i=3; i < NF; i++) { 5 | printf("%s ", $i); 6 | } 7 | printf("%s\n", ""); 8 | } 9 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/replaceWithPrefixes.awk: -------------------------------------------------------------------------------- 1 | { 2 | if (NR == 1) { 3 | print "sed s@" $2 "@" NR ":@g $1\\"; 4 | } else { 5 | print "| sed s@" $2 "@" NR ":@g\\"; 6 | } 7 | 8 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/lubm/q14.sparql: -------------------------------------------------------------------------------- 1 | SELECT ?x WHERE { 2 | ?x 3 | } 4 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.0/hashmvn-1.0.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quetzal-RDF/quetzal/HEAD/com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.0/hashmvn-1.0.jar -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.1/hashmvn-1.1.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Quetzal-RDF/quetzal/HEAD/com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.1/hashmvn-1.1.jar -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/check_sets.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SETS=$1 4 | DATA=$2 5 | ENTITY=$3 6 | 7 | (while read line; do 8 | sh ~/check_line.sh "$line" $DATA $ENTITY 9 | done) < $SETS 10 | 11 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/rc2-db-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=uobm 2 | export DB2_HOST=9.47.202.45 3 | export DB2_PORT=50001 4 | export DB2_USER=db2inst2 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst2 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/sample-db-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=LUBM100K 2 | export DB2_HOST=localhost 3 | export DB2_PORT=50001 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2inst1 6 | export DB2_SCHEMA=db2inst1 7 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/slssd-dbp-cfg.sh~: -------------------------------------------------------------------------------- 1 | export DB2_DB=sp2b 2 | export DB2_HOST=localhost 3 | export DB2_PORT=50002 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/slssd-sp2b-cfg.sh~: -------------------------------------------------------------------------------- 1 | export DB2_DB=lubm 2 | export DB2_HOST=localhost 3 | export DB2_PORT=50002 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/stacm3-tms-db-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=tmsdb 2 | export DB2_HOST=stacm3 3 | export DB2_PORT=50000 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=ihaterc2 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/stacm3-xiv-db-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=xivdb 2 | export DB2_HOST=stacm3 3 | export DB2_PORT=50000 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=ihaterc2 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/helix1-fb-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=fb 2 | export DB2_HOST=helix1.pok.ibm.com 3 | export DB2_PORT=50001 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/helix1-lubm-cfg.sh~: -------------------------------------------------------------------------------- 1 | export DB2_DB=uobm 2 | export DB2_HOST=9.47.202.45 3 | export DB2_PORT=50001 4 | export DB2_USER=db2inst2 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst2 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/sl-db-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=DAWG 2 | export DB2_HOST=10.80.29.218 3 | export DB2_PORT=50000 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | 9 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/sl-lubm-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=LUBM 2 | export DB2_HOST=10.80.29.218 3 | export DB2_PORT=50000 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | 9 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/slssd-lubm-pg-cfg.sh~: -------------------------------------------------------------------------------- 1 | export DB2_DB=lubm 2 | export DB2_HOST=localhost 3 | export DB2_PORT=50002 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/helix1-bsbm-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=bsbm 2 | export DB2_HOST=helix1.pok.ibm.com 3 | export DB2_PORT=50001 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/helix1-bsbm-cfg.sh~: -------------------------------------------------------------------------------- 1 | export DB2_DB=lubm 2 | export DB2_HOST=helix1.pok.ibm.com 3 | export DB2_PORT=50001 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/helix1-fb-cfg.sh~: -------------------------------------------------------------------------------- 1 | export DB2_DB=sp2b 2 | export DB2_HOST=helix1.pok.ibm.com 3 | export DB2_PORT=50001 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/helix1-lubm-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=lubm 2 | export DB2_HOST=helix1.pok.ibm.com 3 | export DB2_PORT=50001 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/helix1-sp2b-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=sp2b 2 | export DB2_HOST=helix1.pok.ibm.com 3 | export DB2_PORT=50001 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/helix1-sp2b-cfg.sh~: -------------------------------------------------------------------------------- 1 | export DB2_DB=bsbm 2 | export DB2_HOST=helix1.pok.ibm.com 3 | export DB2_PORT=50001 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/slssd-lubm-cfg.sh~: -------------------------------------------------------------------------------- 1 | export DB2_DB=lubm 2 | export DB2_HOST=helix1.pok.ibm.com 3 | export DB2_PORT=50001 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/sl-rational-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=Rational 2 | export DB2_HOST=10.80.29.218 3 | export DB2_PORT=50000 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | 8 | 9 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/postgresql/postgresEnvt.sh: -------------------------------------------------------------------------------- 1 | export DB2_PORT=5432 2 | export DB2_USER=quetzal 3 | export DB2_PASSWORD=quetzalcoatl 4 | export DB2_SCHEMA=quetzal 5 | export PGPASSFILE=$DIR/../../.pgpass 6 | export DB_ENGINE=postgresql -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/slssd-lubm-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=lubm 2 | export DB2_HOST=localhost 3 | export DB2_PORT=50002 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | export DB_ENGINE=db2 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/slssd-sp2b-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=sp2b 2 | export DB2_HOST=localhost 3 | export DB2_PORT=50002 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | export DB_ENGINE=db2 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/pasta-dev-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=testrev 2 | export DB2_HOST=pasta-dev.watson.ibm.com 3 | export DB2_PORT=50002 4 | export DB2_USER=db2inst4 5 | export DB2_PASSWORD=sheruser 6 | export DB2_SCHEMA=db2inst4 7 | 8 | 9 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/slssd-dbp-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=dbp 2 | export DB2_HOST=localhost 3 | export DB2_PORT=50002 4 | export DB2_USER=db2inst1 5 | export DB2_PASSWORD=db2admin 6 | export DB2_SCHEMA=db2inst1 7 | export DB_ENGINE=db2 8 | 9 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/slssd-dbp-pg-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=dbp 2 | export DB2_HOST=localhost 3 | export DB2_PORT=5432 4 | export DB2_USER=akement 5 | export DB2_PASSWORD=passw0rd 6 | export DB2_SCHEMA=db2inst1 7 | export DB_ENGINE=postgresql 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/slssd-sp2b-pg-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=sp2b 2 | export DB2_HOST=localhost 3 | export DB2_PORT=5432 4 | export DB2_USER=akement 5 | export DB2_PASSWORD=passw0rd 6 | export DB2_SCHEMA=db2inst1 7 | export DB_ENGINE=postgresql 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/slssd-lubm-pg-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=lubm 2 | export DB2_HOST=localhost 3 | export DB2_PORT=5432 4 | export DB2_USER=akement 5 | export DB2_PASSWORD=passw0rd 6 | export DB2_SCHEMA=db2inst1 7 | export DB_ENGINE=postgresql 8 | 9 | -------------------------------------------------------------------------------- /spanner-loader/.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding//src/main/java=UTF-8 3 | encoding//src/main/resources=UTF-8 4 | encoding//src/test/java=UTF-8 5 | encoding//src/test/resources=UTF-8 6 | encoding/=UTF-8 7 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/spark/sparkEnvt.sh: -------------------------------------------------------------------------------- 1 | # export _JAVA_OPTIONS="-XX:MaxPermSize=1G" 2 | export DB2_PORT=10000 3 | export DB2_DB=default 4 | export DB2_USER=root 5 | export DB2_PASSWORD=$PASSWD 6 | export DB2_SCHEMA=default 7 | export DB_ENGINE=shark 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/hackCols.awk: -------------------------------------------------------------------------------- 1 | { 2 | if ($2 == "") { 3 | split($3, arr, "\""); 4 | print $1, $2, "\"" arr[2]+1 "\"" "^^", $4, $5; 5 | } else { 6 | print $0; 7 | } 8 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/suspicious_queries: -------------------------------------------------------------------------------- 1 | 5, 24, 184, 268, 335,380, 392, 404, 416, 428, 440, 452, 463, 475, 485, 497, 507, 512, 519, 2 | 529, 541, 551, 563, 573, 578, 585, 595, 607, 617, 629, 639, 651, 661, 673, 683, 695, 705, 3 | 717, 727, 739, 1154, 1155 4 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/owlql/ruleref/CreatableTable.java: -------------------------------------------------------------------------------- 1 | package com.ibm.research.owlql.ruleref; 2 | 3 | public class CreatableTable { 4 | 5 | public CreatableTable() { 6 | // TODO Auto-generated constructor stub 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/lubm/q6.sparql: -------------------------------------------------------------------------------- 1 | prefix ub: 2 | select distinct * where { 3 | { ?x a ub:UndergraduateStudent . } 4 | union 5 | { ?x a ub:ResearchAssistant . } 6 | union 7 | { ?x a ub:GraduateStudent . } 8 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.0/_maven.repositories: -------------------------------------------------------------------------------- 1 | #NOTE: This is an internal implementation file, its format can be changed without prior notice. 2 | #Wed Jan 07 12:54:06 EST 2015 3 | hashmvn-1.0.jar>helix-maven-repo= 4 | hashmvn-1.0.pom>helix-maven-repo= 5 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.1/_maven.repositories: -------------------------------------------------------------------------------- 1 | #NOTE: This is an internal implementation file, its format can be changed without prior notice. 2 | #Sun Feb 08 14:29:37 EST 2015 3 | hashmvn-1.1.jar>helix-maven-repo= 4 | hashmvn-1.1.pom>helix-maven-repo= 5 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/min-1-cfg.sh: -------------------------------------------------------------------------------- 1 | export DB2_DB=default 2 | export DB2_HOST=tiresias-2.sl.cloud9.ibm.com 3 | export DB2_PORT=10000 4 | export DB2_USER=root 5 | export DB2_PASSWORD=enter password 6 | export DB2_SCHEMA=default 7 | export SPARK_HOME=/opt/spark-1.1.1-bin-hadoop2.4 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/lubm/q1.sparql: -------------------------------------------------------------------------------- 1 | prefix ub: 2 | select ?x 3 | where { ?x ub:GraduateStudent . ?x ub:takesCourse } 4 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/helixhashes/1.0/_maven.repositories: -------------------------------------------------------------------------------- 1 | #NOTE: This is an internal implementation file, its format can be changed without prior notice. 2 | #Tue Jan 06 09:31:16 EST 2015 3 | helixhashes-1.0.pom>helix-maven-repo= 4 | helixhashes-1.0.jar>helix-maven-repo= 5 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/iodt.sor/1.0/_remote.repositories: -------------------------------------------------------------------------------- 1 | #NOTE: This is an Aether internal implementation file, its format can be changed without prior notice. 2 | #Fri Apr 17 15:31:29 EDT 2015 3 | iodt.sor-1.0.pom>helix-maven-repo= 4 | iodt.sor-1.0.jar>helix-maven-repo= 5 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/helixmvn2/helixcore/1.0/_maven.repositories: -------------------------------------------------------------------------------- 1 | #NOTE: This is an internal implementation file, its format can be changed without prior notice. 2 | #Fri Feb 13 10:08:35 EST 2015 3 | helixcore-1.0.jar>helix-maven-repo= 4 | helixcore-1.0.pom>helix-maven-repo= 5 | -------------------------------------------------------------------------------- /bigquery-loader/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 3 | org.eclipse.jdt.core.compiler.compliance=1.8 4 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 5 | org.eclipse.jdt.core.compiler.source=1.8 6 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/sql/psqlIsNumericFunction: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION dawg.isNumeric(var text) RETURNS boolean AS $$ 2 | DECLARE y NUMERIC; 3 | 4 | BEGIN 5 | y := var::numeric; 6 | RETURN true; 7 | EXCEPTION WHEN others THEN 8 | RETURN false; 9 | END; 10 | $$ LANGUAGE plpgsql IMMUTABLE; -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: oraclejdk8 3 | install: 4 | - pushd com.ibm.research.quetzal.core 5 | - ant 6 | - popd 7 | - pushd rdfstore-checker 8 | - ant 9 | - popd 10 | script: 11 | - mvn clean install -B -q -DskipTests 12 | sudo: false 13 | cache: 14 | directories: 15 | - $HOME/.m2 16 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/lubm/q11.sparql: -------------------------------------------------------------------------------- 1 | SELECT ?x WHERE { 2 | ?x . 3 | ?x 4 | } 5 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/Service.java: -------------------------------------------------------------------------------- 1 | package com.ibm.research.rdf.store.sparql11.model; 2 | 3 | public interface Service { 4 | public QueryTripleTerm getService(); 5 | public EServiceType getServiceType(); 6 | } 7 | 8 | enum EServiceType { 9 | POST, GET 10 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/quadsToTriples.awk: -------------------------------------------------------------------------------- 1 | { 2 | parse_for_elements($0, elts); 3 | if (pawk == "yes") { 4 | print elts["subject"] " " elts["predicate"] " " elts["object"] " ." > fileName "." part; 5 | } else { 6 | print elts["subject"] " " elts["predicate"] " " elts["object"] " ." 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/db2/createDockerImage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | git clone https://github.com/ksrinivs64/db2-docker.git 4 | 5 | cp $1 db2-docker/ 6 | 7 | cd db2-docker 8 | 9 | sudo ./build.sh $1 server 1.0 10 | 11 | cd .. 12 | 13 | sudo docker build --rm -t "ibmresearch/quetzal-db2" . 14 | 15 | 16 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/lubm/q3.sparql: -------------------------------------------------------------------------------- 1 | SELECT ?x WHERE { 2 | ?x . 3 | ?x 4 | } 5 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlRExt/r1.rq: -------------------------------------------------------------------------------- 1 | prefix fn: 2 | 3 | function fn:foo (?a ?b -> ?a ?c ) language R { 4 | \SOP 5 | `__input`["l"] = stri_length(`__input`[["y"]]); `__input` 6 | \EOP 7 | } 8 | 9 | select distinct * where { 10 | ?x a ?y . 11 | BIND( fn:foo(?x ?y) AS ( ?y ?l ) ) 12 | } 13 | 14 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q7GET.sparql: -------------------------------------------------------------------------------- 1 | 2 | SELECT distinct ?patient WHERE { 3 | SERVICE { 4 | ?patient a ; 5 | "000B276045F0EC49E43F4C5AA80DC9BA" 6 | } 7 | } -------------------------------------------------------------------------------- /DrugPairGOSimilarity/DESCRIPTION~: -------------------------------------------------------------------------------- 1 | Package: DrugPairGOSimilarity 2 | Type: Package 3 | Title: What the package does (short line) 4 | Version: 1.0 5 | Date: 2016-03-02 6 | Author: Who wrote it 7 | Maintainer: Who to complain to 8 | Description: More about what it does (maybe more than one line) 9 | License: What license is it under? 10 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/com/ibm/rdf/store/tests/counts.awk: -------------------------------------------------------------------------------- 1 | { 2 | count=$1; 3 | total += count; 4 | elts = split($0, garbage, /\|/); 5 | 6 | for(i = 1; i <= elts; i++) { 7 | cumCounts[i] += count; 8 | } 9 | } 10 | 11 | END { 12 | for(i in cumCounts) { 13 | print i, cumCounts[i], cumCounts[i]/total; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/Vagrantfile: -------------------------------------------------------------------------------- 1 | VAGRANTFILE_API_VERSION = "2" 2 | 3 | Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 4 | config.vm.provider :virtualbox do |vbox, override| 5 | override.vm.box = "box-cutter/ubuntu1404-docker" 6 | #override.vm.network :private_network, ip: "192.168.50.10" 7 | vbox.customize ["modifyvm", :id, "--memory", 512] 8 | end 9 | end -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/pawk.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | total = 0; 3 | nl=length("\n"); 4 | } 5 | 6 | { 7 | total += (length($0) + nl); 8 | 9 | if (FNR==1 && (last != "yes")) { 10 | next; 11 | } 12 | 13 | if (next_is_last == 1) { 14 | exit(0); 15 | } 16 | 17 | if (total > chunk) { 18 | next_is_last = 1; 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/queries/knoesis/q1.sparql: -------------------------------------------------------------------------------- 1 | prefix geo: 2 | prefix obs: 3 | 4 | select ?s ?lat ?long 5 | { 6 | ?p geo:lat ?lat . 7 | ?p geo:long ?long . 8 | ?p a geo:Point . 9 | ?s a obs:System . 10 | ?s obs:processLocation ?p . 11 | } 12 | 13 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q10GET.sparql: -------------------------------------------------------------------------------- 1 | SELECT * WHERE { 2 | SERVICE { 3 | SELECT ?date (AVG(?value) AS ?avgval) WHERE { 4 | ?x ?date; 5 | ?value 6 | } GROUP BY ?date 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/skolemize.awk: -------------------------------------------------------------------------------- 1 | function skolemize(str, value) { 2 | if (match(str, /^_:/) > 0) { 3 | sub(/^_:/, ""; 5 | } else { 6 | value = str; 7 | } 8 | return value; 9 | } 10 | 11 | { 12 | for (i = 1; i <= NF; i++) { 13 | value = skolemize($i); 14 | printf("%s ", value); 15 | } 16 | printf("%s\n", ""); 17 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/queries/knoesis/q3.sparql: -------------------------------------------------------------------------------- 1 | prefix geo: 2 | prefix obs: 3 | 4 | select ?s ?lat ?long ?o 5 | { 6 | ?p geo:lat ?lat . 7 | ?p geo:long ?long . 8 | ?p a geo:Point . 9 | ?s a obs:System . 10 | ?s obs:processLocation ?p . 11 | ?s obs:parameter ?o . 12 | } 13 | 14 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/runtime/service/sql/Shark.datatypes: -------------------------------------------------------------------------------- 1 | FLOAT=FLOAT 2 | STRING=STRING 3 | DOUBLE=DOUBLE 4 | DECIMAL=DECIMAL 5 | DATETIME=TIMESTAMP 6 | INTEGER=INT 7 | DATE=DATE 8 | NUMERIC=FLOAT 9 | xs_dateTime=TIMESTAMP 10 | xs_integer=INT 11 | xs_date=date 12 | xs_decimal=decimal 13 | xs_float=float 14 | xs_double=double 15 | xs_boolean=boolean 16 | xs_string=string -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlRExt/r2.rq: -------------------------------------------------------------------------------- 1 | prefix fn: 2 | 3 | function fn:foo (?l ?age -> ?x ) language R { 4 | \SOP 5 | d <- as.numeric(`__input`$age); df <- data.frame(d - (mean(d))); colnames(df) <- c(\"x\"); df$index <- `__input`$index; df 6 | \EOP 7 | } 8 | 9 | select distinct * where { 10 | ?l ?age . 11 | BIND( fn:foo(?l ?age) AS ( ?x ) ) 12 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/run-query.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=`dirname $0` 4 | 5 | if [[ -z $KNOWLEDGE_BASE ]]; then 6 | export KNOWLEDGE_BASE=$1 7 | shift 8 | fi 9 | 10 | export QUERY=$1 11 | shift 12 | 13 | . $DIR/load-setup.sh 14 | if [[ -f $DB2_CONFIG ]]; then 15 | . $DB2_CONFIG 16 | fi 17 | 18 | java -Xmx2048M com.ibm.rdf.store.sparql11.QueryDriver "$QUERY" 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DrugPairGOSimilarity/DrugPairGOSimilarity.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | BuildType: Package 16 | PackageUseDevtools: Yes 17 | PackageInstallArgs: --no-multiarch --with-keep.source 18 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/run-dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=`dirname $0` 4 | 5 | if [[ -z $KNOWLEDGE_BASE ]]; then 6 | export KNOWLEDGE_BASE=$1 7 | shift 8 | fi 9 | 10 | export TEST_DIR=$1 11 | shift 12 | 13 | . $DIR/load-setup.sh 14 | if [[ -f $DB2_CONFIG ]]; then 15 | . $DB2_CONFIG 16 | fi 17 | 18 | java -Xmx2048M junit.textui.TestRunner com.ibm.rdf.store.sparql11.DirectoryDriver 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/hiveDeleteKB.sh: -------------------------------------------------------------------------------- 1 | # usage: host port database kb 2 | beeline -u jdbc:hive2://$1:$2/$3 << EOF 3 | drop table $4; 4 | drop table $4_basestats; 5 | drop table $4_direct_preds; 6 | drop table $4_dph; 7 | drop table $4_ds; 8 | drop table $4_dt; 9 | drop table $4_lstr; 10 | drop table $4_reverse_preds; 11 | drop table $4_rph; 12 | drop table $4_rs; 13 | drop table $4_topkstats; 14 | EOF -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/sql/rdfDBSetup/dbsetup.sql: -------------------------------------------------------------------------------- 1 | db2 UPDATE DATABASE CONFIGURATION USING LOGFILSIZ 20000 2 | db2 alter bufferpool IBMDEFAULTBP IMMEDIATE SIZE 15000 AUTOMATIC 3 | db2 UPDATE DATABASE MANAGER CONFIGURATION USING INTRA_PARALLEL YES 4 | db2 UPDATE DATABASE MANAGER CONFIGURATION USING INTRA_PARALLEL ANY 5 | db2 UPDATE DB CFG USING DFT_DEGREE ANY 6 | db2 UPDATE DB CONFIG USING AUTO_MAINT ON AUTO_TBL_MAINT ON AUTO_RUNSTATS ON 7 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/hack-literals-for-db2.awk: -------------------------------------------------------------------------------- 1 | { 2 | parse_for_elements($0, a); 3 | if (parseLiteral(a["object"], l) > 0) { 4 | newLit = gensub(/^[[:blank:]]+/, "", "g", gensub(/[[:blank:]]+$/, "", "g", getString(l))); 5 | print a["subject"] " " a["predicate"] " \"" newLit "\"" (getType(l) != ""? "^^<" getType(l) "> .": (getLanguage(l) != ""? "@" getLanguage(l) " .": " .")); 6 | } else { 7 | print $0; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/runtime/service/sql/DB2.datatypes: -------------------------------------------------------------------------------- 1 | FLOAT=FLOAT 2 | STRING=VARCHAR 3 | DOUBLE=DOUBLE 4 | DECIMAL=DECIMAL 5 | DATETIME=TIMESTAMP 6 | INTEGER=INTEGER 7 | DATE=DATE 8 | NUMERIC=DECFLOAT 9 | xs_dateTime=xs:dateTime 10 | xs_integer=xs:integer 11 | xs_date=xs:date 12 | xs_decimal=xs:decimal 13 | xs_float=xs:float 14 | xs_double=xs:double 15 | xs_boolean=xs:boolean 16 | xs_string=xs:string 17 | 18 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q1GET.sparql: -------------------------------------------------------------------------------- 1 | 2 | prefix fn: 3 | prefix x: 4 | prefix xs: 5 | 6 | function fn:getDrugBankNames GET ( -> ?x ) 7 | service fn:getDrugBankNames [ ] -> "//x:row" :: "./x:drug" "xs:string" 8 | 9 | select * where { 10 | 11 | BIND( fn:getDrugBankNames() AS ( ?drug ) ) 12 | 13 | filter ( ! contains(?drug, ">") ) 14 | 15 | } 16 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q15GET.sparql: -------------------------------------------------------------------------------- 1 | 2 | prefix fn: 3 | prefix x: 4 | prefix xs: 5 | 6 | function fn:getDrugBankNames GET ( -> ?x ) 7 | service fn:getDrugBankNames [ ] -> "//x:row" :: "./x:drug" "xs:string" 8 | 9 | select ?drug ?drug1 where { 10 | 11 | BIND( fn:getDrugBankNames() AS ( ?drug ) ) 12 | 13 | BIND( fn:getDrugBankNames() AS ( ?drug1 ) ) 14 | 15 | } 16 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/check_find_object.awk: -------------------------------------------------------------------------------- 1 | { 2 | parse_for_elements($0, elts); 3 | 4 | if (fileType == "quad") { 5 | found = elts["subject"] " " elts["predicate"] " " elts["object"] " " elts["graph"] " ."; 6 | } else { 7 | found = elts["subject"] " " elts["predicate"] " " elts["object"] " ."; 8 | } 9 | 10 | line = trimString($0); 11 | 12 | if (line != found) { 13 | print "bad line " $0 ": %%" line "%%" found "%%"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/owlql/ruleref/Table.java: -------------------------------------------------------------------------------- 1 | package com.ibm.research.owlql.ruleref; 2 | 3 | public class Table extends CreatableTable { 4 | 5 | public Table() { 6 | // TODO Auto-generated constructor stub 7 | } 8 | 9 | public Table(String string) { 10 | // TODO Auto-generated constructor stub 11 | } 12 | 13 | public void addColumn(String string, Object createInt, boolean b) { 14 | // TODO Auto-generated method stub 15 | 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q11GET-reduced.sparql: -------------------------------------------------------------------------------- 1 | SELECT * WHERE { 2 | SERVICE 3 | { 4 | SELECT ?date (COUNT(DISTINCT ?empi) AS ?opcnt) WHERE { 5 | ?x ?empi . 6 | ?x ?date ; 7 | "胸闷" 8 | } GROUP BY ?date 9 | } 10 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/owlql/ruleref/DatatypeFactory.java: -------------------------------------------------------------------------------- 1 | package com.ibm.research.owlql.ruleref; 2 | 3 | public class DatatypeFactory { 4 | 5 | public DatatypeFactory() { 6 | // TODO Auto-generated constructor stub 7 | } 8 | 9 | public static Object createInt() { 10 | // TODO Auto-generated method stub 11 | return null; 12 | } 13 | 14 | public static Object createBigInt() { 15 | // TODO Auto-generated method stub 16 | return null; 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/lubm/q10.sparql: -------------------------------------------------------------------------------- 1 | prefix ub: 2 | select * 3 | where 4 | { 5 | { ?x a ub:ResearchAssistant . ?x ub:takesCourse . } 6 | union 7 | { ?x a ub:UndergraduateStudent . ?x ub:takesCourse . } 8 | union 9 | { ?x a ub:GraduateStudent . ?x ub:takesCourse . } 10 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/fix-escapes-for-ntriples.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # 3 | # \ is used to specify escapes, but the set of valid escapes is limited, 4 | # so remove illegal \ characters from NTriples data by replacing them with 5 | # the escape sequence for \ itself, which is \\ 6 | # 7 | # see http://www.w3.org/TR/rdf-testcases/#ntriples, section 3.2 for a 8 | # precise specification of what escape sequences are allowed. 9 | # 10 | DIR=`dirname $0` 11 | gawk -f $DIR/fix-escapes-for-ntriples.awk $1 12 | 13 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/run-test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=`dirname $0` 4 | 5 | if [[ -z $KNOWLEDGE_BASE ]]; then 6 | export KNOWLEDGE_BASE=$1 7 | shift 8 | fi 9 | export TEST_DIR=$1 10 | TEST_CLASS=$2 11 | ANSWERS=$3 12 | REPEAT=$4 13 | RANDOM=$5 14 | 15 | shift; shift; shift; shift; shift 16 | 17 | . $DIR/load-setup.sh 18 | . $DB2_CONFIG 19 | 20 | java -Xmx2048M com.ibm.rdf.store.sparql11.CommandLineDriver com.ibm.rdf.store.sparql11.$TEST_CLASS $ANSWERS $REPEAT $RANDOM 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /DrugPairGOSimilarity/DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: DrugPairGOSimilarity 2 | Type: Package 3 | Title: Meant to be a web service that given a drug and its Gene Ontology Annotation, computes all drug pairs, and finds the Gene ontology similarity between them, returns drug1, drug2, similarity value 4 | Version: 1.0 5 | Date: 2016-03-02 6 | Author: Kavitha Srinivas 7 | Maintainer: Who to complain to 8 | Description: More about what it does (maybe more than one line) 9 | License: Same license as the Quetzal project 10 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/runtime/service/sql/BigQueryRdfStoreSqls: -------------------------------------------------------------------------------- 1 | 2 | getDataset = SELECT * from %s WHERE storeName = ? and status = 0 3 | 4 | insertBasicStats = INSERT INTO %s(TYPE, AVG) VALUES(?,?) 5 | 6 | distinctCountQuery = SELECT COUNT(DISTINCT %type) AS COUNT FROM %table 7 | 8 | insertTopK = INSERT INTO %s(%c , CNT) 9 | 10 | getBasicStats = SELECT TYPE, AVG, STDDEV, MIN, MAX FROM %s order by type 11 | getTopKStats = SELECT TYPE, GRAPH, SUBJECT, PREDICATE, OBJECT, CNT FROM %s order by type 12 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/rdfload.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | if [ ! -n "${RDFSTORE_HOME+x}" ]; then 3 | echo "Environment variable RDFSTORE_HOME is not set. Please set it and try again." 4 | exit 1 5 | fi 6 | 7 | RDF_CLASSPATH=${RDFSTORE_HOME}/lib/antlr-2.7.5.jar:${RDFSTORE_HOME}/lib/openrdf-sesame-2.2.3-onejar.jar:${RDFSTORE_HOME}/lib/parser.jar:${RDFSTORE_HOME}/lib/log4j.jar:${RDFSTORE_HOME}/lib/db2jcc4.jar:${RDFSTORE_HOME}/lib/rdfstore.jar 8 | 9 | java -classpath ${CLASSPATH}:${RDF_CLASSPATH} com.ibm.research.rdf.store.utilities.DataLoader "$@" -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/buildGraphWithInts.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | delete entityToID; 3 | i = 0; 4 | } 5 | 6 | function addEntity(e) { 7 | if (! (e in entityToID) ) { 8 | entityToID[e] = i; 9 | i++; 10 | } 11 | } 12 | { 13 | parse_for_elements($0, elts); 14 | subject = elts["subject"]; 15 | predicate = elts["predicate"]; 16 | object = elts["object"]; 17 | addEntity(subject); 18 | addEntity(predicate); 19 | addEntity(object); 20 | print entityToID[subject], entityToID[predicate], entityToID[object]; 21 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/iodt.sor/1.0/iodt.sor-1.0.pom: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | com.ibm.research 6 | iodt.sor 7 | 1.0 8 | POM was created by Sonatype Nexus 9 | 10 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/sparql/rewriter/SubstitutionForJena.java: -------------------------------------------------------------------------------- 1 | package com.ibm.research.sparql.rewriter; 2 | 3 | import java.util.Map; 4 | 5 | import org.apache.jena.graph.Node; 6 | 7 | 8 | 9 | /** 10 | * @author Kavitha Srinivas 11 | * @author Mariano Rodriguez 12 | * 13 | */public interface SubstitutionForJena { 14 | 15 | boolean compose(Node original, Node substituion); 16 | 17 | Node get(Node Node); 18 | 19 | Map getMap(); 20 | 21 | public boolean isEmpty(); 22 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/sql/SQL_stat_queries/run_stats: -------------------------------------------------------------------------------- 1 | db2batch -d rdfjazzh -f obj_pred_cnt.sql -r obj_pred_cnt.out 2 | db2batch -d rdfjazzh -f obj_pred_avg.sql -r obj_pred_avg.out 3 | db2batch -d rdfjazzh -f obj_cnt.sql -r obj_cnt.out 4 | db2batch -d rdfjazzh -f obj_avg.sql -r obj_avg.out 5 | db2batch -d rdfjazzh -f graph_obj_pred_cnt.sql -r graph_obj_pred_cnt.out 6 | db2batch -d rdfjazzh -f graph_obj_pred_avg.sql -r graph_obj_pred_avg.out 7 | db2batch -d rdfjazzh -f graph_obj_cnt.sql -r graph_obj_cnt.out 8 | db2batch -d rdfjazzh -f graph_obj_avg.sql -r graphobj_avg.out 9 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/lubm/q12.sparql: -------------------------------------------------------------------------------- 1 | prefix ub: 2 | 3 | select * where 4 | { 5 | { ?x a ub:FullProfessor . ?y a ub:Department . ?x ub:headOf ?y . ?y ub:subOrganizationOf . } 6 | union 7 | { ?x a ub:AssistantProfessor . ?y a ub:Department . ?x ub:headOf ?y . ?y ub:subOrganizationOf . } 8 | union 9 | { ?x a ub:AssociateProfessor . ?y a ub:Department . ?x ub:headOf ?y . ?y ub:subOrganizationOf . } 10 | } 11 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q10GET-reduced.sparql: -------------------------------------------------------------------------------- 1 | SELECT * WHERE { 2 | SERVICE { 3 | SELECT ?date (AVG(?value) AS ?avgval) WHERE { 4 | ?x ?date; 5 | ?value; 6 | 1; 7 | 2015; 8 | 22 9 | } GROUP BY ?date 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/SparqlGrammarFix.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | RS=";\n"; 3 | } 4 | 5 | /[[:space:]]*[A-Z_]+[[:space:]]*:[[:space:]]*'[a-z_]+'[[:space:]]*$/ { 6 | split($0, a, /'/); 7 | word=a[2]; 8 | newword=""; 9 | for(i = 1; i <= length(word); i++) { 10 | char=substr(word,i,1); 11 | if (char != "_") { 12 | newword = newword " ('" char "'|'" toupper(char) "')"; 13 | } else { 14 | newword = newword " '" char "'"; 15 | } 16 | } 17 | print a[0], a[1], newword, "\n ;"; 18 | next; 19 | } 20 | 21 | { 22 | print $0, ";"; 23 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/utilities/io/SparqlSelectResult.java: -------------------------------------------------------------------------------- 1 | package com.ibm.research.rdf.store.utilities.io; 2 | 3 | import java.util.Iterator; 4 | 5 | import com.ibm.research.rdf.store.sparql11.model.QueryTripleTerm; 6 | import com.ibm.research.rdf.store.sparql11.model.Variable; 7 | 8 | public interface SparqlSelectResult { 9 | 10 | public interface Row { 11 | 12 | QueryTripleTerm get(Variable v); 13 | 14 | Iterator variables(); 15 | 16 | } 17 | 18 | Iterator rows(); 19 | 20 | Iterator variables(); 21 | 22 | } 23 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/check-parse.awk: -------------------------------------------------------------------------------- 1 | { 2 | if (parse_for_elements($0, elts) > 0) { 3 | subject = elts["subject"]; 4 | predicate = elts["predicate"]; 5 | object = elts["object"]; 6 | graph = elts["graph"]; 7 | if (graph != "") { 8 | line = subject " " predicate " " object " " graph " ."; 9 | } else { 10 | line = subject " " predicate " " object " ."; 11 | } 12 | if (line != $0) { 13 | print "line: " $0 " was parsed as: " line > "/dev/stderr"; 14 | exit -1; 15 | } 16 | } else { 17 | print "cannot parse line: " $0 > "/dev/stderr"; 18 | exit -1; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/rdfload.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | IF NOT DEFINED %RDFSTORE_HOME% THEN GOTO HOME_NOT_DEFINED 3 | 4 | SET RDF_CLASSPATH=%RDFSTORE_HOME%\lib\antlr-2.7.5.jar;%RDFSTORE_HOME%\lib\openrdf-sesame-2.2.3-onejar.jar;%RDFSTORE_HOME%\lib\parser.jar;%RDFSTORE_HOME%\lib\log4j.jar;%RDFSTORE_HOME%\lib\db2jcc4.jar;%RDFSTORE_HOME%\lib\rdfstore.jar 5 | SET CLASSPATH=%CLASSPATH%;%RDF_CLASSPATH% 6 | 7 | java com.ibm.research.rdf.store.utilities.DataLoader %* 8 | 9 | GOTO END 10 | 11 | :HOME_NOT_DEFINED 12 | echo Variable RDFSTORE_HOME is not defined. Please set it and try again. 13 | GOTO END 14 | 15 | :END -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q11GET.sparql: -------------------------------------------------------------------------------- 1 | SELECT * WHERE { 2 | SERVICE { 3 | SELECT ?date ?diag_code (COUNT(DISTINCT ?empi) AS ?opcnt) WHERE { 4 | ?x ?empi ; 5 | ?date ; 6 | ?diag_code 7 | FILTER (?diag_code = "胸闷" 8 | || ?diag_code = "胸痛" 9 | || ?diag_code = "肺部感染" ) 10 | } GROUP BY ?date ?diag_code 11 | } 12 | } 13 | 14 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/testLongStringsSubstitution.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | count = 0; 3 | longStringCount = 0; 4 | } 5 | 6 | { 7 | if (fileType=="quad") { 8 | object = parse_for_object($0); 9 | graph = parse_for_graph($0); 10 | } else { 11 | object = parse_for_object($0); 12 | graph = "DEF"; 13 | } 14 | subj = $1; 15 | if (length(subj) > cutoff || length(object) > cutoff || length($2) > cutoff || length(graph) > cutoff) { 16 | longStringCount++; 17 | } 18 | count++; 19 | 20 | } 21 | END { 22 | print "count:" count " long strings count " longStringCount; 23 | } 24 | 25 | -------------------------------------------------------------------------------- /bigquery-loader/src/test/java/com/ibm/rdf/store/sparql11/BigQueryKnoesisTests.java: -------------------------------------------------------------------------------- 1 | package com.ibm.rdf.store.sparql11; 2 | 3 | public class BigQueryKnoesisTests extends KnoesisQueryUtilityTest { 4 | 5 | private static final BigQueryTestData data = new BigQueryTestData( 6 | System.getenv("DB_DB"), System.getenv("KB"), 7 | System.getenv("DB_USER"), System.getenv("DB_PASSWORD"), 8 | System.getenv("DB_SCHEMA"), false); 9 | 10 | private static final BigQueryEngine engine = new BigQueryEngine(); 11 | 12 | public BigQueryKnoesisTests() { 13 | super(data, engine, KnoesisQueryUtilityTest.answers); 14 | } 15 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/bulk_load.sh: -------------------------------------------------------------------------------- 1 | isql 1111 dba dba exec="rdf_loader_run();" & 2 | isql 1111 dba dba exec="rdf_loader_run();" & 3 | isql 1111 dba dba exec="rdf_loader_run();" & 4 | isql 1111 dba dba exec="rdf_loader_run();" & 5 | isql 1111 dba dba exec="rdf_loader_run();" & 6 | isql 1111 dba dba exec="rdf_loader_run();" & 7 | isql 1111 dba dba exec="rdf_loader_run();" & 8 | isql 1111 dba dba exec="rdf_loader_run();" & 9 | isql 1111 dba dba exec="rdf_loader_run();" & 10 | isql 1111 dba dba exec="rdf_loader_run();" & 11 | isql 1111 dba dba exec="rdf_loader_run();" & 12 | 13 | wait 14 | isql 111 dba dba exec="checkpoint;" 15 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/sql/psqlDatatypeFunction.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION dawg.datatype(var text, xmlSchemaType text) RETURNS text AS $$ 2 | DECLARE x BOOLEAN; 3 | DECLARE y NUMERIC; 4 | DECLARE z TIMESTAMP WITH TIME ZONE; 5 | DECLARE m DATE; 6 | 7 | BEGIN 8 | IF var IS NULL THEN 9 | RETURN NULL; 10 | ELSIF dawg.iscastable(var, xmlSchemaType)=true THEN 11 | RETURN xmlSchemaType; 12 | ELSE 13 | RETURN 'http://www.w3.org/2001/XMLSchema#string'; 14 | END IF; 15 | EXCEPTION WHEN others THEN 16 | RETURN 'http://www.w3.org/2001/XMLSchema#string'; 17 | END; 18 | $$ LANGUAGE plpgsql IMMUTABLE; 19 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q5GET.sparql: -------------------------------------------------------------------------------- 1 | 2 | prefix fn: 3 | prefix x: 4 | prefix xs: 5 | 6 | function fn:getDrugBankNames GET ( -> ?x ) 7 | service fn:getDrugBankNames [ ] -> "//x:row" :: "./x:drug" "xs:string" 8 | 9 | function fn:getDrugTransporters ( ?x -> ?y ) 10 | table fn:postData [ "funcData" -> post data ] -> "//row" :: "./drug" "xs:string" "./sum" "xs:string" 11 | 12 | select * where { 13 | 14 | BIND( fn:getDrugBankNames() AS ( ?drug ) ) 15 | 16 | BIND( fn:getDrugTransporters( ?drug ) AS ( ?drug ?sum ) ) 17 | 18 | } 19 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/lubm/q4.sparql: -------------------------------------------------------------------------------- 1 | prefix ub: 2 | select * 3 | where 4 | { 5 | 6 | { ?x a ub:AssociateProfessor . ?x ub:worksFor . ?x ub:name ?y1 . ?x ub:emailAddress ?y2 . ?x ub:telephone ?y3 . } 7 | union 8 | { ?x a ub:AssistantProfessor . ?x ub:worksFor . ?x ub:name ?y1 . ?x ub:emailAddress ?y2 . ?x ub:telephone ?y3 . } 9 | union 10 | { ?x a ub:FullProfessor . ?x ub:worksFor . ?x ub:name ?y1 . ?x ub:emailAddress ?y2 . ?x ub:telephone ?y3 . } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/dockerEnvt.sh: -------------------------------------------------------------------------------- 1 | export DB2_HOST=localhost 2 | export DB2_DB=quetzal 3 | if [ -z "$KNOWLEDGE_BASE" ]; then 4 | export KNOWLEDGE_BASE=kb 5 | fi 6 | 7 | export PROCESSOR=`cat /proc/cpuinfo | grep 'processor' | wc -l` 8 | 9 | if ls /data/*.nt; then 10 | export DATAFILE=`ls /data/*.nt` 11 | export FILETYPE=nt 12 | else 13 | export DATAFILE=`ls /data/*.nq` 14 | export FILETYPE=quad 15 | fi 16 | 17 | echo "filetype:" $FILETYPE 18 | echo "datafile:" $DATAFILE 19 | 20 | f=`cat $DATAFILE | wc -l | awk '{print $1}'` 21 | echo $f 22 | if [ "$f" -gt 100 ] ; then 23 | PARALLEL="--parallel $PROCESSOR" 24 | fi 25 | 26 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/processQUT.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | delete queryValues; 3 | FS=":"; 4 | } 5 | 6 | { 7 | if ($2 in queryValues) { 8 | queryValues[$2] = queryValues[$2] "," $3; 9 | } else { 10 | queryValues[$2] = $3; 11 | } 12 | } 13 | 14 | END { 15 | for (q in queryValues) { 16 | n = split(queryValues[q], arr, ","); 17 | sum = 0; 18 | for (i=2; i <= n; i++) { 19 | sum += arr[i]; 20 | } 21 | avg = sum/ ((n-1) * 1.0); 22 | sumsq = 0; 23 | for (i=2; i <= n; i++) { 24 | sumsq = (arr[i] - avg) * (arr[i] - avg); 25 | } 26 | std = sqrt(sumsq / ( (n-1) * 1.0)); 27 | print q, avg, std; 28 | } 29 | } 30 | 31 | -------------------------------------------------------------------------------- /spanner-loader/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | spanner-loader 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /bigquery-loader/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | word-count-beam 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javanature 21 | org.eclipse.m2e.core.maven2Nature 22 | 23 | 24 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/extractPrefixes.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | FS = "[|][|]"; 3 | } 4 | 5 | function extractPrefix(str, arr, k) { 6 | if (index(str, "\"") == 1) { 7 | return; 8 | } 9 | if (index(str, "#") != 0) { 10 | split(str, arr, "#"); 11 | sub(/ 2 | 3 | rdfstore-checker 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | rdfstore-base 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | org.eclipse.m2e.core.maven2Builder 15 | 16 | 17 | 18 | 19 | 20 | org.eclipse.m2e.core.maven2Nature 21 | org.eclipse.jdt.core.javanature 22 | 23 | 24 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/runtime/service/sql/BigQuery.datatypes: -------------------------------------------------------------------------------- 1 | FLOAT=FLOAT64 2 | STRING=STRING 3 | DOUBLE=FLOAT64 4 | DECIMAL=FLOAT64 5 | DATETIME=TIMESTAMP 6 | INTEGER=INT64 7 | DATE=DATE 8 | NUMERIC=FLOAT64 9 | xs_dateTime=http://www.w3.org/2001/XMLSchema#dateTime 10 | xs_integer=http://www.w3.org/2001/XMLSchema#integer 11 | xs_date=http://www.w3.org/2001/XMLSchema#date 12 | xs_decimal=http://www.w3.org/2001/XMLSchema#decimal 13 | xs_float=http://www.w3.org/2001/XMLSchema#float 14 | xs_double=http://www.w3.org/2001/XMLSchema#double 15 | xs_boolean=http://www.w3.org/2001/XMLSchema#boolean 16 | xs_string=http://www.w3.org/2001/XMLSchema#string -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q14GET.sparql: -------------------------------------------------------------------------------- 1 | 2 | prefix fn: 3 | prefix fn2: 4 | prefix x: 5 | prefix xs: 6 | 7 | function fn:getDrugBankNames GET ( -> ?x ) 8 | service fn:getDrugBankNames [ ] -> "//x:row" :: "./x:drug" "xs:string" 9 | 10 | function fn:getSMILES ( ?drug -> ?smiles ) 11 | table fn:getSMILES [ "funcData" -> post data ] -> "//x:row" :: "./x:drug" "xs:string" "./x:smiles" "xs:string" 12 | 13 | select distinct * where { 14 | 15 | BIND( fn:getDrugBankNames() AS ( ?drug ) ) 16 | 17 | BIND( fn:getSMILES( ?drug ) AS ( ?drug ?smiles ) ) 18 | 19 | } 20 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q2GET.sparql: -------------------------------------------------------------------------------- 1 | 2 | prefix fn: 3 | prefix x: 4 | prefix xs: 5 | 6 | function fn:getDrugBankNames GET ( -> ?x ) 7 | service fn:getDrugBankNames [ ] -> "//x:row" :: "./x:drug" "xs:string" 8 | 9 | function fn:getTransportersPost ( ?drug -> ?transporter ) 10 | table fn:getTransporters [ "funcData" -> post data ] -> "//x:row" :: "./x:drug" "xs:string" "./x:transporter" "xs:string" 11 | 12 | select ?drug ?transporter where { 13 | 14 | BIND( fn:getDrugBankNames() AS ( ?drug ) ) 15 | 16 | BIND( fn:getTransportersPost( ?drug ) AS ( ?drug ?transporter ) ) 17 | 18 | } 19 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/runtime/service/sql/Postgresql.datatypes: -------------------------------------------------------------------------------- 1 | FLOAT=REAL 2 | STRING=TEXT 3 | DOUBLE=DOUBLE PRECISION 4 | DECIMAL=DECIMAL 5 | DATETIME=TIMESTAMP WITH TIME ZONE 6 | INTEGER=NUMERIC(1000,0) 7 | DATE=DATE 8 | NUMERIC=NUMERIC 9 | xs_dateTime=http://www.w3.org/2001/XMLSchema#dateTime 10 | xs_integer=http://www.w3.org/2001/XMLSchema#integer 11 | xs_date=http://www.w3.org/2001/XMLSchema#date 12 | xs_decimal=http://www.w3.org/2001/XMLSchema#decimal 13 | xs_float=http://www.w3.org/2001/XMLSchema#float 14 | xs_double=http://www.w3.org/2001/XMLSchema#double 15 | xs_boolean=http://www.w3.org/2001/XMLSchema#boolean 16 | xs_string=http://www.w3.org/2001/XMLSchema#string -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/lubm/q2.sparql: -------------------------------------------------------------------------------- 1 | SELECT ?x ?y ?z WHERE { 2 | ?x . 3 | ?y . 4 | ?z . 5 | ?x ?z . 6 | ?z ?y . 7 | ?x ?y 8 | } 9 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/db2/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM bryantsai/db2-server:db2_inst_1 2 | 3 | MAINTAINER Kavitha Srinivas 4 | 5 | RUN apt-get update && apt-get install -y maven \ 6 | && apt-get install -y git \ 7 | && apt-get install -y gawk \ 8 | && apt-get install -y realpath \ 9 | && mkdir /data \ 10 | && cd /data \ 11 | && git clone https://github.com/Quetzal-RDF/quetzal /data/quetzal \ 12 | && cd /data/quetzal/com.ibm.research.quetzal.core/ && mvn verify -DskipTests \ 13 | && mkdir /data/tmp \ 14 | && chown -R db2inst1:db2grp1 /data 15 | 16 | # cant switch user here to db2inst1. Mounting the volume for /home seems to depend 17 | # on logging in as root, and then db2 does not start 18 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/sql/db2typeof.sql: -------------------------------------------------------------------------------- 1 | create or replace function typeof(lit varchar(200)) 2 | returns CHAR(1) 3 | language sql contains sql no external action deterministic 4 | begin 5 | declare v DECFLOAT; 6 | declare continue handler for sqlstate '22018' 7 | begin 8 | declare d TIMESTAMP; 9 | declare continue handler for sqlstate '22007' 10 | begin 11 | return 'V'; 12 | end; 13 | set d = CAST(lit as TIMESTAMP); 14 | return 'T'; 15 | end; 16 | declare continue handler for sqlstate '42820' 17 | begin 18 | return 'V'; 19 | end; 20 | declare continue handler for sqlstate '22003' 21 | begin 22 | return 'V'; 23 | end; 24 | set v = CAST(lit as DECFLOAT); 25 | return 'D'; 26 | END 27 | @ 28 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/long-strings.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | stringOut = (pawk == "yes")? longStringFile "." part: longStringFile; 3 | 4 | cmd = "java -Dfile.encoding=UTF-8 com.ibm.research.rdf.store.loader.LongStringHasher " cutoff; 5 | # PROCINFO[cmd, "pty"] = 1; 6 | 7 | table = "sort | uniq > " stringOut 8 | } 9 | 10 | function hash_string(str,entry, result,stuff,str2) { 11 | if (length(str) < cutoff) { 12 | return str; 13 | } else { 14 | print str |& cmd; 15 | cmd |& getline result; 16 | if (str != result) { 17 | str = fixBrackets(str); 18 | print result "\t" str "\t" type_code(entry) |& table; 19 | return result; 20 | } else { 21 | return result; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/postgresql/Dockerfile~: -------------------------------------------------------------------------------- 1 | FROM ibmresearch/quetzal 2 | 3 | MAINTAINER Kavitha Srinivas 4 | 5 | RUN apt-get update && apt-get install -y python-software-properties software-properties-common postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3 6 | 7 | WORKDIR /data 8 | 9 | USER postgres 10 | 11 | # This image does nothing much other than set a volume where the data directory # is: i.e., where the nt file sits. For now the assumption is that 12 | # its unzipped and it exists in the /data dir. All temporary files get written 13 | # to that directory. 14 | #VOLUME /data 15 | 16 | ENTRYPOINT ["/bin/bash", "-v", "/sparqltosqlbase/docker/load/runLoadPostgres.sh"] 17 | 18 | -------------------------------------------------------------------------------- /rdfstore-checker/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 4 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 5 | org.eclipse.jdt.core.compiler.compliance=1.8 6 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 7 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 8 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 9 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 10 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning 12 | org.eclipse.jdt.core.compiler.source=1.8 13 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/SQLCommand.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public interface SQLCommand { 14 | 15 | public String toSQL(); 16 | } 17 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | reverse_count=127; 4 | 5 | i=0; 6 | 7 | reverse_str=''; 8 | prop_str=' prop'; 9 | entry_str='entry'; 10 | delim_str=','; 11 | group_str_o='('; 12 | group_str_c=')'; 13 | 14 | 15 | 16 | while [[ $i -lt $reverse_count ]] 17 | do 18 | reverse_str=$reverse_str$group_str_o$entry_str$delim_str$prop_str$i$group_str_c$delim_str; 19 | i=$((i+1)); 20 | done 21 | reverse_str=$reverse_str$group_str_o$entry_str$delim_str$prop_str$i$group_str_c; 22 | 23 | 24 | echo "db2 RUNSTATS ON TABLE $SCHEMA_NAME.$STORE_NAME"_RPH" ON ALL COLUMNS WITH DISTRIBUTION ON COLUMNS ( $reverse_str ) DEFAULT NUM_FREQVALUES $FREQ NUM_QUANTILES $QUANTILES AND DETAILED INDEXES ALL ALLOW WRITE ACCESS "; 25 | 26 | -------------------------------------------------------------------------------- /bigquery-loader/src/main/java/com/ibm/research/quetzal/loader/lubmSchema.json: -------------------------------------------------------------------------------- 1 | {"schema":{"fields":[{"name":"subject","type":"string"},{"name":"col_8","type":"string"},{"name":"col_6","type":"string"},{"name":"col_5","type":"string"},{"name":"col_12","type":"string"},{"name":"col_3","type":"string"},{"name":"col_15","type":"string"},{"name":"col_9","type":"string"},{"name":"col_16","type":"string"},{"name":"col_7","type":"string","mode":"repeated"},{"name":"col_2","type":"string"},{"name":"col_11","type":"string"},{"name":"col_4","type":"string"},{"name":"col_0","type":"string","mode":"repeated"},{"name":"col_14","type":"string","mode":"repeated"},{"name":"col_10","type":"string"},{"name":"col_13","type":"string"},{"name":"col_1","type":"string","mode":"repeated"}]}} 2 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/sql/psql2typeof.sql: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION typeof(lit varchar(200)) RETURNS CHAR(1) AS $$ 2 | DECLARE v FLOAT; 3 | d TIMESTAMP; 4 | BEGIN 5 | BEGIN 6 | BEGIN 7 | v := lit::float; 8 | EXCEPTION WHEN OTHERS THEN 9 | BEGIN 10 | d := lit::timestamp; 11 | EXCEPTION WHEN OTHERS THEN 12 | BEGIN 13 | RETURN 'V'; 14 | END; 15 | END; 16 | RETURN 'T'; 17 | END; 18 | RETURN 'D'; 19 | END; 20 | END; 21 | $$ LANGUAGE plpgsql; 22 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/query/SQLLogicNodeType.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.query; 12 | 13 | public enum SQLLogicNodeType 14 | { 15 | AND, OR, TRIPLE; 16 | } 17 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/fix-escapes-for-ntriples.awk: -------------------------------------------------------------------------------- 1 | { 2 | str = $0; 3 | res = ""; 4 | while (match(str, /(^|[^\\])\\([^tnr\"uU\\]|u([0-9a-fA-F]{0,3})([^0-9a-fA-F])|U([0-9a-fA-F]{0,7})([^0-9a-fA-F]))/, a) > 0) { 5 | escape = substr(str, RSTART, RLENGTH); 6 | if (a[4, "length"] > 0 || a[6, "length"] > 0) { 7 | adjust=-1; 8 | } else { 9 | adjust=0; 10 | } 11 | if (a[1, "length"] == 0) { 12 | res = res substr(str, 1, RSTART-1) "\\" substr(str, RSTART, RLENGTH+adjust); 13 | str = substr(str, RSTART+RLENGTH+adjust); 14 | } else { 15 | res = res substr(str, 1, RSTART) "\\" substr(str, RSTART+1, RLENGTH-1+adjust); 16 | str = substr(str, RSTART+RLENGTH+adjust); 17 | } 18 | } 19 | 20 | print res str; 21 | } 22 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.1/hashmvn-1.1.pom: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | com.ibm.research.hashmvn 5 | hashmvn 6 | 1.1 7 | jar 8 | 9 | 10 | 11 | 12 | maven-compiler-plugin 13 | 2.3.2 14 | 15 | 1.6 16 | 1.6 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/replaceWithPrefixes.sh: -------------------------------------------------------------------------------- 1 | sed s@http://purl.org/dc/elements/1.1/@1:@g $1\ 2 | | sed s@http://xmlns.com/foaf/0.1/@2:@g\ 3 | | sed s@http://www.w3.org/1999/02/22-rdf-syntax-ns#@3:@g\ 4 | | sed s@http://localhost/vocabulary/bench/@4:@g\ 5 | | sed s@http://purl.org/dc/terms/@5:@g\ 6 | | sed s@http://swrc.ontoware.org/ontology#@6:@g\ 7 | | sed s@http://www.w3.org/2000/01/rdf-schema#@7:@g\ 8 | | sed s@http://localhost/misc/@8:@g\ 9 | | sed s@http://localhost/publications/inprocs/@9:@g\ 10 | | sed s@http://localhost/publications/incolls/@10:@g\ 11 | | sed s@http://localhost/publications/journals/@11:@g\ 12 | | sed s@http://localhost/publications/articles/@12:@g\ 13 | | sed s@http://localhost/publications/procs/@13:@g\ 14 | | sed s@http://www.w3.org/2001/XMLSchema#@14:@g\ 15 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/query/EQueryType.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.query; 12 | 13 | public enum EQueryType { 14 | SELECT_QUERY, 15 | DESCRIBE_QUERY, 16 | ASK_QUERY, 17 | CONSTRUCT_QUERY 18 | } 19 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/hashmvn/hashmvn/1.0/hashmvn-1.0.pom: -------------------------------------------------------------------------------- 1 | 2 | 4.0.0 3 | com.ibm.research.hashmvn 4 | hashmvn 5 | 1.0 6 | 7 | 8 | 9 | 10 | 11 | maven-compiler-plugin 12 | 2.3.2 13 | 14 | 1.6 15 | 1.6 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/check-mapping.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DB=$1 4 | KB=$2 5 | BASE=$3 6 | 7 | function check() { 8 | table=$1 9 | hashes_file=$2 10 | 11 | max_column=`awk 'BEGIN {max=0;} { for(i = 2; i <= NF; i++) { if ($i > max) { max=$i; } } } END { print max; }' $hashes_file` 12 | 13 | i=1 14 | sql="select 0 as col, prop0 as prop from $table" 15 | while [[ $i -le $max_column ]]; do 16 | sql="$sql union select $i as col, prop$i as prop from $table" 17 | i=`expr $i + 1` 18 | done 19 | sql="select count(col) as count, prop from ($sql) where prop is not null group by prop" 20 | 21 | db2 < repo.aduna-software.org/82.94.239.126\:80] 7 | http\://download.java.net/maven/2/.error= 8 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/mvnLibs/research/helixmvn2/helixcore/1.0/helixcore-1.0.pom.lastUpdated: -------------------------------------------------------------------------------- 1 | #NOTE: This is an internal implementation file, its format can be changed without prior notice. 2 | #Fri Feb 13 10:08:18 EST 2015 3 | default-http\://repo.aduna-software.org/maven2/releases/.lastUpdated=1423840098397 4 | http\://download.java.net/maven/2/.lastUpdated=1423840098561 5 | http\://helix1.pok.ibm.com\:8081/nexus/content/groups/public/.lastUpdated=1423840098904 6 | http\://repo.aduna-software.org/maven2/releases/.error=Could not transfer artifact com.ibm.research.helixmvn2\:helixcore\:pom\:1.0 from/to sesame-official-repository (http\://repo.aduna-software.org/maven2/releases)\: Remotely Closed [id\: 0x57d2e7ea, /0\:0\:0\:0\:0\:0\:0\:1\:54919 \:> repo.aduna-software.org/82.94.239.126\:80] 7 | http\://download.java.net/maven/2/.error= 8 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | Quetzal-RDF 7 | Quetzal-Project 8 | 0.0.1-SNAPSHOT 9 | pom 10 | 11 | 0.0.1-SNAPSHOT 12 | UTF-8 13 | b000 14 | 15 | 16 | 17 | com.ibm.research.quetzal.core 18 | rdfstore-checker 19 | 20 | 21 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/loadFileToNTriples.sh: -------------------------------------------------------------------------------- 1 | DIR=`dirname $0` 2 | 3 | ORIG_NT=$1 4 | SENSE=$2 5 | 6 | shift; shift 7 | 8 | if [[ -e $ORIG_NT.sorted_$SENSE.primary.load.* ]]; then 9 | FILES=$ORIG_NT.sorted_$SENSE.primary.load.* 10 | else 11 | FILES="$@" 12 | fi 13 | 14 | (for f in $FILES; do 15 | AWK_OPTS="-v fileFor=$SENSE" 16 | 17 | if [[ -f $ORIG_NT.long_strings ]]; then 18 | AWK_OPTS="$AWK_OPTS -v longStringFile=$ORIG_NT.long_strings" 19 | fi 20 | 21 | SF=`echo $f | sed s/primary/secondary/` 22 | if [[ -f $SF ]]; then 23 | AWK_OPTS="$AWK_OPTS -v secondaryFile=$SF" 24 | fi 25 | 26 | if [[ -f $ORIG_NT.types ]]; then 27 | AWK_OPTS="$AWK_OPTS -v typeFile=$ORIG_NT.types" 28 | fi 29 | 30 | gawk $AWK_OPTS -f $DIR/strings.awk -f $DIR/loadFileToNTriples.awk $f 31 | done) | LC_ALL=C sort 32 | 33 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/sqlwriter/SQLWriterException.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.sqlwriter; 12 | 13 | public class SQLWriterException extends Exception{ 14 | public SQLWriterException(String msg){ 15 | super(msg); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/check_line.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | LINE=$1 4 | DATA=$2 5 | ENTITY=$3 6 | 7 | SIZE=`echo $LINE | awk '{ print $1; }'` 8 | 9 | rm -f /tmp/names_file.* /tmp/matches.txt 10 | 11 | PREDS=`echo $LINE | sed 's/[0-9]*[ ]*|/ /g'` 12 | 13 | i=0 14 | for p in $PREDS; do 15 | awk -f ~/find_by_pred.awk -v entity=$ENTITY -v pred=$p $DATA | sort | uniq > /tmp/names_file.$i 16 | i=`expr $i + 1` 17 | done 18 | 19 | NAMES_FILES=`ls /tmp/names_file.* | awk '{ printf("%s ", $1); }'` 20 | 21 | awk -f ~/find_by_names.awk -v entity=$ENTITY -v names_files="$NAMES_FILES" $DATA | sort | uniq | awk '{ $1=""; print $0; }' | sort | uniq -c | egrep "^[[:blank:]]*$i[[:blank:]]" > /tmp/matches.txt 22 | 23 | if [[ `cat /tmp/matches.txt | wc -l` = $SIZE ]]; then 24 | echo $LINE matches 25 | else 26 | echo $LINE does NOT match 27 | fi 28 | -------------------------------------------------------------------------------- /bigquery-loader/src/test/java/com/ibm/rdf/store/sparql11/BigQueryEngine.java: -------------------------------------------------------------------------------- 1 | package com.ibm.rdf.store.sparql11; 2 | 3 | import com.ibm.rdf.store.sparql11.TestRunner.AbstractEngine; 4 | import com.ibm.research.owlql.ruleref.OWLQLSPARQLCompiler; 5 | import com.ibm.research.rdf.store.query.QueryProcessor; 6 | import com.ibm.research.rdf.store.query.QueryProcessorFactory; 7 | import com.ibm.research.rdf.store.sparql11.model.Query; 8 | 9 | public class BigQueryEngine extends AbstractEngine { 10 | 11 | public BigQueryEngine() { 12 | super(); 13 | } 14 | 15 | public BigQueryEngine(OWLQLSPARQLCompiler compiler) { 16 | super(compiler); 17 | } 18 | 19 | protected QueryProcessor createQueryProcessor(BigQueryTestData data, Query q) { 20 | return QueryProcessorFactory.create(q, data.conn, data.store, 21 | data.ctx, compiler); 22 | } 23 | 24 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/owlql/rule/Adornment.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | 12 | package com.ibm.research.owlql.rule; 13 | 14 | 15 | public interface Adornment { 16 | boolean isAdornmentOnRule(); 17 | boolean isAdornmentOnPredicate(); 18 | RuleAdornment asRuleAdornment(); 19 | PredicateAdornment asPredicateAdornment(); 20 | } 21 | -------------------------------------------------------------------------------- /rdfstore-checker/source/com/ibm/research/rdf/store/sparql11/semantics/UniverseFactory.java: -------------------------------------------------------------------------------- 1 | package com.ibm.research.rdf.store.sparql11.semantics; 2 | 3 | import java.net.URI; 4 | import java.net.URISyntaxException; 5 | import java.util.Set; 6 | 7 | import com.ibm.wala.util.collections.Pair; 8 | 9 | import kodkod.ast.Relation; 10 | import kodkod.instance.Bounds; 11 | 12 | public interface UniverseFactory { 13 | 14 | public Bounds boundUniverse(Set liveRelations) throws URISyntaxException; 15 | 16 | public Relation atomRelation(Object atom); 17 | 18 | public void nodesRelation(Relation r); 19 | 20 | public void ensureIRI(URI iri); 21 | 22 | public void ensureGraph(URI iri); 23 | 24 | public void ensureLiteral(Pair lit); 25 | 26 | public void ensureBlankNode(String blankId); 27 | 28 | public void addSolution(SolutionRelation solution); 29 | } 30 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/hashing/IHashingFunction.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.hashing; 12 | 13 | /** 14 | * Interface that offers a method to hash strings to integers. 15 | */ 16 | public interface IHashingFunction { 17 | /** Returns a hash of string s. */ 18 | public int hash(String s); 19 | } 20 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/pawk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=`dirname $0` 4 | 5 | AWK_FILE=`basename $0 sh`awk 6 | 7 | DEGREE=$1 8 | CHUNKS=$2 9 | SPLIT=$3 10 | FILE=$4 11 | 12 | shift; shift; shift; shift 13 | 14 | SIZE=`ls -l $FILE | awk '{ print $5; }'` 15 | CHUNK=`expr '(' $SIZE + $CHUNKS ')' / $CHUNKS` 16 | 17 | i=$SIZE 18 | j=0 19 | (while expr $i '>' 0 > /dev/null; do 20 | i=`expr $i - $CHUNK` 21 | if expr $i '<' 0 > /dev/null; then 22 | echo -n cat $FILE "|" gawk -v splitFor=$SPLIT -v pawk=yes -v last=yes -v part=$j -v chunk=`expr $i + $CHUNK` -f $DIR/strings.awk -f $DIR/parse.awk -f $DIR/$AWK_FILE "$@" "\0" 23 | else 24 | echo -n tail --bytes=$i $FILE "|" gawk -v splitFor=$SPLIT -v pawk=yes -v part=$j -v chunk=$CHUNK -f $DIR/strings.awk -f $DIR/parse.awk -f $DIR/$AWK_FILE "$@" "\0" 25 | fi 26 | j=`expr $j + 1` 27 | done) | xargs -0 -n 1 -P $DEGREE sh -c 28 | 29 | 30 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/BlankNodeVariable.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | 13 | public class BlankNodeVariable extends Variable { 14 | 15 | public BlankNodeVariable(String name) { 16 | super(name); 17 | } 18 | 19 | public String toString() { return getName(); } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/planner/PlanNodeType.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.planner; 12 | 13 | public enum PlanNodeType 14 | { 15 | MATERIALIZED_TABLE, EMPTY, TRIPLE, AND, UNION, LEFT, SUBSELECT, MINUS, EXISTS, NOT_EXISTS, STAR, REUSE, VALUES, PARTITION, GRAPH, JOIN, PRODUCT, SERVICE; 16 | } 17 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q3GET.sparql: -------------------------------------------------------------------------------- 1 | 2 | prefix fn: 3 | prefix x: 4 | prefix xs: 5 | 6 | function fn:getDrugBankNames GET ( -> ?x ) 7 | service fn:getDrugBankNames [ ] -> "//x:row" :: "./x:drug" "xs:string" 8 | 9 | function fn:getTransporters ( ?drug -> ?transporter ) 10 | table fn:getTransporters [ "funcData" -> post data ] -> "//x:row" :: "./x:drug" "xs:string" "./x:transporter" "xs:string" 11 | 12 | function fn:getDrugSMILESPost ( ?x -> ?y ) 13 | table fn:getSMILES [ "funcData" -> post data ] -> "//x:row" :: "./x:drug" "xs:string" "./x:smiles" "xs:string" 14 | 15 | select distinct * where { 16 | 17 | BIND( fn:getDrugBankNames() AS ( ?drug ) ) 18 | 19 | BIND( fn:getTransporters( ?drug ) AS ( ?drug ?transporter ) ) 20 | 21 | BIND( fn:getDrugSMILESPost( ?drug ) AS ( ?drug ?smiles ) ) 22 | 23 | } 24 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/triple-pawk.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=`dirname $0` 4 | 5 | AWK_FILE=`basename $0 sh`awk 6 | 7 | DEGREE=$1 8 | CHUNKS=$2 9 | SPLIT=$3 10 | FILE=$4 11 | 12 | shift; shift; shift; shift 13 | 14 | SIZE=`ls -l $FILE | awk '{ print $5; }'` 15 | CHUNK=`expr '(' $SIZE + $CHUNKS ')' / $CHUNKS` 16 | 17 | i=$SIZE 18 | j=0 19 | (while expr $i '>' 0 > /dev/null; do 20 | i=`expr $i - $CHUNK` 21 | if expr $i '<' 0 > /dev/null; then 22 | echo -n cat $FILE "|" gawk -v splitFor=$SPLIT -v pawk=yes -v last=yes -v part=$j -v chunk=`expr $i + $CHUNK` -f $DIR/strings.awk -f $DIR/parse.awk -f $DIR/$AWK_FILE "$@" 23 | else 24 | echo -n tail --bytes=$i $FILE "|" gawk -v splitFor=$SPLIT -v pawk=yes -v part=$j -v chunk=$CHUNK -f $DIR/strings.awk -f $DIR/parse.awk -f $DIR/$AWK_FILE "$@" 25 | fi 26 | printf "\0" 27 | j=`expr $j + 1` 28 | done) | xargs -0 -n 1 -P $DEGREE sh -c 29 | 30 | 31 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q12GET-reduced.sparql: -------------------------------------------------------------------------------- 1 | SELECT * WHERE 2 | { 3 | SERVICE { 4 | { 5 | SELECT ?date (AVG(?value) AS ?avgval) WHERE { 6 | 7 | ?x ?date; 8 | ?value 9 | } GROUP BY ?date 10 | 11 | } 12 | OPTIONAL { 13 | SELECT (?date2 AS ?date) ?diag_code (COUNT(DISTINCT ?empi) AS ?opcnt) WHERE { 14 | ?x ?empi ; 15 | ?date2 ; 16 | ?diag_code 17 | FILTER (?diag_code = "胸闷" ) 18 | } GROUP BY ?date2 ?diag_code 19 | } 20 | } 21 | bind(if(!bound(?opcnt), 0, ?opcnt) as ?opcnt) 22 | } order by ?date 23 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/Visitor.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | 13 | import com.ibm.research.rdf.store.Store; 14 | import com.ibm.research.rdf.store.sparql11.sqlwriter.FilterContext; 15 | 16 | public interface Visitor { 17 | public String visit(Store store, FilterContext context, Expression exp); 18 | } 19 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/stringLengthDistribution.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | DIR=`dirname $0` 4 | 5 | awk -f $DIR/strings.awk $DIR/parse.awk -f '{ 6 | print find_subect($0); 7 | print find_predicate($0); 8 | print find_object($0); 9 | graph = find_graph($0); 10 | if (trimString(graph)) != "") { 11 | print graph; 12 | } 13 | }' $1 | sort | uniq | awk 'BEGIN { 14 | delete lengths; 15 | } 16 | 17 | { 18 | lengths[sprintf("%25d", length($0))]++; 19 | } 20 | 21 | END { 22 | bins = asorti(lengths, sorted_lengths); 23 | 24 | total = 0; 25 | for(i = 1; i <= bins; i++) { 26 | total += lengths[sorted_lengths[i]]; 27 | } 28 | 29 | cumulative = 0; 30 | for(i = 1; i <= bins; i++) { 31 | cumulative += lengths[sorted_lengths[i]]; 32 | printf("%d %d %d %f\n", sorted_lengths[i], lengths[sorted_lengths[i]], cumulative, cumulative/total); 33 | } 34 | }' 35 | 36 | 37 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/XTree.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11; 12 | 13 | import org.antlr.runtime.Token; 14 | import org.antlr.runtime.tree.CommonTree; 15 | 16 | public class XTree extends CommonTree { 17 | 18 | protected String matched; 19 | 20 | public XTree(Token t) { 21 | super(t); 22 | matched = null; 23 | } 24 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/ExpressionVisitor.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | 13 | import com.ibm.research.rdf.store.Store; 14 | import com.ibm.research.rdf.store.sparql11.sqlwriter.FilterContext; 15 | 16 | public interface ExpressionVisitor { 17 | 18 | public String visit(FilterContext context, Store store); 19 | } 20 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/InsertCopyOfATableIntoTable.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class InsertCopyOfATableIntoTable extends InsertIntoTable implements SQLCommand { 14 | 15 | public InsertCopyOfATableIntoTable(String targetTable, String sourceTable) { 16 | super(targetTable, "SELECT * FROM "+sourceTable); 17 | } 18 | 19 | 20 | 21 | } 22 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/sql/readtext.sql: -------------------------------------------------------------------------------- 1 | CREATE or replace function readfile(dir VARHAR(200), file VACHAR(200)) 2 | returns CLOB 3 | language sql contains sql 4 | BEGIN 5 | DECLARE v_textfile UTL_FILE.FILE_TYPE; 6 | DECLARE v_textline VARCHAR(200); 7 | DECLARE SQLCODE INTEGER DEFAULT 0; 8 | DECLARE SQLSTATE CHAR(5) DEFAULT '00000'; 9 | DECLARE SQLSTATE1 CHAR(5) DEFAULT '00000'; 10 | DECLARE CONTINUE HANDLER FOR SQLSTATE '02000'SET SQLSTATE1 = SQLSTATE; 11 | 12 | SET v_textfile = UTL_FILE.FOPEN(v_dirAlias,v_filename,'r'); 13 | 14 | loop1: LOOP 15 | CALL UTL_FILE.GET_LINE(v_textfile, v_textline); 16 | IF SQLSTATE1 = '02000' THEN -- NO DATA FOUND 17 | LEAVE loop1; 18 | END IF; 19 | CALL DBMS_OUTPUT.PUT_LINE(v_textline); 20 | END LOOP; 21 | CALL DBMS_OUTPUT.PUT_LINE('End of file ' || v_filename || ' - ' || v_count 22 | || ' records retrieved'); 23 | CALL UTL_FILE.FCLOSE(v_textfile); 24 | END@ 25 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/DeleteTable.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class DeleteTable implements SQLCommand { 14 | protected String table; 15 | 16 | public DeleteTable(String table) { 17 | super(); 18 | this.table = table; 19 | } 20 | 21 | @Override 22 | public String toSQL() { 23 | return "DELETE FROM "+ table; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/spark/files/hive-site.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | hive.metastore.uris 4 | thrift://localhost:9083 5 | 6 | 7 | hive.metastore.client.socket.timeout 8 | 300 9 | 10 | 11 |     hive.metastore.warehouse.dir 12 |     /data/hive/warehouse 13 | 14 | 15 |     javax.jdo.option.ConnectionURL 16 |     jdbc:derby:;databaseName=/data/hive/metastore_db;create=true 17 |     JDBC connect string for a JDBC metastore 18 | 19 | 20 | hive.enable.spark.execution.engine 21 | false 22 | 23 | 24 | hive.exec.stagingdir 25 | /tmp/hive/hive-staging 26 | 27 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/MultipleCTEDefintion.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class MultipleCTEDefintion extends CTEDefinition { 14 | private String sql; 15 | public MultipleCTEDefintion(String sql) { 16 | super(null, null); 17 | this.sql = sql; 18 | } 19 | @Override 20 | public String toSQL() { 21 | return sql; 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q12GET.sparql: -------------------------------------------------------------------------------- 1 | SELECT * WHERE { 2 | { 3 | SERVICE { 4 | SELECT ?date (AVG(?value) AS ?avgval) WHERE { 5 | ?x ?date; 6 | ?value 7 | } GROUP BY ?date 8 | } 9 | } 10 | OPTIONAL { 11 | SERVICE { 12 | SELECT (?date2 as ?date) ?diag_code (COUNT(DISTINCT ?empi) AS ?opcnt) WHERE { 13 | ?x ?empi ; 14 | ?date2 ; 15 | ?diag_code 16 | FILTER (?diag_code = "胸闷" ) 17 | } GROUP BY ?date2 ?diag_code 18 | } 19 | } 20 | bind(if(!bound(?opcnt), 0, ?opcnt) as ?opcnt) 21 | } order by ?date limit 100 22 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/spark/runLoadSpark.sh: -------------------------------------------------------------------------------- 1 | if [ -z "$PASSWD" ]; then 2 | echo "Need to set PASSWD for docker container. Use docker -e PASSWD= to set" 3 | exit 1 4 | fi 5 | 6 | DIR=`dirname $0` 7 | . $DIR/../dockerEnvt.sh 8 | . $DIR/sparkEnvt.sh 9 | 10 | # In a Docker container, make sure that the hive metastore gets written to a data volume or all data will be 11 | # inaccessible. The HDFS default is to write to /tmp, start thriftserver from there. 12 | cd /tmp 13 | 14 | /init.sh 15 | 16 | cd /data 17 | 18 | mkdir /data/tmp 19 | 20 | echo root:$PASSWD | chpasswd 21 | 22 | bash $DIR/../../scripts/build-load-files.sh --db-engine shark $PARALLEL --sort-options "--buffer-size=25%" --db2-config /dev/null --tmpdir /data/tmp $FILETYPE $DATAFILE 23 | 24 | bash $DIR/../../scripts/load-load-files.sh --db-engine shark $PARALLEL --sort-options "--buffer-size=25%" --db2-config /dev/null --tmpdir /data/tmp $FILETYPE $DATAFILE 25 | 26 | rm -rf /data/tmp 27 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/DropTableCommand.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class DropTableCommand implements SQLCommand { 14 | 15 | protected String table; 16 | 17 | public DropTableCommand(String table) { 18 | super(); 19 | this.table = table; 20 | } 21 | 22 | @Override 23 | public String toSQL() { 24 | return "DROP TABLE "+table; 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/runtime/service/sql/SingleRowResultSetProcessor.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.runtime.service.sql; 12 | 13 | import java.sql.Connection; 14 | import java.sql.ResultSet; 15 | import java.sql.SQLException; 16 | 17 | public interface SingleRowResultSetProcessor { 18 | 19 | E processRow( Connection conn, ResultSet rs) throws SQLException; 20 | 21 | } 22 | 23 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/PathMapper.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | 13 | public interface PathMapper { 14 | X visit(AltPath p); 15 | X visit(SeqPath p); 16 | X visit(NegatedProperySetPath p); 17 | X visit(SimplePath p); 18 | X visit(InvPath p); 19 | X visit(OneOrMorePath p); 20 | X visit(ZeroOrMorePath p); 21 | X visit(ZeroOrOnePath p); 22 | } 23 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/runtime/service/sql/SQLExceptionWrapper.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.runtime.service.sql; 12 | 13 | 14 | public class SQLExceptionWrapper extends RuntimeException { 15 | 16 | /** 17 | * 18 | */ 19 | private static final long serialVersionUID = 1L; 20 | 21 | public SQLExceptionWrapper(Throwable cause) { 22 | super(cause); 23 | } 24 | 25 | 26 | 27 | } 28 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/runtime/service/types/LangMap.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.runtime.service.types; 12 | 13 | public class LangMap { 14 | 15 | public final String langstring; 16 | public final short langcode; 17 | 18 | public LangMap(String langstring, short langcode) { 19 | super(); 20 | this.langstring = langstring; 21 | this.langcode = langcode; 22 | } 23 | 24 | 25 | } 26 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/query/Query.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.query; 12 | 13 | public interface Query { 14 | 15 | // Need to move more methods from sparql11.model.Query to this interface 16 | 17 | public boolean isSelectQuery() ; 18 | public boolean isAskQuery() ; 19 | public boolean isDescribeQuery() ; 20 | public boolean isConstructQuery() ; 21 | public boolean isDistinct(); 22 | 23 | } 24 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/PathVisitor.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | 13 | public interface PathVisitor { 14 | void visit(AltPath p); 15 | void visit(SeqPath p); 16 | void visit(NegatedProperySetPath p); 17 | void visit(SimplePath p); 18 | void visit(InvPath p); 19 | void visit(OneOrMorePath p); 20 | void visit(ZeroOrMorePath p); 21 | void visit(ZeroOrOnePath p); 22 | } 23 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/com/ibm/rdf/store/testing/RandomizedRepeat.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.rdf.store.testing; 12 | 13 | import java.lang.annotation.ElementType; 14 | import java.lang.annotation.Retention; 15 | import java.lang.annotation.RetentionPolicy; 16 | import java.lang.annotation.Target; 17 | 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Target( { ElementType.TYPE}) 20 | 21 | public @interface RandomizedRepeat { 22 | int value(); 23 | } 24 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q9GET2.sparql: -------------------------------------------------------------------------------- 1 | prefix fn: prefix x: 2 | prefix xs: 3 | 4 | function fn:getDrugBankNames GET ( -> ?x ) 5 | service fn:getDrugBankNames [ ] -> "//x:row" :: "./x:drug" "xs:string" 6 | 7 | function fn:getSMILES ( ?x -> ?y ) 8 | table fn:getSMILES [ "funcData" -> post data ] -> "//x:row" :: "./x:drug" "xs:string" "./x:smiles" "xs:string" 9 | 10 | function fn:computeChemSimilarity ( ?drug ?smiles -> ?a ?b ?c ) 11 | table fn:computeChemSimilarity [ "funcData" -> post data ] -> "//row" :: "./drug1" "xs:string" "./drug2" "xs:string" "./sim" "xs:number" 12 | 13 | select distinct ?drug ?drug1 ?similarity where { 14 | 15 | { select ?drug where { 16 | 17 | BIND( fn:getDrugBankNames() AS ( ?drug ) ) 18 | } limit 300 } 19 | 20 | BIND( fn:getSMILES( ?drug ) AS ( ?drug ?smiles ) ) 21 | 22 | BIND( fn:computeChemSimilarity(?drug ?smiles) AS (?drug ?drug1 ?similarity) ) 23 | 24 | } 25 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/OpenCursor.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class OpenCursor implements SQLCommand { 14 | 15 | protected String cursorName; 16 | 17 | 18 | public OpenCursor(String cursorName) { 19 | super(); 20 | this.cursorName = cursorName; 21 | } 22 | 23 | 24 | @Override 25 | public String toSQL() { 26 | //TODO: use templates 27 | return "OPEN "+cursorName; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/PROCQ6: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE GENPROC0 (IN STMT1 VARCHAR(10240), IN STMT2 VARCHAR(10240), IN STMT3 VARCHAR(10240), IN LEVEL INTEGER DEFAULT 1) 2 | DYNAMIC RESULT SETS 1 3 | P1: BEGIN 4 | DECLARE LOOPS INTEGER; 5 | DECLARE CNT INTEGER; 6 | DECLARE RCNT INTEGER; 7 | DECLARE C1 CURSOR WITH RETURN FOR S1; 8 | 9 | IF LEVEL = -1 THEN 10 | SET LOOPS = 65536; 11 | ELSE 12 | SET LOOPS = LEVEL; 13 | END IF; 14 | 15 | DECLARE GLOBAL TEMPORARY TABLE SESSION.TEMP(VAL BIGINT, LEVEL INTEGER) IN USERTEMP1 ON COMMIT DELETE ROWS WITH REPLACE NOT LOGGED; 16 | 17 | 18 | 19 | EXECUTE IMMEDIATE STMT1; 20 | 21 | GET DIAGNOSTICS RCNT = ROW_COUNT; 22 | SET CNT = 1; 23 | WHILE (CNT <= LOOPS AND RCNT > 0) DO 24 | 25 | PREPARE S2 FROM STMT2; 26 | EXECUTE S2 USING CNT - 1, CNT; 27 | 28 | GET DIAGNOSTICS RCNT = ROW_COUNT; 29 | SET CNT = CNT + 1; 30 | END WHILE; 31 | 32 | PREPARE S1 FROM STMT3; 33 | OPEN C1; 34 | END P1 -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/genproc0: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE GENPROC0 (IN STMT1 VARCHAR(10240), IN STMT2 VARCHAR(10240), IN STMT3 VARCHAR(10240), IN LEVEL INTEGER DEFAULT 1) 2 | DYNAMIC RESULT SETS 1 3 | P1: BEGIN 4 | DECLARE LOOPS INTEGER; 5 | DECLARE CNT INTEGER; 6 | DECLARE RCNT INTEGER; 7 | DECLARE C1 CURSOR WITH RETURN FOR S1; 8 | 9 | IF LEVEL = -1 THEN 10 | SET LOOPS = 65536; 11 | ELSE 12 | SET LOOPS = LEVEL; 13 | END IF; 14 | 15 | DECLARE GLOBAL TEMPORARY TABLE SESSION.TEMP(VAL BIGINT, LEVEL INTEGER) IN USERTEMP1 ON COMMIT DELETE ROWS WITH REPLACE NOT LOGGED; 16 | 17 | 18 | 19 | EXECUTE IMMEDIATE STMT1; 20 | 21 | GET DIAGNOSTICS RCNT = ROW_COUNT; 22 | SET CNT = 1; 23 | WHILE (CNT <= LOOPS AND RCNT > 0) DO 24 | 25 | PREPARE S2 FROM STMT2; 26 | EXECUTE S2 USING CNT - 1, CNT; 27 | 28 | GET DIAGNOSTICS RCNT = ROW_COUNT; 29 | SET CNT = CNT + 1; 30 | END WHILE; 31 | 32 | PREPARE S1 FROM STMT3; 33 | OPEN C1; 34 | END P1 -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/IExpressionTraversalListener.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | 13 | /** 14 | * interface for classes that are to be used to traverse the expression tree. Methods of this class are called during a traversal 15 | */ 16 | public interface IExpressionTraversalListener { 17 | public void startExpression(Expression e); 18 | public void endExpression(Expression e); 19 | } 20 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q9GET.sparql: -------------------------------------------------------------------------------- 1 | prefix fn: prefix x: 2 | prefix xs: 3 | 4 | function fn:getDrugBankNames GET ( -> ?x ) 5 | service fn:getDrugBankNames [ ] -> "//x:row" :: "./x:drug" "xs:string" 6 | 7 | function fn:getSMILES ( ?drug -> ?smiles ) 8 | table fn:getSMILES [ "funcData" -> post data ] -> "//x:row" :: "./x:drug" "xs:string" "./x:smiles" "xs:string" 9 | 10 | function fn:computeChemSimilarity ( ?drug ?smiles -> ?a ?b ?c ) 11 | table fn:computeChemSimilarity [ "funcData" -> post data ] -> "//row" :: "./@drug1" "xs:string" "./@drug2" "xs:string" "./@sim" "xs:number" 12 | 13 | select distinct ?drug ?drug1 ?similarity where { 14 | 15 | { select ?drug where { 16 | BIND( fn:getDrugBankNames() AS ( ?drug ) ) 17 | } limit 250 } 18 | 19 | BIND( fn:getSMILES( ?drug ) AS ( ?drug ?smiles ) ) 20 | 21 | BIND( fn:computeChemSimilarity(?drug ?smiles) AS (?drug ?drug1 ?similarity) ) 22 | 23 | } 24 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/CloseCursor.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class CloseCursor implements SQLCommand { 14 | 15 | protected String cursorName; 16 | 17 | 18 | public CloseCursor(String cursorName) { 19 | super(); 20 | this.cursorName = cursorName; 21 | } 22 | 23 | 24 | @Override 25 | public String toSQL() { 26 | //TODO: use templates 27 | return "CLOSE "+cursorName; 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /rdfstore-checker/.settings/org.eclipse.jdt.core.prefs,v: -------------------------------------------------------------------------------- 1 | head 1.1; 2 | access; 3 | symbols; 4 | locks; strict; 5 | comment @# @; 6 | 7 | 8 | 1.1 9 | date 2014.04.09.18.42.37; author dolby; state Exp; 10 | branches; 11 | next ; 12 | 13 | 14 | desc 15 | @@ 16 | 17 | 18 | 1.1 19 | log 20 | @beginnings of project to check dawg and queries using relational logic via kodkod 21 | @ 22 | text 23 | @eclipse.preferences.version=1 24 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 25 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7 26 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 27 | org.eclipse.jdt.core.compiler.compliance=1.7 28 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 29 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 30 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 31 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 32 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 33 | org.eclipse.jdt.core.compiler.source=1.7 34 | @ 35 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/DataLoader-test.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/DropStoreProcedure.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class DropStoreProcedure implements SQLCommand { 14 | 15 | protected String procedure; 16 | 17 | public DropStoreProcedure(String procedure) { 18 | super(); 19 | this.procedure = procedure; 20 | } 21 | 22 | @Override 23 | public String toSQL() { 24 | //TODO: use templates 25 | return "DROP PROCEDURE "+procedure; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/build-grammar.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/randomSample.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # replace with file to read 3 | NUM=$1 4 | FILE=$2 5 | 6 | if [[$FILE =~ .*bz2]] 7 | bzcat | shuf -n ${NUM} | awk '{print $1 > "/tmp/subject"; 8 | for (i = 3; i <= NF; i++) {printf("%s", $i) > "/tmp/object";} printf("%s\n", "") > "/tmp/object";}' 9 | else 10 | cat | shuf -n ${NUM} | awk '{print $1 > "/tmp/subject"; 11 | for (i = 3; i <= NF; i++) {printf("%s ", $i) > "/tmp/object";} printf("%s\n", "") > "/tmp/object";}' 12 | fi 13 | 14 | fgrep -f "/tmp/subject" $FILE | sort | uniq | statistics.awk 15 | fgrep -f "/tmp/object" $FILE |awk '{for (i = 3; i <= NF; i++) {printf("%s ", $i);} printf("%s", "|"); print $2 "|" $1;}' | sort -t "|" | uniq | statistics.awk 16 | 17 | cut -f2 -d " " $FILE | awk '{predicate[$0]=1;} END {for f in predicate) {print f}}' > /tmp/predicates 18 | 19 | # we need to call java with the set of predicates and the set of statistics 20 | # so we can compute the 'optimal schema' and output the .ddl, and the RDF 21 | # store parameters 22 | 23 | 24 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/NewVariableGenerator.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class NewVariableGenerator { 14 | 15 | protected String varPrefix; 16 | protected int suffix; 17 | public NewVariableGenerator(String varPrefix, int startSuffix) { 18 | super(); 19 | this.varPrefix = varPrefix; 20 | this.suffix = startSuffix; 21 | } 22 | 23 | public String createNewVariable() { 24 | return varPrefix+(suffix++); 25 | } 26 | 27 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/InvPath.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | 13 | public class InvPath extends UnaryPathOp { 14 | 15 | public InvPath(Path subPath) { 16 | super(subPath); 17 | } 18 | @Override 19 | public void visit(PathVisitor visitor) { 20 | visitor.visit(this); 21 | } 22 | @Override 23 | public X map(PathMapper visitor) { 24 | return visitor.visit(this); 25 | } 26 | 27 | 28 | 29 | } 30 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/sparql/rewriter/Substitution.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | 12 | package com.ibm.research.sparql.rewriter; 13 | 14 | import java.util.Map; 15 | 16 | import org.openrdf.query.algebra.Var; 17 | 18 | /** 19 | * @author Mariano Rodriguez 20 | * 21 | */ 22 | public interface Substitution { 23 | 24 | boolean compose(Var original, Var substituion); 25 | 26 | Var get(Var var); 27 | 28 | Map getMap(); 29 | 30 | public boolean isEmpty(); 31 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/SeqPath.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | 13 | public class SeqPath extends BinaryPathOp { 14 | 15 | public SeqPath(Path left, Path right) { 16 | super(left, right); 17 | } 18 | 19 | @Override 20 | public void visit(PathVisitor visitor) { 21 | visitor.visit(this); 22 | } 23 | @Override 24 | public X map(PathMapper visitor) { 25 | return visitor.visit(this); 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/jena/RdfStoreException.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.jena; 12 | 13 | public class RdfStoreException extends RuntimeException { 14 | 15 | public RdfStoreException(String msg) { 16 | super(msg); 17 | } 18 | 19 | public RdfStoreException() { 20 | super(); 21 | } 22 | 23 | public RdfStoreException(String string, Exception e) { 24 | super(string,e); 25 | } 26 | 27 | private static final long serialVersionUID = 1L; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlRExt/q1.sparql: -------------------------------------------------------------------------------- 1 | function testR (?a ?b -> ?c ?d ?e) language R { 2 | \SOP 3 | 4 | test1; 5 | \n 6 | \t 7 | "\thi\t\n" 8 | test2; test3; 9 | 10 | \EOP 11 | } 12 | 13 | function testR1 (?aa ?bb -> ?cc ?dd) language RR { 14 | { 15 | ?d a :Drug . 16 | ?c a :Disease . 17 | } 18 | } 19 | 20 | select ?d ?c ?p ?t where { 21 | 22 | { ?d ?p ?t } union { ?c ?p ?t } 23 | 24 | {select ?d ?c ?p1 ?p2 ?pn ?outcome (count(*) as ?freq) where { 25 | ?d a :Drug . 26 | ?c a :Disease . 27 | 28 | {select (1 as ?outcome) where { ?d :treats ?c }} union 29 | {select (-1 as ?outcome) where { ?d :isbadfor ?c }} . 30 | 31 | { ?d ?p1 ?c } union 32 | { ?d ?p1 _:x . _:x ?p2 ?c } 33 | 34 | BIND ( testR ( ?allgeos ?unemploymentRate ) AS ( ?allgeos ?forecastedUnemploymentRate ?avgForecastedRate )) 35 | 36 | BIND ( testR1 ( ?allgeos ?unemploymentRate ) AS ( ?forecastedUnemploymentRate ?avgForecastedRate )) 37 | 38 | } 39 | 40 | } filter (?predictedOutcome != ?outcome) } 41 | order by abs(?predictedOutcome - ?outcome) 42 | limit 100 43 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/test.nt: -------------------------------------------------------------------------------- 1 | "That Seventies Show"^^ . # literal with XML Schema string datatype 2 | "That Seventies Show" . # same as above 3 | "That Seventies Show"@en . # literal with a language tag 4 | "Cette Série des Années Septante"@fr-be . # literal outside of ASCII range with a region subtag 5 | "This is a multi-line\nliteral with many quotes (\"\"\"\"\")\nand two apostrophes ('')." . 6 | "2"^^ . # xsd:integer 7 | "1.663E-4"^^ . # xsd:double -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/hashing/HashingException.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.hashing; 12 | 13 | public class HashingException extends Exception { 14 | private static final long serialVersionUID = -2107064965806219851L; 15 | public HashingException() {} 16 | public HashingException(String message) { super(message); } 17 | public HashingException(Throwable cause) { super(cause); } 18 | public HashingException(String message, Throwable cause) { super(message, cause); } 19 | } 20 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/PROCQ7: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE GENPROC0 (IN STMT1 VARCHAR(10240), IN STMT2 VARCHAR(10240), IN STMT3 VARCHAR(10240), IN LEVEL INTEGER DEFAULT 1) 2 | DYNAMIC RESULT SETS 1 3 | P1: BEGIN 4 | DECLARE LOOPS INTEGER; 5 | DECLARE CNT INTEGER; 6 | DECLARE RCNT INTEGER; 7 | DECLARE C1 CURSOR WITH RETURN FOR S1; 8 | 9 | IF LEVEL = -1 THEN 10 | SET LOOPS = 65536; 11 | ELSE 12 | SET LOOPS = LEVEL; 13 | END IF; 14 | 15 | DECLARE GLOBAL TEMPORARY TABLE SESSION.TEMP(VAL BIGINT, LEVEL INTEGER) IN USERTEMP1 ON COMMIT DELETE ROWS WITH REPLACE NOT LOGGED; 16 | 17 | 18 | 19 | EXECUTE IMMEDIATE STMT1; 20 | 21 | GET DIAGNOSTICS RCNT = ROW_COUNT; 22 | SET CNT = 1; 23 | WHILE (CNT <= LOOPS AND RCNT > 0) DO 24 | CALL SYSPROC.ADMIN_CMD('RUNSTATS ON TABLE SESSION.TEMP ') ; 25 | 26 | PREPARE S2 FROM STMT2; 27 | EXECUTE S2 USING CNT - 1, CNT; 28 | 29 | GET DIAGNOSTICS RCNT = ROW_COUNT; 30 | SET CNT = CNT + 1; 31 | END WHILE; 32 | 33 | PREPARE S1 FROM STMT3; 34 | OPEN C1; 35 | END P1 -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/genproc2(): -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE PROCEDURE GENPROC2 (IN STMT1 VARCHAR(10240), IN STMT2 VARCHAR(10240), IN STMT3 VARCHAR(10240), IN LEVEL INTEGER DEFAULT 1) 2 | DYNAMIC RESULT SETS 1 3 | P1: BEGIN 4 | DECLARE LOOPS INTEGER; 5 | DECLARE CNT INTEGER; 6 | DECLARE RCNT INTEGER; 7 | DECLARE C1 CURSOR WITH RETURN FOR S1; 8 | 9 | IF LEVEL = -1 THEN 10 | SET LOOPS = 65536; 11 | ELSE 12 | SET LOOPS = LEVEL; 13 | END IF; 14 | 15 | DECLARE GLOBAL TEMPORARY TABLE SESSION.TEMP(VAL BIGINT, LEVEL INTEGER) IN USERTEMP1 ON COMMIT DELETE ROWS WITH REPLACE NOT LOGGED; 16 | 17 | 18 | 19 | EXECUTE IMMEDIATE STMT1; 20 | 21 | GET DIAGNOSTICS RCNT = ROW_COUNT; 22 | SET CNT = 1; 23 | WHILE (CNT <= LOOPS AND RCNT > 0) DO 24 | CALL SYSPROC.ADMIN_CMD('RUNSTATS ON TABLE SESSION.TEMP ') ; 25 | 26 | PREPARE S2 FROM STMT2; 27 | EXECUTE S2 USING CNT - 1, CNT; 28 | 29 | GET DIAGNOSTICS RCNT = ROW_COUNT; 30 | SET CNT = CNT + 1; 31 | END WHILE; 32 | 33 | PREPARE S1 FROM STMT3; 34 | OPEN C1; 35 | END P1 -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/hashing/GetPredicates.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.hashing; 12 | 13 | import java.io.File; 14 | import java.util.Set; 15 | 16 | public class GetPredicates { 17 | 18 | /** 19 | * @param args 20 | */ 21 | public static void main(String[] args) { 22 | String queryDir = args[0]; 23 | 24 | Set predicates = FindWorkloadProxies.getPredicates(new File(queryDir)); 25 | for(String s : predicates) { 26 | System.out.println(s); 27 | } 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/flatten_predicate.sh: -------------------------------------------------------------------------------- 1 | DIR=`dirname $0` 2 | 3 | ORIG_NT=$1 4 | SENSE=$2 5 | PARALLEL=$3 6 | 7 | shift; shift; shift 8 | 9 | PREDICATES="$@" 10 | 11 | FILES=$ORIG_NT.sorted_${SENSE}*primary.load* 12 | 13 | function make_command() { 14 | cmd="gawk -F '\t' $AWK_OPTS -v predicate=$1 -v addedCols=$2 -f $DIR/types.awk -f $DIR/strings.awk -f $DIR/flatten_predicate.awk $f" 15 | shift; shift 16 | 17 | while [[ $# > 0 ]]; do 18 | cmd="$cmd | gawk -F '\t' $AWK_OPTS -v predicate=$1 -v addedCols=$2 -f $DIR/types.awk -f $DIR/strings.awk -f $DIR/flatten_predicate.awk" 19 | shift; shift 20 | done 21 | } 22 | 23 | (for f in $FILES; do 24 | AWK_OPTS="-v direction=${SENSE}ect" 25 | 26 | if [[ -f $ORIG_NT.types ]]; then 27 | AWK_OPTS="$AWK_OPTS -v typeCodeFile=$ORIG_NT.types" 28 | fi 29 | 30 | SF=`echo $f | sed s/primary/secondary/` 31 | if [[ -f $SF ]]; then 32 | AWK_OPTS="$AWK_OPTS -v secondaryFile=$SF" 33 | make_command $PREDICATES 34 | 35 | echo "$cmd > $f.flatten" 36 | fi 37 | 38 | done) | xargs -d '\n' -n 1 -P $PARALLEL sh -c 39 | 40 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/com/ibm/rdf/store/testSuite/TestSuiteHelix2.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.rdf.store.testSuite; 12 | 13 | import org.junit.runner.RunWith; 14 | import org.junit.runners.Suite; 15 | 16 | import com.ibm.rdf.store.sparql11.LUBMQueryUtilityTest; 17 | 18 | @RunWith(Suite.class) 19 | @Suite.SuiteClasses( 20 | { 21 | LUBMQueryUtilityTest.DB2LUBM10MHelix1.class 22 | 23 | // 24 | }) 25 | public class TestSuiteHelix2 26 | { 27 | // the class remains empty, 28 | // used only as a holder for the above annotations 29 | } 30 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q8aGET.sparql: -------------------------------------------------------------------------------- 1 | 2 | prefix fn: 3 | prefix x: 4 | prefix xs: 5 | prefix drug: 6 | prefix up: 7 | 8 | function fn:getDrugBankNames GET ( -> ?x ) 9 | service fn:getDrugBankNames [ ] -> "//x:row" :: "./x:drug" "xs:string" 10 | 11 | function fn:getDrugTransporters GET ( ?x -> ?y ) 12 | service fn:getDrugTransporters [ "drugName" -> ?x ] -> "//x:row" :: "./x:id" "xs:string" 13 | 14 | function drug:getProteinGeneFunctions GET (?transporter -> ?geneFunction ?type) 15 | service CONCAT("http://www.uniprot.org/uniprot/", CONCAT(?transporter, ".xml")) [ ] -> "/up:uniprot/up:entry/up:dbReference" :: "./@id" "xs:string" "./@type" "xs:string" 16 | 17 | select ?drug ?geneFunction where 18 | { 19 | BIND( fn:getDrugBankNames() AS ( ?drug ) ) 20 | 21 | BIND( fn:getDrugTransporters( ?drug ) AS ( ?transporter ) ) 22 | 23 | BIND( drug:getProteinGeneFunctions(?transporter) AS (?geneFunction ?type) ) 24 | 25 | filter (?type = "GO") 26 | } -------------------------------------------------------------------------------- /rdfstore-checker/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/InsertIntoTable.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class InsertIntoTable implements SQLCommand { 14 | 15 | protected String table; 16 | protected String sql; 17 | 18 | 19 | public InsertIntoTable(String table, String sql) { 20 | super(); 21 | this.table = table; 22 | this.sql = sql; 23 | } 24 | 25 | @Override 26 | public String toSQL() { 27 | return "INSERT INTO "+table+"\n"+sql; 28 | } 29 | 30 | public String getSQLWithoutInsert() { 31 | return sql; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/com/ibm/rdf/store/testSuite/TestSuiteSP2B.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.rdf.store.testSuite; 12 | 13 | import org.junit.runner.RunWith; 14 | import org.junit.runners.Suite; 15 | 16 | import com.ibm.rdf.store.sparql11.SP2QueryUtilityTest; 17 | 18 | @RunWith(Suite.class) 19 | @Suite.SuiteClasses( 20 | { 21 | SP2QueryUtilityTest.PSQLSP2B1MHelix1.class, 22 | SP2QueryUtilityTest.DB2SP2B1MHelix1.class 23 | }) 24 | public class TestSuiteSP2B 25 | { 26 | // the class remains empty, 27 | // used only as a holder for the above annotations 28 | } 29 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/sql/psqlIsCastableFunction: -------------------------------------------------------------------------------- 1 | CREATE OR REPLACE FUNCTION db2inst1.isCastable(var text, xmlSchemaType text) RETURNS boolean AS $$ 2 | DECLARE x BOOLEAN; 3 | DECLARE y NUMERIC; 4 | DECLARE z TIMESTAMP WITH TIME ZONE; 5 | DECLARE m DATE; 6 | 7 | BEGIN 8 | IF xmlSchemaType = 'http://www.w3.org/2001/XMLSchema#boolean' THEN 9 | x := var::BOOLEAN; 10 | ELSIF xmlSchemaType = 'http://www.w3.org/2001/XMLSchema#integer' THEN 11 | y := var::NUMERIC(1000,0); 12 | ELSIF xmlSchemaType = 'http://www.w3.org/2001/XMLSchema#decimal' THEN 13 | y := var::DECIMAL; 14 | ELSIF xmlSchemaType = 'http://www.w3.org/2001/XMLSchema#float' THEN 15 | y := var::REAL; 16 | ELSIF xmlSchemaType = 'http://www.w3.org/2001/XMLSchema#double' THEN 17 | y := var::DOUBLE PRECISION; 18 | ELSIF xmlSchemaType = 'http://www.w3.org/2001/XMLSchema#dateTime' THEN 19 | z := var::TIMESTAMP WITH TIME ZONE; 20 | ELSIF xmlSchemaType = 'http://www.w3.org/2001/XMLSchema#date' THEN 21 | m := var::DATE; 22 | 23 | END IF; 24 | RETURN true; 25 | EXCEPTION WHEN others THEN 26 | RETURN false; 27 | END; 28 | $$ LANGUAGE plpgsql IMMUTABLE; -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/com/ibm/rdf/store/testSuite/TestSuiteJazz.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.rdf.store.testSuite; 12 | 13 | import org.junit.runner.RunWith; 14 | import org.junit.runners.Suite; 15 | 16 | import com.ibm.rdf.store.sparql11.JazzQueryUtilityTest; 17 | 18 | @RunWith(Suite.class) 19 | @Suite.SuiteClasses( 20 | { 21 | JazzQueryUtilityTest.PSQLJazzHelix1.class, 22 | JazzQueryUtilityTest.DB2JazzHelix1.class, 23 | }) 24 | public class TestSuiteJazz 25 | { 26 | // the class remains empty, 27 | // used only as a holder for the above annotations 28 | } 29 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/com/ibm/rdf/store/testSuite/TestSuiteLUBM.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.rdf.store.testSuite; 12 | 13 | import org.junit.runner.RunWith; 14 | import org.junit.runners.Suite; 15 | 16 | import com.ibm.rdf.store.sparql11.LUBMQueryUtilityTest; 17 | 18 | @RunWith(Suite.class) 19 | @Suite.SuiteClasses( 20 | { 21 | LUBMQueryUtilityTest.PSQLLUBM10MHelix1.class, 22 | LUBMQueryUtilityTest.DB2LUBM10MHelix1.class 23 | }) 24 | public class TestSuiteLUBM 25 | { 26 | // the class remains empty, 27 | // used only as a holder for the above annotations 28 | } 29 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/spark/files/init.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "Starting docker, this will take around 30 seconds" 4 | 5 | echo "Creating user $USER with id $USER_ID" 6 | useradd --uid $USER_ID --create-home $USER 7 | 8 | if [ -z ${AWS_ACCESS_KEY_ID+x} ] || [ -z ${AWS_SECRET_ACCESS_KEY+x} ] ; then 9 | echo 10 | else 11 | HDFS_SITE=" 12 | 13 | 14 | fs.s3a.access.key 15 | $AWS_ACCESS_KEY_ID 16 | 17 | 18 | fs.s3a.secret.key 19 | $AWS_SECRET_ACCESS_KEY 20 | 21 | 22 | " 23 | echo "$HDFS_SITE" > $HADOOP_CONF_DIR/hdfs-site.xml 24 | fi 25 | 26 | su $USER << EOF 27 | if [ ! -d "/data/hive/metastore_db" ]; then 28 | echo "Setting up metastore" 29 | cd /data/hive 30 | $HIVE_HOME/bin/schematool -dbType derby -initSchema 31 | cd 32 | fi 33 | 34 | $HIVE_HOME/hcatalog/sbin/hcat_server.sh start 35 | $SPARK_HOME/sbin/start-thriftserver.sh --master "local[4]" --conf "spark.sql.shuffle.partitions=4" 36 | sleep 20 37 | EOF 38 | 39 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/ZeroOrOnePath.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | 13 | public class ZeroOrOnePath extends UnaryPathOp { 14 | 15 | public ZeroOrOnePath(Path subPath) { 16 | super(subPath); 17 | } 18 | 19 | @Override 20 | public void visit(PathVisitor visitor) { 21 | visitor.visit(this); 22 | } 23 | @Override 24 | public X map(PathMapper visitor) { 25 | return visitor.visit(this); 26 | } 27 | @Override 28 | public boolean isDirectlyZeroOrOnePath() { 29 | return true; 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/query/QueryProcessor.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.query; 12 | 13 | import com.ibm.research.rdf.store.runtime.service.types.LiteralInfoResultSet; 14 | 15 | 16 | public interface QueryProcessor { 17 | 18 | public Query getQuery(); 19 | 20 | public LiteralInfoResultSet runTestSQL(String querySQL); 21 | 22 | public LiteralInfoResultSet execSelect() ; 23 | 24 | public boolean execAsk() ; 25 | 26 | public LiteralInfoResultSet execDescribe() ; 27 | 28 | public LiteralInfoResultSet execConstruct() ; 29 | 30 | 31 | } 32 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/hashing/IHashingFamily.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.hashing; 12 | 13 | /** 14 | * Interface that offers a method to hash strings to integers. 15 | */ 16 | public interface IHashingFamily { 17 | /** Returns a hash of string s. */ 18 | public int hash(String s, int HashId); 19 | // some hashing family sizes might be dependent on a specific predicate 20 | public int getFamilySize(String predicate); 21 | public void computeHash(String s); 22 | 23 | // Added for Single triple operations. 24 | public int[] getHash(String s); 25 | } 26 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/lubm/q7.sparql: -------------------------------------------------------------------------------- 1 | prefix ub: 2 | select distinct * 3 | where 4 | { 5 | { ?x a ub:UndergraduateStudent . ?y a ub:Course . ub:teacherOf ?y . ?x ub:takesCourse ?y . } 6 | union 7 | { ?x a ub:UndergraduateStudent . ?y a ub:GraduateCourse . ub:teacherOf ?y . ?x ub:takesCourse ?y . } 8 | union 9 | { ?x a ub:ResearchAssistant . ?y a ub:Course . ub:teacherOf ?y . ?x ub:takesCourse ?y . } 10 | union 11 | { ?x a ub:ResearchAssistant . ?y a ub:GraduateCourse . ub:teacherOf ?y . ?x ub:takesCourse ?y . } 12 | union 13 | { ?x a ub:GraduateStudent . ?y a ub:Course . ub:teacherOf ?y . ?x ub:takesCourse ?y . } 14 | union 15 | { ?x a ub:GraduateStudent . ?y a ub:GraduateCourse . ub:teacherOf ?y . ?x ub:takesCourse ?y . } 16 | } 17 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/AltPath.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | /** 13 | * Represent the property path expression: (path1 | path2) 14 | * @author fokoue 15 | * 16 | */ 17 | public class AltPath extends BinaryPathOp { 18 | 19 | public AltPath(Path left, Path right) { 20 | super(left, right); 21 | } 22 | 23 | @Override 24 | public X map(PathMapper visitor) { 25 | return visitor.visit(this); 26 | } 27 | 28 | @Override 29 | public void visit(PathVisitor visitor) { 30 | visitor.visit(this); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/postgresql/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu 2 | 3 | MAINTAINER Kavitha Srinivas 4 | 5 | RUN apt-get update && apt-get install -y python-software-properties software-properties-common postgresql postgresql-client postgresql-contrib \ 6 | && apt-get install -y default-jdk \ 7 | && apt-get install -y maven \ 8 | && apt-get install -y git \ 9 | && apt-get install -y gawk \ 10 | && apt-get install -y realpath \ 11 | && mkdir /data && chown -R postgres /data 12 | 13 | RUN echo debconf shared/accepted-oracle-license-v1-1 select true | \ 14 | sudo debconf-set-selections && sudo apt-get install -y oracle-java8-installer 15 | 16 | 17 | USER postgres 18 | 19 | # This image does nothing much other than set a volume where the data directory # is: i.e., where the nt file sits. For now the assumption is that 20 | # its unzipped and it exists in the /data dir. All temporary files get written 21 | # to that directory. 22 | 23 | WORKDIR /data 24 | 25 | RUN /etc/init.d/postgresql start \ 26 | && git clone https://github.com/Quetzal-RDF/quetzal \ 27 | && cd /data/quetzal/com.ibm.research.quetzal.core/ && mvn verify -DskipTests 28 | 29 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/ColoringFunction - uniprot.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/PrepareStatementCommand.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class PrepareStatementCommand implements SQLCommand { 14 | 15 | private String variableName; 16 | private String sqlStatement; 17 | 18 | public PrepareStatementCommand(String variableName, String sqlStatement) { 19 | super(); 20 | this.variableName = variableName; 21 | this.sqlStatement = sqlStatement; 22 | } 23 | 24 | @Override 25 | public String toSQL() { 26 | return "PREPARE "+ variableName+" FROM '"+sqlStatement.replace("'", "''")+"'"; 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/strings.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | defaultType = ""; 3 | } 4 | 5 | function reverse_str(str, new_str, i) { 6 | new_str = ""; 7 | for(i = length(str); i >= 1; i--) { 8 | new_str = new_str substr(str, i, 1); 9 | } 10 | return new_str; 11 | } 12 | 13 | function trimString(str) { 14 | return gensub(/^[[:space:]]*/, "", "", gensub(/[[:space:]]*$/, "", "", str)); 15 | } 16 | 17 | function fixBrackets(str) { 18 | if (index(str, "<") == 1) { 19 | return gensub(/^<([^>]*)+>$/, "\\1", "g", str); 20 | } else { 21 | return str; 22 | } 23 | } 24 | 25 | function parseLiteral(literal, result) { 26 | return match(literal, /^"(.*)"(\^\^<([^"]*)>|\@([^"]*))?$/, result); 27 | } 28 | 29 | function getString(a) { 30 | return a[1]; 31 | } 32 | 33 | function getType(a) { 34 | return a[3]; 35 | } 36 | 37 | function getLanguage(a) { 38 | return a[4]; 39 | } 40 | 41 | function getTag(a) { 42 | if (getLanguage(a) != "") { 43 | return getLanguage(a); 44 | } else if (getType(a) != "") { 45 | return getType(a); 46 | } else { 47 | return defaultType; 48 | } 49 | } 50 | 51 | 52 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/db2graph.all.sh: -------------------------------------------------------------------------------- 1 | # $1 resultFilePrefix 2 | 3 | 4 | # No global warm up, 5 rounds, 4 evaluations per query per round, local warm up 5 | ./db2graphTest.sh $1.NoGlobalWarmup.5Rounds.4EvalPerRound.localWarmup.csv 5 4 0 1 6 | 7 | # One global warm up, 20 rounds, 1 evaluation per query per round, no local warm up 8 | #./db2graphTest.sh $1.globalWarmup.20Rounds.1EvalPerRound.nolocalWarmup.csv 20 1 1 0 9 | 10 | 11 | # No global warm up, 2 rounds, 5 evaluation per query per round, local warm up 12 | #./db2graphTest.sh $1.NoGlobalWarmup.2Rounds.5EvalPerRound.localWarmup.csv 2 5 0 1 13 | 14 | # One global warm up, 10 rounds, 1 evaluation per query per round, no local warm up 15 | #./db2graphTest.sh $1.globalWarmup.10Rounds.1EvalPerRound.nolocalWarmup.csv 10 1 1 0 16 | 17 | 18 | # One global warm up, 55 rounds, 1 evaluation per query per round, no local warm up 19 | #./db2graphTest.sh $1.globalWarmup.55Rounds.1EvalPerRound.nolocalWarmup.csv 55 1 1 0 20 | 21 | # No global warm up, 11 rounds, 5 evaluations per query per round, local warm up 22 | #./db2graphTest.sh $1.NoGlobalWarmup.11Rounds.5EvalPerRound.localWarmup.csv 11 5 0 1 -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/sqltemplate/SQLMapping.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.sqltemplate; 12 | 13 | 14 | public class SQLMapping { 15 | String name=null; 16 | Object values=null; 17 | String separator=null; 18 | 19 | public SQLMapping(String name, Object values, String separator) { 20 | this.name = name; 21 | this.values = values; 22 | } 23 | 24 | public String getName() { 25 | return name; 26 | } 27 | 28 | public Object getValues() { 29 | return values; 30 | } 31 | 32 | public String toString() { 33 | return name + "->" + values; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/sparqlExtension/q6GET.sparql: -------------------------------------------------------------------------------- 1 | 2 | prefix fn: 3 | prefix x: 4 | prefix xs: 5 | prefix drug: 6 | prefix up: 7 | 8 | function fn:getDrugBankNames GET ( -> ?x ) 9 | service fn:getDrugBankNames [ ] -> "//x:row" :: "./x:drug" "xs:string" 10 | 11 | function fn:getDrugTransporters GET ( ?x -> ?y ) 12 | service fn:getDrugTransporters [ "drugName" -> ?x ] -> "//x:row" :: "./x:drug" "xs:string" "./x:id" "xs:string" 13 | 14 | function drug:getProteinGeneFunctions GET (?protein -> ?geneFunction ?type) 15 | service CONCAT("http://www.uniprot.org/uniprot/", CONCAT(?protein, ".xml")) [ ] -> "/up:uniprot/up:entry/up:dbReference" :: "./@id" "xs:string" "./@type" "xs:string" 16 | 17 | select distinct * where { 18 | 19 | { select distinct ?transporter where { 20 | 21 | BIND( fn:getDrugBankNames() AS ( ?drug ) ) 22 | 23 | BIND( fn:getDrugTransporters( ?drug ) AS ( ?drug ?transporter ) ) 24 | 25 | } } 26 | 27 | BIND( drug:getProteinGeneFunctions(?transporter) AS (?geneFunction ?type) ) 28 | 29 | filter (?type = "GO") 30 | } 31 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/TDBTestUOBM1.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/scriptjar.jardesc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /bigquery-loader/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/ScriptsOnlyUtility.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/owlql/NewVariableGenerator.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.owlql; 12 | 13 | /** 14 | * A generator of new fresh variables 15 | * @author achille 16 | * 17 | */ 18 | public class NewVariableGenerator { 19 | private String prefix; 20 | private int suffixCount; 21 | public NewVariableGenerator(String prefix) { 22 | this(prefix, 0); 23 | } 24 | public NewVariableGenerator(String prefix, int suffixCount) { 25 | super(); 26 | this.prefix = prefix; 27 | this.suffixCount = suffixCount; 28 | } 29 | 30 | public String createNewVariable(){ 31 | return prefix+(suffixCount++); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/CTEDefinition.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class CTEDefinition implements SQLCommand { 14 | 15 | private String name; 16 | private String sqlDef; 17 | 18 | public CTEDefinition(String name, String sqlDef) { 19 | super(); 20 | this.name = name; 21 | this.sqlDef = sqlDef; 22 | } 23 | 24 | public CTEDefinition(String name, String optionalCTESignature, String sqlDef) { 25 | this(name+(optionalCTESignature!=null?"("+optionalCTESignature+")":""), sqlDef); 26 | } 27 | 28 | @Override 29 | public String toSQL() { 30 | return name +" AS ("+sqlDef+")"; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/SingleGraphLoader-test.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/ZeroOrMorePath.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | 13 | public class ZeroOrMorePath extends UnaryPathOp { 14 | 15 | public ZeroOrMorePath(Path subPath) { 16 | super(subPath); 17 | } 18 | @Override 19 | public void visit(PathVisitor visitor) { 20 | visitor.visit(this); 21 | } 22 | @Override 23 | public X map(PathMapper visitor) { 24 | return visitor.visit(this); 25 | } 26 | /** 27 | *returns whether this path directly contains a "*" or "+" path modifier. 28 | * @return 29 | */ 30 | public boolean isDirectlyRecursive() { 31 | return true; 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/com/ibm/rdf/store/sparql11/DB2JazzNewTest.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.rdf.store.sparql11; 12 | 13 | import com.ibm.rdf.store.sparql11.TestRunner.DB2Engine; 14 | import com.ibm.rdf.store.sparql11.TestRunner.DB2TestData; 15 | 16 | import junit.framework.TestSuite; 17 | 18 | public class DB2JazzNewTest extends JazzNewTest { 19 | public static TestSuite suite() { 20 | TestSuite jazzTests = new TestSuite(); 21 | DB2TestData data = new DB2TestData("jdbc:db2://9.47.204.38:60000/Rational", "large", "db2inst1", "db2admin", "db2inst1", true); 22 | DB2Engine engine = new DB2Engine(); 23 | addTests(jazzTests, engine, data); 24 | return jazzTests; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/StoreProcedureDeclaration.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class StoreProcedureDeclaration implements SQLCommand { 14 | 15 | protected StoreProcedure procedure; 16 | protected boolean replace; 17 | 18 | public StoreProcedureDeclaration(StoreProcedure procedure) { 19 | this(procedure, true); 20 | } 21 | 22 | public StoreProcedureDeclaration(StoreProcedure procedure, boolean replace) { 23 | super(); 24 | this.procedure = procedure; 25 | this.replace = replace; 26 | } 27 | 28 | 29 | @Override 30 | public String toSQL() { 31 | return procedure.getSqlDeclarationCode(replace); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/DumpQuery.java: -------------------------------------------------------------------------------- 1 | package com.ibm.research.rdf.store.sparql11; 2 | 3 | import java.io.File; 4 | import java.io.IOException; 5 | 6 | import org.antlr.runtime.ANTLRFileStream; 7 | import org.antlr.runtime.ANTLRStringStream; 8 | import org.antlr.runtime.RecognitionException; 9 | import org.antlr.runtime.tree.BufferedTreeNodeStream; 10 | import org.json.JSONException; 11 | import org.json.JSONObject; 12 | 13 | public class DumpQuery { 14 | 15 | public static void main(String[] args) throws RecognitionException, IOException, JSONException { 16 | System.err.println(queryToJSON(args[0])); 17 | } 18 | 19 | public static JSONObject queryToJSON(String query) throws IOException, 20 | RecognitionException, JSONException { 21 | ANTLRStringStream sparql; 22 | if (new File(query).exists()) { 23 | sparql = new ANTLRFileStream(query, "UTF8"); 24 | } else { 25 | System.err.println(query); 26 | sparql = new ANTLRStringStream(query); 27 | } 28 | 29 | XTree ast = SparqlParserUtilities.getParseTree(sparql); 30 | JSONWriter writer = new JSONWriter(new BufferedTreeNodeStream(ast)); 31 | JSONObject jsonOutput = writer.queryUnit(); 32 | return jsonOutput; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /rdfstore-checker/source/com/ibm/research/rdf/store/sparql11/semantics/ComparisonUniverse.java: -------------------------------------------------------------------------------- 1 | package com.ibm.research.rdf.store.sparql11.semantics; 2 | 3 | import java.net.URISyntaxException; 4 | import java.net.URL; 5 | import java.util.Set; 6 | 7 | import org.apache.jena.riot.Lang; 8 | import org.apache.jena.riot.RDFDataMgr; 9 | 10 | import org.apache.jena.query.Dataset; 11 | 12 | import kodkod.ast.Relation; 13 | import kodkod.instance.Bounds; 14 | import kodkod.instance.TupleFactory; 15 | 16 | public class ComparisonUniverse extends BoundedUniverse { 17 | private final Dataset datasetModel; 18 | 19 | public ComparisonUniverse(URL datasetURL) throws URISyntaxException { 20 | initDataset(datasetModel = RDFDataMgr.loadDataset( 21 | datasetURL.toExternalForm(), 22 | datasetURL.getPath().endsWith(".nq")? Lang.NQUADS: Lang.NTRIPLES)); 23 | } 24 | 25 | @Override 26 | protected void boundDataSet(Set liveRelations, TupleFactory tf, 27 | Bounds b, Set liveAtoms) throws URISyntaxException { 28 | boundExactly(liveRelations, liveAtoms, b, QuadTableRelations.desiredQuads, relationTableBound(tf, datasetModel.asDatasetGraph().find(), liveAtoms)); 29 | super.boundDataSet(liveRelations, tf, b, liveAtoms); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/TDBTestDBpedia37_RC2.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/TDBTestSP2B100M_R_RC2.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/TDBTestJazzOptimizedStore.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/Reversed100M_WithOWLQLCompilation.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/proppaths/DeclareTempTableCommand.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.proppaths; 12 | 13 | public class DeclareTempTableCommand implements SQLCommand { 14 | 15 | protected String tmpSpace; 16 | protected String table; 17 | protected String tableSignature; 18 | 19 | 20 | public DeclareTempTableCommand(String tmpSpace, String table, String tableSignature) { 21 | super(); 22 | this.tmpSpace = tmpSpace; 23 | this.table = table; 24 | this.tableSignature = tableSignature; 25 | } 26 | 27 | 28 | @Override 29 | public String toSQL() { 30 | return "DECLARE GLOBAL TEMPORARY TABLE "+ table+ "("+tableSignature+") ON COMMIT PRESERVE ROWS NOT LOGGED IN "+tmpSpace; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /rdfstore-checker/source/com/ibm/research/rdf/store/sparql11/semantics/OpenDatasetUniverse.java: -------------------------------------------------------------------------------- 1 | package com.ibm.research.rdf.store.sparql11.semantics; 2 | 3 | import java.net.URISyntaxException; 4 | import java.net.URL; 5 | import java.util.Set; 6 | 7 | import org.apache.jena.riot.Lang; 8 | import org.apache.jena.riot.RDFDataMgr; 9 | 10 | import org.apache.jena.query.Dataset; 11 | 12 | import kodkod.ast.Relation; 13 | import kodkod.instance.Bounds; 14 | import kodkod.instance.TupleFactory; 15 | 16 | public class OpenDatasetUniverse extends BoundedUniverse { 17 | private final Dataset datasetModel; 18 | 19 | public OpenDatasetUniverse(URL datasetURL) throws URISyntaxException { 20 | super(); 21 | datasetModel = 22 | RDFDataMgr.loadDataset( 23 | datasetURL.toExternalForm(), 24 | datasetURL.getPath().endsWith(".nq")? Lang.NQUADS: Lang.NTRIPLES); 25 | initDataset(datasetModel); 26 | } 27 | 28 | @Override 29 | protected void boundDataSet(Set liveRelations, final TupleFactory f, 30 | Bounds b, Set liveAtoms) throws URISyntaxException { 31 | LazyTupleSet s = dataSetCrossProduct(f); 32 | bound(liveRelations, liveAtoms, b, QuadTableRelations.quads, relationTableBound(f, datasetModel.asDatasetGraph().find(), liveAtoms), s); 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/jena/impl/DB2QuerySolutionImpl.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.jena.impl; 12 | 13 | import java.util.Iterator; 14 | import java.util.Map; 15 | 16 | import org.apache.jena.query.QuerySolution; 17 | import org.apache.jena.query.QuerySolutionMap; 18 | import org.apache.jena.rdf.model.RDFNode; 19 | 20 | public class DB2QuerySolutionImpl extends QuerySolutionMap implements QuerySolution { 21 | public DB2QuerySolutionImpl(Map resultMap) { 22 | Iterator variables = resultMap.keySet().iterator(); 23 | 24 | while (variables.hasNext()) { 25 | String variable = variables.next(); 26 | 27 | add (variable, resultMap.get(variable)); 28 | } 29 | } 30 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/sparql11/model/OneOrMorePath.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.rdf.store.sparql11.model; 12 | 13 | public class OneOrMorePath extends UnaryPathOp { 14 | 15 | public OneOrMorePath(Path subPath) { 16 | super(subPath); 17 | // TODO Auto-generated constructor stub 18 | } 19 | @Override 20 | public void visit(PathVisitor visitor) { 21 | visitor.visit(this); 22 | } 23 | 24 | /** 25 | *returns whether this path directly contains a "*" or "+" path modifier. 26 | * @return 27 | */ 28 | public boolean isDirectlyRecursive() { 29 | return true; 30 | } 31 | @Override 32 | public X map(PathMapper visitor) { 33 | return visitor.visit(this); 34 | } 35 | 36 | 37 | } 38 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/sparql/rewriter/NeutralSubstitutionForJena.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | 12 | package com.ibm.research.sparql.rewriter; 13 | 14 | import java.util.HashMap; 15 | import java.util.Map; 16 | 17 | import org.apache.jena.graph.Node; 18 | 19 | 20 | 21 | public class NeutralSubstitutionForJena implements SubstitutionForJena { 22 | 23 | @Override 24 | public boolean compose(Node original, Node substituion) { 25 | throw new UnsupportedOperationException(); 26 | } 27 | 28 | @Override 29 | public Node get(Node Node) { 30 | return null; 31 | } 32 | 33 | @Override 34 | public Map getMap() { 35 | return new HashMap(); 36 | } 37 | 38 | public boolean isEmpty() { 39 | return true; 40 | } 41 | 42 | } -------------------------------------------------------------------------------- /DrugPairGOSimilarity/man/DrugPairGOSimilarity-package.Rd: -------------------------------------------------------------------------------- 1 | \name{DrugPairGOSimilarity-package} 2 | \alias{DrugPairGOSimilarity-package} 3 | \alias{DrugPairGOSimilarity} 4 | \docType{package} 5 | \title{ 6 | What the package does (short line) 7 | ~~ package title ~~ 8 | } 9 | \description{ 10 | More about what it does (maybe more than one line) 11 | ~~ A concise (1-5 lines) description of the package ~~ 12 | } 13 | \details{ 14 | \tabular{ll}{ 15 | Package: \tab DrugPairGOSimilarity\cr 16 | Type: \tab Package\cr 17 | Version: \tab 1.0\cr 18 | Date: \tab 2016-03-02\cr 19 | License: \tab What license is it under?\cr 20 | } 21 | ~~ An overview of how to use the package, including the most important functions ~~ 22 | } 23 | \author{ 24 | Who wrote it 25 | 26 | Maintainer: Who to complain to 27 | ~~ The author and/or maintainer of the package ~~ 28 | } 29 | \references{ 30 | ~~ Literature or other references for background information ~~ 31 | } 32 | ~~ Optionally other standard keywords, one per line, from file KEYWORDS in the R ~~ 33 | ~~ documentation directory ~~ 34 | \keyword{ package } 35 | \seealso{ 36 | ~~ Optional links to other man pages, e.g. ~~ 37 | ~~ \code{\link[:-package]{}} ~~ 38 | } 39 | \examples{ 40 | ~~ simple examples of the most important functions ~~ 41 | } 42 | -------------------------------------------------------------------------------- /rdfstore-checker/launchers/Drivers$DumpUniverse.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/DataLoaderTest.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/test/com/ibm/rdf/store/sparql11/TestSuiteUOBMALLQueries.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.rdf.store.sparql11; 12 | 13 | import org.junit.runner.RunWith; 14 | import org.junit.runners.Suite; 15 | 16 | @RunWith(Suite.class) 17 | @Suite.SuiteClasses( 18 | { 19 | UOBMQueryUtilityTest.PSQLUOBM30MALLPropPathsExpHelix1.class, //currently failing 20 | UOBMQueryUtilityTest.DB2UOBM30MALLPropPathsExp.class, 21 | 22 | //property path tests 23 | UOBMQueryUtilityTest.PSQLUOBM30MALLPropPathsHelix.class, // currently failing 24 | UOBMQueryUtilityTest.DB2UOBM30ALLPropPaths.class, 25 | 26 | }) 27 | public class TestSuiteUOBMALLQueries 28 | { 29 | // the class remains empty, 30 | // used only as a holder for the above annotations 31 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/StatisticsLoader.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/RRCQueryFileParser.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/sparql/rewriter/SubstitutionApplierForJena.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | 12 | package com.ibm.research.sparql.rewriter; 13 | 14 | import org.apache.jena.graph.Node; 15 | import org.apache.jena.sparql.graph.NodeTransform; 16 | 17 | 18 | 19 | /** 20 | * @author Kavitha Srinivas 21 | * @author Mariano Rodriguez 22 | * 23 | */public class SubstitutionApplierForJena implements NodeTransform { 24 | 25 | SubstitutionForJena s; 26 | 27 | public SubstitutionApplierForJena(SubstitutionForJena s) { 28 | this.s = s; 29 | } 30 | 31 | @Override 32 | public Node apply(Node node) { 33 | Node node2 = s.get(node); 34 | if (node2 != null) 35 | return node2; 36 | return node; 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/scripts/paths.awk: -------------------------------------------------------------------------------- 1 | 2 | function read_outgoing_edges() { 3 | delete current_edges; 4 | 5 | delete a; 6 | parse_for_elements(current_triple, a); 7 | current_subject = a["subject"]; 8 | current_edges[a["predicate"]][a["object"]] = 1; 9 | 10 | do { 11 | ret = getline current_triple < bySubjectFile; 12 | if (ret <= 0) { 13 | return -1; 14 | } 15 | 16 | delete a; 17 | parse_for_elements(current_triple, a); 18 | 19 | if (a["subject"] != current_subject) { 20 | break; 21 | } 22 | 23 | current_edges[a["predicate"]][a["object"]] = 1; 24 | } while (1==1); 25 | 26 | return 1; 27 | } 28 | 29 | BEGIN { 30 | getline current_triple < bySubjectFile; 31 | read_outgoing_edges(); 32 | } 33 | 34 | { 35 | delete elts; 36 | parse_for_elements($0, elts); 37 | 38 | obj = elts["object"]; 39 | 40 | while (obj > current_subject) { 41 | code = read_outgoing_edges(); 42 | if (code < 0) { 43 | next; 44 | } 45 | } 46 | 47 | if (obj == current_subject) { 48 | for(pred in current_edges) { 49 | for (obj in current_edges[pred]) { 50 | print elts["subject"] " " substr(elts["predicate"], 1, length(elts["predicate"])-1) "," substr(pred, 2) " " obj; 51 | } 52 | } 53 | 54 | } else if (obj < current_subject) { 55 | next; 56 | } 57 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/rdf/store/utilities/NamespaceResolver.java: -------------------------------------------------------------------------------- 1 | package com.ibm.research.rdf.store.utilities; 2 | 3 | import java.util.HashMap; 4 | import java.util.Iterator; 5 | import java.util.Map; 6 | 7 | import javax.xml.XMLConstants; 8 | import javax.xml.namespace.NamespaceContext; 9 | 10 | public class NamespaceResolver implements NamespaceContext { 11 | 12 | private Map namespaces = new HashMap(); 13 | 14 | public NamespaceResolver(Map namespaces) { 15 | this.namespaces = namespaces; 16 | } 17 | public String getNamespaceURI(String prefix) { 18 | if (prefix == null) { 19 | throw new IllegalArgumentException("No prefix provided!"); 20 | } else if (namespaces.containsKey(prefix)) { 21 | return namespaces.get(prefix); 22 | } else { 23 | return XMLConstants.DEFAULT_NS_PREFIX; 24 | } 25 | } 26 | 27 | public String getPrefix(String namespaceURI) { 28 | // Not needed in this context. 29 | return null; 30 | } 31 | 32 | public Iterator getPrefixes(String namespaceURI) { 33 | // Not needed in this context. 34 | return null; 35 | } 36 | 37 | public String toString() { 38 | return namespaces.toString(); 39 | } 40 | 41 | } -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/src/com/ibm/research/owlql/ruleref/IRDFStoreDBSchemaProcessor.java: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * Copyright (c) 2015 IBM Corporation. 3 | * All rights reserved. This program and the accompanying materials 4 | * are made available under the terms of the Eclipse Public License v1.0 5 | * which accompanies this distribution, and is available at 6 | * http://www.eclipse.org/legal/epl-v10.html 7 | * 8 | * Contributors: 9 | * IBM Corporation - initial API and implementation 10 | *****************************************************************************/ 11 | package com.ibm.research.owlql.ruleref; 12 | 13 | import com.ibm.research.owlql.rule.Predicate; 14 | import com.ibm.research.owlql.rule.RuleSystem; 15 | 16 | public interface IRDFStoreDBSchemaProcessor { 17 | 18 | 19 | public void setRuleSystem(RuleSystem rs); 20 | public RuleSystem convertDLPredicateToDBTablePredicate(); 21 | 22 | /** 23 | * definition of a table with a single column and a single row. 24 | * We use that table to add in sql 25 | * query select statement that return a single constant value 26 | * (e.g select 3 from singletonTable) 27 | */ 28 | public CreatableTable getSingletonTable(); 29 | 30 | public CreatableTable getDBTable(Predicate p); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/docker/postgresql/runLoadPostgres.sh~: -------------------------------------------------------------------------------- 1 | export PROCESSOR=`cat /proc/cpuinfo | grep 'processor' | wc -l` 2 | 3 | if [[ x$CREATE_DB == "xtrue" ]]; then 4 | psql -h $POSTGRES_PORT_5432_TCP_ADDR -p $POSTGRES_PORT_5432_TCP_PORT --command "CREATE USER quetzal WITH SUPERUSER PASSWORD 'quetzalcoatl';" 5 | psql -h $POSTGRES_PORT_5432_TCP_ADDR -p $POSTGRES_PORT_5432_TCP_PORT --command "CREATE DATABASE quetzal WITH OWNER=quetzal;" 6 | fi 7 | 8 | if ls *.nt; then 9 | export DATAFILE=`ls *.nt` 10 | export FILETYPE=nt 11 | else 12 | export DATAFILE=`ls *.nq` 13 | export FILETYPE=nq 14 | fi 15 | 16 | export DB2_HOST=$POSTGRES_PORT_5432_TCP_ADDR 17 | export DB2_PORT=$POSTGRES_PORT_5432_TCP_PORT 18 | export DB2_DB=quetzal 19 | export DB2_USER=quetzal 20 | export DB2_PASSWORD=quetzalcoatl 21 | export DB2_SCHEMA=quetzal 22 | export KNOWLEDGE_BASE=kb 23 | 24 | echo $FILETYPE 25 | echo $DATAFILE 26 | 27 | bash /sparqltosqlbase/scripts/build-load-files.sh --db-engine postgresql --parallel $PROCESSOR --sort-options "--buffer-size=25%" --db2-config /dev/null --tmpdir /data/tmp $FILETYPE $DATAFILE 28 | 29 | bash /sparqltosqlbase/scripts/load-load-files.sh --db-engine postgresql --parallel $PROCESSOR --sort-options "--buffer-size=25%" --db2-config /dev/null --tmpdir /data/tmp $FILETYPE $DATAFILE 30 | 31 | rm -rf /data/tmp -------------------------------------------------------------------------------- /com.ibm.research.quetzal.core/launches/DebugDataLoader.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | --------------------------------------------------------------------------------