Best JavaScript code snippet using argos
rdf4j.service.ts
Source:rdf4j.service.ts
...38 }39 console.log('Endpoint URL: ' + this.endpointUrl);40 }41 query(query: string): Observable<any[]> {42 const url = this.getRepositoryUrl();43 return this.http.post(url, query, httpOptionsQuery).pipe(map(res => this.bindingsToArray(res)));44 }45 getTimelines(): Observable<Timeline[]> {46 const url = this.getRepositoryUrl();47 const q = this.getPrefixes() +48 `SELECT DISTINCT ?uri ?sourceId ?label49 WHERE {50 ?uri rdf:type ta:Timeline .51 ?uri ta:sourceId ?sourceId .52 ?uri rdfs:label ?label53 }`;54 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToTimelines(res)));55 }56 getMinDate(t: Timeline[]): Observable<Date> {57 const url = this.getRepositoryUrl();58 let values = 'VALUES ?src {';59 for (let i = 0; i < t.length; i++) {60 values += '<' + t[i].uri + '> ';61 }62 values += '}';63 const q = this.getPrefixes() +64 `SELECT ?o65 WHERE {66 ${values}67 ?s ta:timestamp ?o .68 ?s ta:sourceTimeline ?src .69 ?s rdf:type ?etype .70 ?etype rdfs:subClassOf ta:Event .71 }72 ORDER BY ASC(?o)73 LIMIT 1`;74 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToDate(res)));75 }76 getMaxDate(t: Timeline[]): Observable<Date> {77 const url = this.getRepositoryUrl();78 let values = 'VALUES ?src {';79 for (let i = 0; i < t.length; i++) {80 values += '<' + t[i].uri + '> ';81 }82 values += '}';83 const q = this.getPrefixes() +84 `SELECT ?o85 WHERE {86 ${values}87 ?s ta:timestamp ?o .88 ?s ta:sourceTimeline ?src .89 ?s rdf:type ?etype .90 ?etype rdfs:subClassOf ta:Event .91 }92 ORDER BY DESC(?o)93 LIMIT 1`;94 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToDate(res)));95 }96 getEvents(t: Timeline, startDate: Date, endDate: Date, limit: number): Observable<Event[]> {97 const url = this.getRepositoryUrl();98 const q = this.getPrefixes() +99 `SELECT ?uri ?time ?label100 WHERE {101 ?etype rdfs:subClassOf ta:Event .102 ?uri ta:sourceTimeline <${t.uri}> .103 ?uri rdf:type ?etype .104 ?uri ta:timestamp ?time .105 OPTIONAL {?uri rdfs:label ?label}106 FILTER (?time >= "${startDate.toISOString()}"^^xsd:dateTime && ?time <= "${endDate.toISOString()}"^^xsd:dateTime)107 } ORDER BY ASC(?time)108 LIMIT ${limit}`;109 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToEvents(res, t)));110 }111 getEventsForObject(objectUri: string): Observable<Event[]> {112 const url = this.getRepositoryUrl();113 const q = this.getPrefixes() +114 `SELECT ?uri ?time ?label ?timeline ?tlid115 WHERE {116 ?etype rdfs:subClassOf ta:Event .117 ?uri ta:refersTo <${objectUri}> .118 ?uri rdf:type ?etype .119 ?uri ta:timestamp ?time .120 ?uri ta:sourceTimeline ?timeline .121 ?timeline rdfs:label ?tlid .122 OPTIONAL {?uri rdfs:label ?label}123 } ORDER BY ASC(?time)`;124 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToEvents(res, null)));125 }126 getReferredObjectUris(eventUri: string): Observable<string[]> {127 const url = this.getRepositoryUrl();128 const q = this.getPrefixes() +129 `SELECT ?s130 WHERE {131 <${eventUri}> ta:refersTo ?s132 }`;133 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToStrings(res)));134 }135 getReferredObjects(eventUri: string): Observable<TAObject[]> {136 const url = this.getRepositoryUrl();137 const q = this.getPrefixes() +138 `SELECT DISTINCT ?o ?type ?sourceId ?fileName ?path ?refUrl ?refTitle139 WHERE {140 VALUES ?src { <${eventUri}> }141 ?src ta:refersTo ?o .142 ?o rdf:type ?type .143 OPTIONAL { ?o ta:sourceId ?sourceId }144 OPTIONAL { ?o ta:fileName ?fileName . ?o ta:path ?path }145 OPTIONAL { ?o ta:sourceUrl ?refUrl . OPTIONAL {?o ta:resourceTitle ?refTitle} }146 }`;147 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToObjects(res)));148 }149 getObjectData(objectUri: string): Observable<TAObject[]> {150 const url = this.getRepositoryUrl();151 const q = this.getPrefixes() +152 `SELECT DISTINCT ?o ?type ?sourceId ?fileName ?path ?refUrl ?refTitle153 WHERE {154 VALUES ?o { <${objectUri}> }155 ?o rdf:type ?type .156 OPTIONAL { ?o ta:sourceId ?sourceId }157 OPTIONAL { ?o ta:fileName ?fileName . ?o ta:path ?path }158 OPTIONAL { ?o ta:sourceUrl ?refUrl . OPTIONAL {?o ta:resourceTitle ?refTitle} }159 }`;160 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToObjects(res)));161 }162 getContentsForEntry(entry: Entry): Observable<any[]> {163 const repo = this.getRepositoryUrl();164 const q = this.getPrefixes() +165 `SELECT ?s ?type ?text ?resUri166 WHERE {167 <${entry.uri}> ta:contains ?s .168 ?s rdf:type ?type .169 OPTIONAL { ?s ta:text ?text }170 OPTIONAL { ?s ta:linksResource ?resUri }171 }`;172 return this.http.post(repo, q, httpOptionsQuery).pipe(map(res => this.bindingsToArray(res)));173 }174 getContentsForEntryById(entryId: string): Observable<any[]> {175 const repo = this.getRepositoryUrl();176 const q = this.getPrefixes()177 + 'SELECT ?s ?text ?resUri ?type'178 + ' WHERE {'179 + ' ?entry ta:contains ?s'180 + ' . ?entry ta:sourceId ?id'181 + ' . ?entry rdf:type ?type'182 + ' . OPTIONAL { ?s ta:text ?text }'183 + ' . OPTIONAL { ?s ta:linksResource ?resUri }'184 + ' FILTER( ?id = "' + entryId + '" )'185 + ' }';186 return this.http.post(repo, q, httpOptionsQuery).pipe(map(res => this.bindingsToArray(res)));187 }188 getURLPrefixes(): Observable<string[]> {189 const url = this.getRepositoryUrl();190 const q = this.getPrefixes() +191 `SELECT DISTINCT (STRBEFORE(?u,":") as ?s)192 WHERE {193 ?r rdf:type ta:WebResource .194 ?r ta:sourceUrl ?u195 }`;196 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToStrings(res)));197 }198 getURLsFiltered(prefix: string, contents: string): Observable<string[]> {199 const url = this.getRepositoryUrl();200 let filter = 'contains(?s, "' + contents + '")';201 if (prefix !== '*') {202 filter += ' && strStarts(?s, "' + prefix + '")';203 }204 const q = this.getPrefixes() +205 `SELECT DISTINCT ?s206 WHERE {207 ?u rdf:type ta:WebResource .208 ?u ta:sourceUrl ?s209 FILTER(${filter})210 }211 LIMIT 20`;212 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToStrings(res)));213 }214 getResourcesForURL(urlstring: string): Observable<string[]> {215 const url = this.getRepositoryUrl();216 const q = this.getPrefixes() +217 `SELECT DISTINCT ?s218 WHERE {219 ?s rdf:type ta:WebResource .220 ?s ta:sourceUrl ?url221 FILTER(?url='${urlstring}')222 }223 LIMIT 20`;224 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToStrings(res)));225 }226 getPathsFiltered(pathPrefix: string, name: string): Observable<string[]> {227 const url = this.getRepositoryUrl();228 let filter = '';229 if (name !== '') {230 filter = 'contains(?name, "' + name + '")';231 }232 if (pathPrefix !== '') {233 if (filter !== '') {234 filter += ' && ';235 }236 filter += 'strStarts(?s, "' + pathPrefix + '")';237 }238 const q = this.getPrefixes() +239 `SELECT DISTINCT ?s240 WHERE {241 ?u rdf:type ta:LocalFile .242 ?u ta:path ?s .243 ?u ta:fileName ?name244 FILTER(${filter})245 }246 LIMIT 20`;247 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToStrings(res)));248 }249 getResourcesForPath(path: string): Observable<string[]> {250 const url = this.getRepositoryUrl();251 const q = this.getPrefixes() +252 `SELECT DISTINCT ?s253 WHERE {254 ?s rdf:type ta:LocalFile .255 ?s ta:path ?path256 FILTER(?path='${path}')257 }258 LIMIT 20`;259 return this.http.post(url, q, httpOptionsQuery).pipe(map(res => this.bindingsToStrings(res)));260 }261 // =========================================================================262 private getRepositoryUrl(): string {263 return this.endpointUrl + '/repositories/' + this.repositoryName;264 }265 private getPrefixes(): string {266 let ret = '';267 for (const ns in this.ns) {268 if (this.ns.hasOwnProperty(ns)) {269 ret += 'PREFIX ' + ns + ': <' + this.ns[ns] + '>\n';270 }271 }272 return ret;273 }274 // =========================================================================275 private bindingsToStrings(res: any): string[] {276 const bindings = res.results.bindings;...
github.test.ts
Source:github.test.ts
1import { GithubDatabaseEntry, GithubEntry } from "./github";2import "isomorphic-unfetch";3/* eslint-env jest */4const testDbEntry: GithubDatabaseEntry = {5 type: "github",6 desc: "A entry for testing",7 owner: "octocat",8 repo: "test-repo1",9 // eslint-disable-next-line @typescript-eslint/camelcase10 default_version: "master",11};12const testEntry = new GithubEntry(testDbEntry);13test("source url", () => {14 expect(testEntry.getSourceURL("/index.js", "1.0")).toEqual(15 "https://raw.githubusercontent.com/octocat/test-repo1/1.0/index.js"16 );17});18test("source url with default version", () => {19 expect(testEntry.getSourceURL("/index.js", undefined)).toEqual(20 "https://raw.githubusercontent.com/octocat/test-repo1/master/index.js"21 );22});23test("source url with custom default version", () => {24 expect(25 new GithubEntry({26 ...testDbEntry,27 // eslint-disable-next-line @typescript-eslint/camelcase28 default_version: "custom",29 }).getRepositoryURL("/index.js", undefined)30 ).toEqual("https://github.com/octocat/test-repo1/tree/custom/index.js");31});32test("source url with empty path", () => {33 expect(testEntry.getSourceURL("", "1.0")).toEqual(34 "https://raw.githubusercontent.com/octocat/test-repo1/1.0"35 );36});37test("source url with subdirectory", () => {38 expect(39 new GithubEntry({40 ...testDbEntry,41 path: "/test",42 }).getSourceURL("/index.js", "1.0")43 ).toEqual(44 "https://raw.githubusercontent.com/octocat/test-repo1/1.0/test/index.js"45 );46});47test("repo url", () => {48 expect(testEntry.getRepositoryURL("/index.js", "1.0")).toEqual(49 "https://github.com/octocat/test-repo1/tree/1.0/index.js"50 );51});52test("repo url with default version", () => {53 expect(testEntry.getRepositoryURL("/index.js", undefined)).toEqual(54 "https://github.com/octocat/test-repo1/tree/master/index.js"55 );56});57test("repo url with custom default version", () => {58 expect(59 new GithubEntry({60 ...testDbEntry,61 // eslint-disable-next-line @typescript-eslint/camelcase62 default_version: "custom",63 }).getRepositoryURL("/index.js", undefined)64 ).toEqual("https://github.com/octocat/test-repo1/tree/custom/index.js");65});66test("repo url with empty path", () => {67 expect(testEntry.getRepositoryURL("", "1.0")).toEqual(68 "https://github.com/octocat/test-repo1/tree/1.0"69 );70});71test("repo url with subdirectory", () => {72 expect(73 new GithubEntry({74 ...testDbEntry,75 path: "/test",76 }).getRepositoryURL("/index.js", "1.0")77 ).toEqual("https://github.com/octocat/test-repo1/tree/1.0/test/index.js");78});79test("directory listing", async () => {80 expect(await testEntry.getDirectoryListing("", "1.0")).toEqual([81 {82 name: "2015-04-12-test-post-last-year.md",83 size: 171,84 target: undefined,85 type: "file",86 },87 {88 name: "2016-02-24-first-post.md",89 size: 287,90 target: undefined,91 type: "file",92 },93 {94 name: "2016-02-26-sample-post-jekyll.md",95 size: 1041,96 target: undefined,97 type: "file",98 },99 ]);100});101test("version list", async () => {102 expect(await testEntry.getVersionList()).toEqual(["2.0", "1.0"]);...
Using AI Code Generation
1var argosSdk = require('argos-sdk');2var url = argosSdk.getRepositoryUrl();3var argosSdk = require('argos-sdk');4var url = argosSdk.getRepositoryUrl();5var argosSdk = require('argos-sdk');6var url = argosSdk.getRepositoryUrl();7var argosSdk = require('argos-sdk');8var url = argosSdk.getRepositoryUrl();9var argosSdk = require('argos-sdk');10var branch = argosSdk.getRepositoryBranch();11var argosSdk = require('argos-sdk');12var commit = argosSdk.getRepositoryCommit();13var argosSdk = require('argos-sdk');14var tag = argosSdk.getRepositoryTag();15var argosSdk = require('argos-sdk');16var version = argosSdk.getRepositoryVersion();17var argosSdk = require('argos-sdk');18var isDirty = argosSdk.isRepositoryDirty();19var argosSdk = require('argos-sdk');20var path = argosSdk.getRepositoryPath();
Using AI Code Generation
1define('Sage/Platform/Mobile/Utility', ['Sage/Platform/Mobile/Utility'], function(Utility) {2 return Utility;3});4define('Mobile/SalesLogix/Utility', ['Mobile/SalesLogix/Utility'], function(Utility) {5 return Utility;6});7define('Mobile/SalesLogix/Views/Account/Detail', ['Mobile/SalesLogix/Views/Account/Detail'], function(Detail) {8 return Detail;9});10define('Mobile/SalesLogix/Views/Account/Edit', ['Mobile/SalesLogix/Views/Account/Edit'], function(Edit) {11 return Edit;12});13define('Mobile/SalesLogix/Views/Account/List', ['Mobile/SalesLogix/Views/Account/List'], function(List) {14 return List;15});16define('Mobile/SalesLogix/Views/Activity/AttendeeLookup', ['Mobile/SalesLogix/Views/Activity/AttendeeLookup'], function(AttendeeLookup) {17 return AttendeeLookup;18});19define('Mobile/SalesLogix/Views/Activity/Calendar', ['Mobile/SalesLogix/Views/Activity/Calendar'], function(Calendar) {20 return Calendar;21});22define('Mobile/SalesLogix/Views/Activity/ConfirmList', ['Mobile/SalesLogix/Views/Activity/ConfirmList'], function(ConfirmList) {23 return ConfirmList;24});25define('Mobile/SalesLogix/Views/Activity/Detail', ['Mobile/SalesLogix/Views/Activity/Detail'], function(Detail) {26 return Detail;27});28define('Mobile/SalesLogix/Views/Activity/Edit', ['Mobile/SalesLogix/Views/Activity/Edit'], function(Edit) {29 return Edit;30});31define('Mobile/SalesLogix/Views/Activity/List', ['Mobile/SalesLogix/Views/Activity/List'], function(List) {32 return List;33});34define('Mobile/SalesLogix/Views/Activity/MyList', ['Mobile/SalesLogix/Views/Activity/MyList'], function(MyList) {35 return MyList;36});37define('Mobile/SalesLogix/Views/Activity/Recurring', ['Mobile/SalesLogix/Views/Activity/Recurring'], function(Recurring) {38 return Recurring;39});40define('Mobile/SalesLogix/Views/Activity/TypesList', ['Mobile/SalesLogix/
Using AI Code Generation
1const argos = require('argos-cli');2const url = argos.getRepositoryUrl();3console.log(url);4const argos = require('argos-cli');5const url = argos.getRepositoryUrl();6console.log(url);7const argos = require('argos-cli');8const url = argos.getRepositoryUrl();9console.log(url);10const argos = require('argos-cli');11const url = argos.getRepositoryUrl();12console.log(url);13const argos = require('argos-cli');14const url = argos.getRepositoryUrl();15console.log(url);16const argos = require('argos-cli');17const url = argos.getRepositoryUrl();18console.log(url);19const argos = require('argos-cli');20const url = argos.getRepositoryUrl();21console.log(url);22const argos = require('argos-cli');23const url = argos.getRepositoryUrl();24console.log(url);25const argos = require('argos-cli');26const url = argos.getRepositoryUrl();27console.log(url);28const argos = require('argos-cli');29const url = argos.getRepositoryUrl();30console.log(url);31const argos = require('argos-cli');32const url = argos.getRepositoryUrl();33console.log(url);34const argos = require('argos-cli');35const url = argos.getRepositoryUrl();36console.log(url);
Using AI Code Generation
1var argosRepoMgr = require('argos-repo-mgr');2argosRepoMgr.getRepositoryUrl('testRepo', function(err, repoUrl) {3 if (err) {4 console.log('Error getting repository url', err);5 } else {6 console.log('Repository url is', repoUrl);7 }8});9var argosRepoMgr = require('argos-repo-mgr');10argosRepoMgr.getRepository('testRepo', function(err, repo) {11 if (err) {12 console.log('Error getting repository', err);13 } else {14 console.log('Repository is', repo);15 }16});17var argosRepoMgr = require('argos-repo-mgr');18argosRepoMgr.getRepository('testRepo', function(err, repo) {19 if (err) {20 console.log('Error getting repository', err);21 } else {22 console.log('Repository is', repo);23 }24});25var argosRepoMgr = require('argos-repo-mgr');26argosRepoMgr.getRepository('testRepo', function(err, repo) {27 if (err) {28 console.log('Error getting repository', err);29 } else {30 console.log('Repository is', repo);31 }32});
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!