# Search string in Stardog Explorer

**URL:** <https://community.stardog.com/t/search-string-in-stardog-explorer/3509>\
**Category:** Support\
**Created:** [February 6, 2022, 2:33pm UTC](https://community.stardog.com/t/search-string-in-stardog-explorer/3509 "2022-02-06T14:33:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Muthu](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@Muthu](https://community.stardog.com/u/Muthu)\
**Post date:** [February 6, 2022, 2:33pm UTC](https://community.stardog.com/t/search-string-in-stardog-explorer/3509/1 "2022-02-06T14:33:09Z")

</div>

Hello,

I have a basic question related to the Stardog Explorer search string.

I have done the following

1. Created a Database using Studio
2. Created the Model using Studio
3. Created the mapping file and generated the Virtual Graph
4. Enabled Virtual Transparency option in the DB properties
5. Then Visualized the graph using Explorer

Everything seems working fine, but the only thing bothering is, every time I have to search for something then I have to provide the entire URI prefix to the Search keyword, like shown below. If I search only for the keyword then it is not fetching any result. Any idea what am I missing here? Please find below the snapshot of the Explorer

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/e58445fb2f4e8513cec1b11e9e07d7ac33ad497f.png)

# Mapping File (Partial):

```auto
PREFIX : <http://example.com/DNA/KG/Sample/>
PREFIX Sample: <http://example.com/DNA/KG/Sample/>
PREFIX rr: <http://www.w3.org/ns/r2rml#>

MAPPING
FROM SQL {
  SELECT "country_id", "country_name", "location_currency"
  FROM "public"."location"
  GROUP BY "country_id", "country_name", "location_currency"
}
TO {
  ?subject Sample:has_currency ?has_currency .
  ?subject Sample:has_name ?country_name .
  ?subject rdf:type Sample:Country
} WHERE {
  BIND(template("http://example.com/DNA/KG/Sample/{country_id}") AS ?subject)
  BIND(template("http://example.com/DNA/KG/Sample/{location_currency}") AS ?has_currency)
}
;

```

# Model

```auto
@prefix : <http://api.stardog.com/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix stardog: <tag:stardog:api:> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix Location: <http://example.com/DNA/KG/Sample/> .

Location:Currency a owl:Class ;
    <tag:stardog:studio:label> "Currency" ;
    rdfs:label "Currency" ;
    rdfs:comment "Currency" .

Location:Country a owl:Class ;
    <tag:stardog:studio:label> "Country" ;
    rdfs:label "Country" ;
    rdfs:comment "Country" ;
    rdfs:subClassOf owl:Thing .

Location:Region a owl:Class ;
    <tag:stardog:studio:label> "Region" ;
    rdfs:label "Region" ;
    rdfs:comment "Region" ;
    rdfs:subClassOf Location:Country .

```

---

<div class="post-metadata">

**Author:** ![Laura\_Firey](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/laura_firey/32/635_2.png) [@Laura\_Firey](https://community.stardog.com/u/Laura_Firey)\
**Post date:** [February 7, 2022, 2:58pm UTC](https://community.stardog.com/t/search-string-in-stardog-explorer/3509/2 "2022-02-07T14:58:53Z")

</div>

Hi Muthu,

To enable search for a virtual source you must also define one of the properties Explorer searches against. These properties include: `http://www.w3.org/2000/01/rdf-schema#comment`, `http://www.w3.org/2000/01/rdf-schema#label`, `http://www.w3.org/2004/02/skos/core#definition`, and `http://www.w3.org/2004/02/skos/core#prefLabel` (docs link, [Stardog Explorer | Stardog Documentation Latest](https://docs.stardog.com/stardog-applications/explorer/#searching-in-explorer)).

For instance, if you expanded your mapping to include rdfs:label for the country code, Country codes can be searched directly. Such as `BR` versus searching for the full IRI.

Example update to your partial mapping file:

```auto
PREFIX : <http://example.com/DNA/KG/Sample/>
PREFIX Sample: <http://example.com/DNA/KG/Sample/>
PREFIX rr: <http://www.w3.org/ns/r2rml#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

MAPPING
FROM SQL {
  SELECT "country_id", "country_name", "location_currency"
  FROM "public"."location"
  GROUP BY "country_id", "country_name", "location_currency"
}
TO {
  ?subject Sample:has_currency ?has_currency .
  ?subject Sample:has_name ?country_name .
  ?subject rdfs:label ?country_name .
  ?subject rdf:type Sample:Country
} WHERE {
  BIND(template("http://example.com/DNA/KG/Sample/{country_id}") AS ?subject)
  BIND(template("http://example.com/DNA/KG/Sample/{location_currency}") AS ?has_currency)
}
;

```

Please note that for virtual sources we only support `starts with` and `ends with` patterns as we don't support full-text search over virtual sources.

---

<div class="post-metadata">

**Author:** ![Muthu](https://avatars.discourse-cdn.com/v4/letter/m/bbce88/32.png) [@Muthu](https://community.stardog.com/u/Muthu)\
**Post date:** [February 7, 2022, 3:42pm UTC](https://community.stardog.com/t/search-string-in-stardog-explorer/3509/3 "2022-02-07T15:42:14Z")

</div>

Thank you so much Laura. This is very helpful, now it is working as expected. 😊

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [February 21, 2022, 3:43pm UTC](https://community.stardog.com/t/search-string-in-stardog-explorer/3509/4 "2022-02-21T15:43:05Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
